CVE-2026-76825
RestrictedPython: Sandbox escape via string.Formatter field resolution
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- High
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
8.4
RestrictedPython: Sandbox escape via string.Formatter field resolution
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.
- Record
CVE-2026-76825- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Weakness
- CWE-200, CWE-470, CWE-680, CWE-693
- Updated
- 2026-11-02
EUVDEUVD-2026-80780
8.4
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.
- Record
EUVD-2026-80780- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-hp3v-5vw7-fx9w
8.4
RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution
Impact
RestrictedPython could allow a sandbox escape when a policy exposes the standard library string module, or otherwise exposes string.Formatter, to restricted code.
string.Formatter field resolution methods such as get_field can perform attribute and item traversal internally and return live object references. This can bypass RestrictedPython's normal attribute guards and may allow access to sensitive objects such as function globals, builtins, file access, or code execution primitives.
Users are impacted if they run untrusted code with RestrictedPython and expose string.Formatter, directly or indirectly, for example through a custom import policy or globals.
Patches
The problem has been patched by blocking access to string.Formatter and unsafe string.Formatter traversal methods in safer_getattr.
Users should upgrade to the patched release once available. Affected and patched version numbers should be filled in when the release is published.
Workarounds
Do not expose the standard library string module or string.Formatter to restricted code.
If a custom import hook is used, deny imports of string or provide only a restricted wrapper that does not expose Formatter. If custom globals are supplied, ensure neither string.Formatter nor Formatter instances are available to restricted code.
- Record
GHSA-hp3v-5vw7-fx9w- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Weakness
- CWE-200, CWE-470, CWE-680, CWE-693
- Updated
- 2026-11-02
NVD
8.4
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.
- Record
CVE-2026-76825- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Weakness
- CWE-200, CWE-470, CWE-680, CWE-693
- Updated
- 2026-11-02
OSV
8.4
RestrictedPython: Sandbox escape via string.Formatter field resolution
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.
- Record
CVE-2026-76825- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Weakness
- CWE-200, CWE-470, CWE-680, CWE-693
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-76825
8.4
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.
- Record
DEBIAN-CVE-2026-76825- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Updated
- 2026-11-02
OSVGHSA-hp3v-5vw7-fx9w
8.4
RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution
Impact
RestrictedPython could allow a sandbox escape when a policy exposes the standard library string module, or otherwise exposes string.Formatter, to restricted code.
string.Formatter field resolution methods such as get_field can perform attribute and item traversal internally and return live object references. This can bypass RestrictedPython's normal attribute guards and may allow access to sensitive objects such as function globals, builtins, file access, or code execution primitives.
Users are impacted if they run untrusted code with RestrictedPython and expose string.Formatter, directly or indirectly, for example through a custom import policy or globals.
Patches
The problem has been patched by blocking access to string.Formatter and unsafe string.Formatter traversal methods in safer_getattr.
Users should upgrade to the patched release once available. Affected and patched version numbers should be filled in when the release is published.
Workarounds
Do not expose the standard library string module or string.Formatter to restricted code.
If a custom import hook is used, deny imports of string or provide only a restricted wrapper that does not expose Formatter. If custom globals are supplied, ensure neither string.Formatter nor Formatter instances are available to restricted code.
- Record
GHSA-hp3v-5vw7-fx9w- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Weakness
- CWE-200, CWE-470, CWE-680, CWE-693
- Updated
- 2026-11-02
OSVPYSEC-2026-4161
8.4
RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution
Impact
RestrictedPython could allow a sandbox escape when a policy exposes the standard library string module, or otherwise exposes string.Formatter, to restricted code.
string.Formatter field resolution methods such as get_field can perform attribute and item traversal internally and return live object references. This can bypass RestrictedPython's normal attribute guards and may allow access to sensitive objects such as function globals, builtins, file access, or code execution primitives.
Users are impacted if they run untrusted code with RestrictedPython and expose string.Formatter, directly or indirectly, for example through a custom import policy or globals.
Patches
The problem has been patched by blocking access to string.Formatter and unsafe string.Formatter traversal methods in safer_getattr.
Users should upgrade to the patched release once available. Affected and patched version numbers should be filled in when the release is published.
Workarounds
Do not expose the standard library string module or string.Formatter to restricted code.
If a custom import hook is used, deny imports of string or provide only a restricted wrapper that does not expose Formatter. If custom globals are supplied, ensure neither string.Formatter nor Formatter instances are available to restricted code.
- Record
PYSEC-2026-4161- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-76825
8.4
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.
- Record
UBUNTU-CVE-2026-76825- CVSS 3.1
- 8.4 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
restrictedpythonPyPI |
before 8.4 | 8.4 |
restrictedpythonDebian:12 |
All versions, plus listed versions 4.0~b3-36.2-18.0-18.1-18.4-1 |
None known |
restrictedpythonDebian:13 |
All versions, plus listed versions 8.0-18.1-18.4-1 |
None known |
restrictedpythonDebian:14 |
before 8.4-1, plus listed versions 8.0-18.1-1 |
8.4-1 |
restrictedpythonPyPI |
before 8.4, plus listed versions 3.4.23.4.33.5.03.5.13.5.2 Show 40 moreShow less3.6.03.6.0a14.04.0a14.0a24.0a34.0b14.0b24.0b34.0b44.0b54.0b64.0b74.0b85.05.15.25.2a1.dev05.35.3a1.dev05.46.06.0a1.dev06.16.27.07.0a1.dev07.0a1.dev17.0a2.dev07.17.27.2a1.dev07.37.48.08.18.1a1.dev08.28.38.3a1.dev0 |
8.4 |
restrictedpythonUbuntu:16.04:LTS |
All versions, plus listed versions 3.6.0-0ubuntu4 |
None known |
restrictedpythonUbuntu:18.04:LTS |
All versions, plus listed versions 3.6.0-0ubuntu4 |
None known |
restrictedpythonUbuntu:Pro:20.04:LTS |
All versions, plus listed versions 4.0~b3-24.0~b3-2ubuntu0.1~esm1 |
None known |
restrictedpythonUbuntu:Pro:22.04:LTS |
All versions, plus listed versions 4.0~b3-24.0~b3-2ubuntu14.0~b3-34.0~b3-3ubuntu0.1~esm1 |
None known |
restrictedpythonUbuntu:Pro:24.04:LTS |
All versions, plus listed versions 4.0~b3-36.2-16.2-1ubuntu0.24.04.1~esm1 |
None known |
restrictedpythonUbuntu:26.10 |
All versions, plus listed versions 8.1-18.4-1 |
None known |
restrictedpythonUbuntu:26.04:LTS |
All versions, plus listed versions 8.0-18.1-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-76825 is a high vulnerability (CVSS 8.4) in Zopefoundation Restrictedpython, published September 16, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.62%, the 50th percentile. Fixed in restrictedpython 8.4.
References
github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-hp3v-5vw7-fx9w
github.com/zopefoundation/RestrictedPython/commit/3b47440070b91f8807c2b2998aca99e94783639a
github.com/zopefoundation/RestrictedPython/releases/tag/8.4
nvd.nist.gov/vuln/detail/CVE-2026-76825
github.com/advisories/GHSA-hp3v-5vw7-fx9w
github.com/CVEProject/cvelistV5/tree/main/cves/2026/76xxx/CVE-2026-76825.json