CVE-2023-37271: RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
Vulnerability summary
CVE-2023-37271 is a critical (CVSS 9.9) vulnerability in zope restrictedpython. EPSS estimates a 0.85% chance of exploitation in the next 30 days, higher than 58.1% of scored vulnerabilities.
Not severe (CVSS 8.4, network access); no exploitation reported by the 5 checked sources
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 1 · Related 1Timeline
- 11-07-2023PublishedVulnerability first disclosed.
- 07-11-2024Last modifiedVulnerability information updated.
Description
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.
CVSS metrics
5 scores · 5 sources · 1 version- CVE.orgCNA8.4HighCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:LDiffers
- OSV · PypiEcosystem advisory · calculated8.4HighCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:LDiffers
- OSV · UbuntuEcosystem advisory · calculated9.9CriticalCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
- OSV · DebianEcosystem advisory · calculated9.9CriticalCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
EPSS trend
Probability
0.85%
Chance of exploitation in the next 30 days
Percentile
58%
Versus all other CVEs
30-day change
No change 0.00 pp
From 0.85% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root causeAffected systems
Known conditions: network-reachable, low-privilege account, no user interaction (CVSS vector). Other conditions: not stated in public data.
Debian1 product
- restrictedpythonAll versions (No fix recorded) | < 6.2-1
PyPI1 product
- restrictedpython≥ 6.0a1.dev0, < 6.1 | < c8eca66ae49081f0016d2e1f094c3d72095ef531 | < 5.3
Ubuntu1 product
- restrictedpython< 4.0~b3-2ubuntu0.1~esm1 | < 4.0~b3-3ubuntu0.1~esm1
Zope1 product
- restrictedpython< 5.3 | 6.0 | 6.0:a1.dev0
Zopefoundation1 product
- restrictedpython≥ 6.0a1.dev0, < 6.1 | < 5.3
5 vendors · 5 products
References
9 links- github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-wqc8-x2pr-7jqhX Refsource CONFIRMWEBAdvisoryREPORTVendor Advisory
- github.com/zopefoundation/RestrictedPython/commit/c8eca66ae49081f0016d2e1f094c3d72095ef531X Refsource MISCWEBFIXREPORTPatch