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

High 8.4 Published Updated

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.

Weakness: CWE-693, CWE-680, CWE-470, CWE-200

Which versions are affected by CVE-2026-76825?

3 open source packages ship an affected version, including restrictedpython and RestrictedPython.

PackageAffectedFixed in
restrictedpython PyPIAll versions8.4
restrictedpython PyPIAll versions8.4
RestrictedPython PyPIAll versions8.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.

Is CVE-2026-76825 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free