CVE-2023-37271
published 2023-07-11CVE-2023-37271: RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environment…
PriorityP262critical9.9CVSS 3.1
AVNACLPRLUINSCCHIHAH
EPSS
0.77%
50.9th percentile
RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environment. RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. Prior to versions 6.1 and 5.3, an attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted sandbox and potentially allowing arbitrary code execution in the Python interpreter. All RestrictedPython deployments that allow untrusted users to write Python code in the RestrictedPython environment are at risk. In terms of Zope and Plone, this would mean deployments where the administrator allows untrusted users to create and/or edit objects of type `Script (Python)`, `DTML Method`, `DTML Document` or `Zope Page Template`. This is a non-default configuration and likely to be extremely rare. The problem has been fixed in versions 6.1 and 5.3.
Affected
12 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| debian | restrictedpython | < restrictedpython 6.2-1 (forky) | restrictedpython 6.2-1 (forky) |
| zope | restrictedpython | < 5.3 | 5.3 |
| zope | restrictedpython | — | — |
| zopefoundation | restrictedpython | < 5.3 | 5.3 |
| zopefoundation | restrictedpython | — | — |
| zopefoundation | restrictedpython | >= 0 < 6.2-1 | 6.2-1 |
| zopefoundation | restrictedpython | >= 0 < 6.2-1 | 6.2-1 |
| zopefoundation | restrictedpython | >= 0 < 5.3 | 5.3 |
| zopefoundation | restrictedpython | >= 0 < 4.0~b3-2ubuntu0.1~esm1 | 4.0~b3-2ubuntu0.1~esm1 |
| zopefoundation | restrictedpython | >= 0 < 4.0~b3-3ubuntu0.1~esm1 | 4.0~b3-3ubuntu0.1~esm1 |
| zopefoundation | restrictedpython | >= 0 < 6.2-1ubuntu0.24.04.1~esm1 | 6.2-1ubuntu0.24.04.1~esm1 |
| zopefoundation | restrictedpython | >= 6.0a1.dev0 < 6.1 | 6.1 |
Detection & IOCsextracted from sources · hover to see the quote
- →Exploit vector uses generator or generator expression constructs to access the current stack frame (`gi_frame`) and walk up the call stack beyond the RestrictedPython sandbox boundary — monitor for use of frame-walking attributes (e.g., `f_back`, `gi_frame`) inside RestrictedPython-evaluated code. ↗
- →Audit untrusted user-editable Zope/Plone object types — `Script (Python)`, `DTML Method`, `DTML Document`, and `Zope Page Template` — as these are the surfaces through which exploit code would be submitted. ↗
- →Stack frame access is not blocked in RestrictedPython prior to versions 6.1 and 5.3; flag any RestrictedPython deployment running versions below these thresholds as vulnerable. ↗
- ·Exploitation requires a non-default configuration where untrusted users are permitted to write Python code in the RestrictedPython environment; default deployments are not at risk. ↗
- ·All RestrictedPython deployments that permit untrusted user code submission are in scope, not just Zope/Plone. ↗
- ·On Debian, bookworm and bullseye remain open (unpatched); forky, sid, and trixie are resolved at version 6.2-1. ↗
CVSS provenance
nvdv3.19.9CRITICALCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
osv9.9CRITICAL
vendor_debian8.4HIGH
vendor_ubuntu8.4HIGH
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
OSV
restrictedpython vulnerabilities
osv·2025-03-18·CVSS 9.9
CVE-2023-37271 [CRITICAL] restrictedpython vulnerabilities
restrictedpython vulnerabilities
Nakul Choudhary and Robert Xiao discovered that RestrictedPython did not
properly sanitize certain inputs. An attacker could possibly use this
issue to execute arbitrary code. This issue only affected
Ubuntu 20.04 LTS and Ubuntu 22.04 LTS. (CVE-2023-37271)
Abhishek Govindarasu, Ankush Menat and Ward Theunisse discovered that
RestrictedPython did not correctly handle certain format strings. An
attacker could possibly use this issue to leak sensitive information.
This issue only affected Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.
(CVE-2023-41039)
It was discovered that RestrictedPython did not correctly restrict access
to certain fields. An attacker could possibly use this issue to leak
sensitive information. (CVE-2024-47532)
It was discovered that Restricted
OSV
CVE-2023-37271: RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environme
osv·2023-07-11·CVSS 9.9
CVE-2023-37271 [CRITICAL] CVE-2023-37271: RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environme
RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environment. RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. Prior to versions 6.1 and 5.3, an attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted sandbox and potentially allowing arbitrary code execution in the Python interpreter. All RestrictedPython deployments that allow untrusted users to write Python code in t
GHSA
RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
ghsa·2023-07-10
CVE-2023-37271 [HIGH] CWE-913 RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
### Impact
RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. An attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted scope allowing the call of unrestricted Python code and therefore potentially allowing arbitrary code execution in the Python interpreter.
All RestrictedPython deployments that allow untrusted users to write Python code in the RestrictedPython environmen
OSV
RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
osv·2023-07-10
CVE-2023-37271 [HIGH] RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
### Impact
RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. An attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted scope allowing the call of unrestricted Python code and therefore potentially allowing arbitrary code execution in the Python interpreter.
All RestrictedPython deployments that allow untrusted users to write Python code in the RestrictedPython environmen
Ubuntu
RestrictedPython vulnerabilities
vendor_ubuntu·2025-03-18·CVSS 8.4
CVE-2023-37271 [HIGH] RestrictedPython vulnerabilities
Title: RestrictedPython vulnerabilities
Summary: Several security issues were fixed in RestrictedPython.
Nakul Choudhary and Robert Xiao discovered that RestrictedPython did not
properly sanitize certain inputs. An attacker could possibly use this
issue to execute arbitrary code. This issue only affected
Ubuntu 20.04 LTS and Ubuntu 22.04 LTS. (CVE-2023-37271)
Abhishek Govindarasu, Ankush Menat and Ward Theunisse discovered that
RestrictedPython did not correctly handle certain format strings. An
attacker could possibly use this issue to leak sensitive information.
This issue only affected Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.
(CVE-2023-41039)
It was discovered that RestrictedPython did not correctly restrict access
to certain fields. An attacker could possibly use this issue to leak
s
Debian
CVE-2023-37271: restrictedpython - RestrictedPython is a tool that helps to define a subset of the Python language ...
vendor_debian·2023·CVSS 8.4
CVE-2023-37271 [HIGH] CVE-2023-37271: restrictedpython - RestrictedPython is a tool that helps to define a subset of the Python language ...
RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environment. RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. Prior to versions 6.1 and 5.3, an attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted sandbox and potentially allowing arbitrary code execution in the Python interpreter. All RestrictedPython deployments that allow untrusted users to write Python code in t
No detection rules found.
No public exploits indexed.
No writeups or analysis indexed.
https://github.com/zopefoundation/RestrictedPython/commit/c8eca66ae49081f0016d2e1f094c3d72095ef531https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-wqc8-x2pr-7jqhhttps://github.com/zopefoundation/RestrictedPython/commit/c8eca66ae49081f0016d2e1f094c3d72095ef531https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-wqc8-x2pr-7jqh
2023-07-11
Published