CVE-2023-37271 | RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape

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.

Published: 2023-07-11 Last update: 2026-06-17 Assigner: [email protected] Source: [email protected]

Conclusion & alert: CVE-2023-37271 is rated Moderate Risk (51.8/100): CVSS High severity, with medium exploitation likelihood (EPSS 0.77%). Mandatory action: Review affected assets and schedule remediation.

Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.

Exploit prediction scoring system (EPSS) score for CVE-2023-37271

EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).

# Date Old EPSS score New EPSS score Delta (New - Old)
1 2026-06-15 0.31% 0.77% +0.46%
2 2026-04-05 0.23% 0.31% +0.08%
3 2025-11-21 0.23%

Full EPSS history (12 records total)

Common vulnerability scoring system (CVSS) metrics for CVE-2023-37271

CVSS metrics for this CVE.

Base score Version Severity Vector Exploitability Impact Score source
8.4 3.1 HIGH
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:H)
Even with access, the exploit needs extra luck, timing, or a fussy environment to actually work.
Privileges required (PR:L)
A normal user session is enough; they don’t have to be admin.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:L)
Might cause slowdowns, glitches, or partial disruption—not a full brick.
1.8 6.0 [email protected]
9.9 3.1 CRITICAL
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:L)
A normal user session is enough; they don’t have to be admin.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:H)
Could take the service down hard or make it unusable for people who depend on it.
3.1 6.0 [email protected]

Weakness enumeration for CVE-2023-37271

GitHub Security Advisory for CVE-2023-37271

GHSA-wqc8-x2pr-7jqh · Severity: high · Ecosystem: pip — RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape

OS Trackers for CVE-2023-37271

vendor priority summary link
debian not yet assigned CVE-2023-37271 not yet assigned priority: Debian including 1 source packages (restrictedpython), 5 status rows across 5 suites (bookworm, bullseye, forky, sid, trixie): resolved 3, open 2. https://security-tracker.debian.org/tracker/CVE-2023-37271
ubuntu medium CVE-2023-37271 medium priority: Ubuntu including 1 source packages (restrictedpython), 13 status rows across 13 suites (bionic, focal, jammy, kinetic, lunar, mantic, noble, oracular, plucky, questing, trusty, upstream, xenial): not-affected 6, ignored 4, released 3. https://ubuntu.com/security/CVE-2023-37271

Affected software / configurations for CVE-2023-37271

Vendor Product Version Raw CPE
zope restrictedpython < 5.3 cpe:2.3:a:zope:restrictedpython:*:*:*:*:*:*:*:*
zope restrictedpython 6.0 cpe:2.3:a:zope:restrictedpython:6.0:-:*:*:*:*:*:*
zope restrictedpython 6.0 cpe:2.3:a:zope:restrictedpython:6.0:a1.dev0:*:*:*:*:*:*

References for CVE-2023-37271

cvelogic Threat Intelligence