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

CVE-2026-76825 · Severity: high · CVSS 8.4 · Published 2026-09-16

RestrictedPython is a Python library used to safely execute untrusted code in a restricted sandbox environment. An attacker can bypass RestrictedPython's security controls by exploiting how the standard library's `string.Formatter` class traverses object attributes and items, potentially gaining access to sensitive objects like function globals, built-in functions, and file system or code execution primitives. This vulnerability only affects systems that expose the `string` module or `string.Formatter` to untrusted code, whether directly or through custom import policies.

Technologies: restrictedpython (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-76825 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-76825 being exploited in the wild.
How severe is CVE-2026-76825?
High severity, with a CVSS score of 8.4, published 16 September 2026.
Which products and versions are affected?
restrictedpython (PyPI) ECOSYSTEM:introduced=0,fixed=8.4; Zope Foundation RestrictedPython < 8.4.
Is there a fix for CVE-2026-76825?
Yes. restrictedpython (PyPI): upgrade to 8.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-76825 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-76825?
Check whether you run restrictedpython (PyPI) or Zope Foundation RestrictedPython at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • restrictedpython (PyPI): upgrade to 8.4 or later
    pip install "restrictedpython>=8.4"

Technical details

The vulnerability exists in RestrictedPython's attribute access guard mechanism. The `string.Formatter` class's field resolution methods (e.g., `get_field`) perform internal attribute and item traversal to resolve format string placeholders, and these traversals can return live object references that bypass RestrictedPython's `safer_getattr` guards. An attacker with the ability to execute code in the restricted environment can craft format strings that traverse the object graph to reach sensitive objects. The attack requires network access to the RestrictedPython execution environment and admin privileges to set up the restricted code execution context. The vulnerability has been patched in version 8.4 by blocking access to `string.Formatter` and its unsafe traversal methods in `safer_getattr`. Users running untrusted code should upgrade immediately and, as a workaround, should not expose the `string` module or `Formatter` instances to restricted code.

Affected products

  • Zope Foundation RestrictedPython < 8.4

Identifiers

  • CVE-2026-76825
  • GHSA-hp3v-5vw7-fx9w
  • PYSEC-2026-4161

Timeline

  • 2026-09-17: disclosed: GitHub Advisory GHSA-hp3v-5vw7-fx9w published
  • 2026-09-17: patched: Version 8.4 released with patch blocking string.Formatter access

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.