CVE-2026-76825 RestrictedPython: Sandbox escape via string.Formatter field resolution
Attackers can escape the RestrictedPython sandbox to execute arbitrary code if the string module is exposed to restricted code.
- Exploited in the wild
- Not known
- Login needed
- An administrator
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-76825?
CVE-2026-76825 is a high-severity code injection vulnerability in zopefoundation RestrictedPython, published on 16 Sep 2026. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.
Official description
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.
Which versions are affected by CVE-2026-76825?
3 open source packages ship an affected version, including restrictedpython and RestrictedPython.
| Package | Affected | Fixed in |
|---|---|---|
restrictedpython PyPI | All versions | 8.4 |
restrictedpython PyPI | All versions | 8.4 |
RestrictedPython PyPI | All versions | 8.4 |
How do I fix CVE-2026-76825?
Upgrade restrictedpython to 8.4 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2026-76825 being exploited?
There is no known exploitation of CVE-2026-76825 in the wild and no public exploit code.
Sources
Also known as DEBIAN-CVE-2026-76825, ECHO-d1ef-a46c-f47d, GHSA-hp3v-5vw7-fx9w, MINI-5gh9-wxp2-6vjc, MINI-73w8-j9wr-5f93, MINI-g228-w3h2-2463 and 8 more.