Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate and submit restricted Python
-
DeliveryReference host-exposed string.Formatter
-
ExploitCall get_field/vformat to traverse into __globals__
-
ExecutionReach __builtins__ eval/exec
-
ImpactExecute arbitrary code on host
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V14 - Data Protection Data exposure prevention
MITRE ATT&CK
2 techniques across 2 tactics: Collection, Discovery The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the host application to expose to restricted code one of: the standard-library string module, the string.Formatter class, a Formatter instance, or a Formatter subclass - supplied either through a custom import policy or via the globals passed to restricted execution. This is a non-default condition: stock RestrictedPython does not expose these objects. The attacker must also be able to submit restricted Python code to the sandbox (typically an authenticated user of the hosting application). Limiting factors: only RestrictedPython versions prior to 8.4 are affected, and deployments that never expose string/Formatter are not exploitable regardless of version. |
| Impact | The CVSS 3.1 base score is 8.4 (vendor vector AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H), reflecting a sandbox escape from RestrictedPython's restricted execution context into the host environment with full confidentiality, integrity, and availability impact. The high score is driven by the scope change (S:C) and full-triad impact - this is a genuine sandbox-escape leading to code execution, not merely information disclosure. However, real-world risk is materially gated by a non-default precondition: exploitation only works if the deploying application exposes the standard-library string module, string.Formatter class, an instance, or a subclass to restricted code (via a custom import policy or globals). Stock RestrictedPython does not expose these, so exploitability depends on host configuration. There is no EPSS score, no CISA KEV listing, and no vendor claim of active exploitation, so this is not confirmed as actively exploited. That said, the fix commit's test suite publicly demonstrates a complete working escape (string.Formatter().get_field('0.__globals__[__builtins__]', ...) → eval), so a public exploit technique effectively exists. Signals are consistent (no KEV/EPSS conflict); the primary caveat is the mislabeled CWE-200/Information Disclosure framing, which understates that this is a full code-execution sandbox escape. Priority is high for anyone running RestrictedPython that exposes string/Formatter to untrusted code; low for deployments that do not. |
| Exploit ScenarioDerived | An attacker able to submit restricted Python code to an application that exposes string.Formatter (class, instance, or subclass) or the string module to the sandbox crafts a format specification that drives Formatter.get_field/vformat through attribute and item traversal that bypasses safer_getattr. This yields a live reference to a function's __globals__ and __builtins__, from which the attacker reaches eval/exec or file-access primitives and runs arbitrary code in the host environment. A working exploit chain is published in the fix's own regression tests, so the technique is publicly documented. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 16, 2026
Sandbox escape in RestrictedPython versions prior to 8.4 lets code executing inside the restricted context reach host-level primitives - function globals, builtins, file access, and code-execution gadgets - whenever the host exposes the standard-library string module, the string.Formatter class, a Formatter instance, or a Formatter subclass to that restricted code. The prerequisite is non-default: stock RestrictedPython does not surface these objects, so a custom import policy or specially crafted globals must be in place, and the attacker must also be able to submit restricted Python code (typically an authenticated user of the hosting application). A vendor patch is available in 8.4; no public exploit was identified at time of analysis.
RemediationAI
Upgrade to RestrictedPython 8.4, the vendor-released patch that fixes this issue; the relevant change is commit 3b47440070b91f8807c2b2998aca99e94783639a, which blocks import of string.Formatter and raises NotImplementedError from safer_getattr for the format, get_field, get_value, and vformat methods on Formatter instances, the Formatter class, and Formatter subclasses. Full details are in the advisory at https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-hp3v-5vw7-fx9w. If an immediate upgrade is not possible, the effective compensating control is to stop handing the dangerous objects to restricted code: audit the custom import policy and the globals mapping passed to restricted execution and remove any grant of the stdlib string module, string.Formatter, Formatter instances, or Formatter subclasses, replacing them with plain str formatting or a host-provided allow-listed wrapper. The trade-off is that legitimate restricted code relying on string.capwords and similar helpers will break, and any indirect route to a live Formatter object (for example through a shared object graph reachable from an allowed module) must also be closed, so this workaround is weaker than the patch and should be treated as temporary. Note that after upgrading, deployments may still want to remove the string module from exposed globals as defense in depth, since the fix deliberately changes behaviour by making Formatter access raise NotImplementedError rather than silently succeeding.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
RestrictedPython defines a subset of Python that a host application can execute on untrusted input, enforcing its restrictions largely through guard functions such as safer_getattr, safe_builtins, and associated attribute/item access wrappers. The vulnerable surface is CPython's string.Formatter, whose format, get_field, get_value, and vformat methods perform attribute and item traversal internally using the interpreter's own mechanisms rather than the guarded accessors RestrictedPython installs. Because those internal lookups never pass through safer_getattr, a live Formatter instance (or the Formatter class itself, called in unbound fashion) acts as an unguarded proxy for arbitrary attribute chains; the upstream regression test demonstrates exactly this by encoding underscore characters with chr(95) and walking '0.__globals__[__builtins__]' to obtain eval and execute '1+1'. The fix in commit 3b47440070b91f8807c2b2998aca99e94783639a hardens safer_getattr in src/RestrictedPython/Guards.py: it refuses the import of string.Formatter outright and raises NotImplementedError for the four unsafe method names when the target is a Formatter instance, the Formatter class, or a subclass of it. CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor) is the assigned classification, although the demonstrated consequence - recovering eval from a function's __globals__ - escalates to full sandbox escape with code execution, so the CWE understates the practical reach. The single CPE, cpe:2.3:a:zopefoundation:restrictedpython:*:*:*:*:*:*:*:*, marks all releases before 8.4 as affected.
Know when Restrictedpython gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H
AC:H because exploitation depends on a non-default host config exposing Formatter; PR:L as the attacker must be able to submit restricted code; UI:N (no victim action); S:C and full triad for host-environment code execution.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
RestrictedPython is a tool that helps define a subset of the Python language for accepting program input in a trusted environment. Prior to 8.4, RestrictedPython could allow a sandbox escape when a custom import policy or globals exposed the standard library string module, the string.Formatter class, a Formatter instance, or a Formatter subclass to restricted code. The string.Formatter methods format, get_field, get_value, and vformat performed attribute and item traversal internally without passing through RestrictedPython's safer_getattr protections. Restricted code could use those live object references to reach function globals, builtins, file access, or code execution primitives, affecting confidentiality, integrity, and availability in the host environment. This issue is fixed in version 8.4.
Blast Radius
ecosystem impact- 4 pypi packages depend on restrictedpython (4 direct, 0 indirect)
Ecosystem-wide dependent count for version 8.4.
Technical POC Analysis
Guard-bypass in RestrictedPython's attribute-access protection, classified by the advisory as CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor).
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
The RestrictedPython library, which many applications rely on to safely run untrusted or customer-supplied Python code, is affected by a sandbox escape in versions prior to 8.4 that can let that code reach host-level capabilities such as file access and arbitrary code execution. The exposure is limited to deployments that use a customized import policy or globals and deliberately surface Python's string-formatting objects to restricted code, so most teams are not affected. Leadership should care because any environment matching those conditions effectively loses its isolation boundary, putting the hosting application and any data it can reach at risk.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
More in Restrictedpython
View allRestrictedPython is a restricted execution environment for Python to run untrusted code. Rated high severity (CVSS 8.7),
RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program
RestrictedPython is a restricted execution environment for Python to run untrusted code. Rated high severity (CVSS 7.7),
EUVD-2026-80780
GHSA-hp3v-5vw7-fx9w
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB