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

Source: https://junglewise.ai/threats/cve-2026-76825-restrictedpython-sandbox-escape-via-string-formatter-field  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-16. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/pypi-restrictedpython). Vendors: [PyPI](https://junglewise.ai/threats/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

  ```sh
  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

- [https://api.github.com/users/icemac](https://api.github.com/users/icemac)

## Related threats

- [Zope RestrictedPython access policy bypass via positional-only arguments](https://junglewise.ai/threats/cve-2026-55830-zope-restrictedpython-access-policy-bypass-via-positional-only)
- [PYSEC-2026-1874 - try/except* clauses could allow bypass RestrictedPython via type confusion bug in the CPython interpreter](https://junglewise.ai/threats/cve-2025-22153-try-except-clauses-could-allow-bypass-restrictedpython-via-type)
- [RestrictedPython information leakage via `AttributeError.obj` and the `string` module](https://junglewise.ai/threats/cve-2024-47532-restrictedpython-information-leakage-via-attributeerror-obj-and)
- [Sandbox escape via various forms of "format".](https://junglewise.ai/threats/cve-2023-41039-sandbox-escape-via-various-forms-of-format)
- [RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape](https://junglewise.ai/threats/cve-2023-37271-restrictedpython-vulnerable-to-arbitrary-code-execution-via-stack)
