Vulnerabilities in pkg:pypi/RestrictedPython
PACKAGECVE-2026-76825 is a HIGH (CVSS 8.4) restrictedpython vulnerable to sandbox escape vulnerability (CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')) affecting RestrictedPython libraries in the PyPI ecosystem. The issue involves restrictedpython vulnerable to sandbox escape via string.formatter field resolution. Remediation is available by upgrading affected packages to version 8.4.
pkg:pypi/RestrictedPython
Vulnerability advisories affecting package pkg:pypi/RestrictedPython. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-hp3v-5vw7-fx9w | CVE-2026-76825 | HIGH | RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution |
| GHSA-ffg3-p8fm-mjx2 | CVE-2026-55830 | HIGH | RestrictedPython guard hooks can be shadowed via positional-only arguments |
| GHSA-gmj9-h825-chq2 | CVE-2025-22153 | HIGH | try/except* clauses could allow bypass RestrictedPython via type confusion bug in the CPython interpreter |
| GHSA-5rfv-66g4-jr8h | CVE-2024-47532 | HIGH | RestrictedPython information leakage via `AttributeError.obj` and the `string` module |
| GHSA-xjw2-6jm9-rf67 | CVE-2023-41039 | HIGH | Sandbox escape via various forms of "format". |
| GHSA-wqc8-x2pr-7jqh | CVE-2023-37271 | HIGH | RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape |
CVE-2026-76825 at a Glance
Security Impact
CVSS: 8.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H).
How to Fix CVE-2026-76825
To remediate this vulnerability, upgrade all affected RestrictedPython dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install RestrictedPython>=8.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show RestrictedPython
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-76825, inspect your installed packages using pip:
pip show RestrictedPython
Analyze the terminal output to locate any version of RestrictedPython in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.4), your application is affected.
Note: The pip show RestrictedPython command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection'), where the product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code. In RestrictedPython, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-76825 Affected RestrictedPython Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
RestrictedPython
|
PyPI |
< 8.4
|
8.4
|
References
Frequently Asked Questions
What is CVE-2026-76825?
Which RestrictedPython versions are affected?
What version fixes CVE-2026-76825?
Is RestrictedPython affected?
What is the CVSS score of CVE-2026-76825?
What CWE is associated with CVE-2026-76825?
How can I check PyPI dependencies for CVE-2026-76825?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hp3v-5vw7-fx9w",
"modified" : "2026-09-17T16:30:22Z",
"published" : "2026-09-17T16:30:22Z",
"aliases" : [ "CVE-2026-76825" ],
"summary" : "RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution",
"details" : "### Impact\nRestrictedPython could allow a sandbox escape when a policy exposes the standard library `string` module, or otherwise exposes `string.Formatter`, to restricted code.\n\n`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.\n\nUsers 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.\n\n### Patches\nThe problem has been patched by blocking access to `string.Formatter` and unsafe `string.Formatter` traversal methods in `safer_getattr`.\n\nUsers should upgrade to the patched release once available. Affected and patched version numbers should be filled in when the release is published.\n\n### Workarounds\nDo not expose the standard library `string` module or `string.Formatter` to restricted code.\n\nIf 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "RestrictedPython"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "8.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-hp3v-5vw7-fx9w"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-76825"
}, {
"type" : "WEB",
"url" : "https://github.com/zopefoundation/RestrictedPython/commit/3b47440070b91f8807c2b2998aca99e94783639a"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/zopefoundation/RestrictedPython"
}, {
"type" : "WEB",
"url" : "https://github.com/zopefoundation/RestrictedPython/releases/tag/8.4"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-470", "CWE-680", "CWE-693" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-17T16:30:22Z",
"nvd_published_at" : "2026-09-16T15:17:46Z"
}
}