CVE-2026-76825: RestrictedPython: Sandbox escape via string.Formatter field resolution

Published Sep 16, 2026
·
Updated

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, getfield, getvalue, and vformat performed attribute and item traversal internally without passing through RestrictedPython's safergetattr 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.

Affected Software

1 affected component
RestrictedPython RestrictedPython<8.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade RestrictedPython to a version that resolves this vulnerability.

    Fixed in 8.4

Event History

Sep 16, 2026
CVE Published
via MITRE·02:09 PM
Data Sourced
via MITRE·02:09 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Deployments using RestrictedPython before version 8.4 are exposed if restricted code can access the standard-library string module, string.Formatter, a Formatter instance, or a Formatter subclass through custom import policy or supplied globals. The issue is not described as affecting configurations that do not expose any of those objects to restricted code.

2

What does an attacker need to exploit it?

An attacker needs the ability to submit or run restricted Python code and access to a live string.Formatter-related object through the sandbox's imports or globals. They can then abuse Formatter's internal attribute and item traversal, which bypasses RestrictedPython's safer_getattr protections.

3

What could successful exploitation allow?

Restricted code may escape the sandbox and reach function globals, builtins, file-access capabilities, or code-execution primitives in the host environment. This can affect confidentiality, integrity, and availability.

4

What should be done if an immediate upgrade is not possible?

Prevent restricted code from accessing the string module, string.Formatter, Formatter instances, and Formatter subclasses through custom import policies or supplied globals. This removes the object references identified as the path to exploitation until version 8.4 can be deployed.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203