RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution
Impact
RestrictedPython could allow a sandbox escape when a policy exposes the standard library string module, or otherwise exposes string.Formatter, to restricted code.
string.Formatter field resolution methods such as get_field can perform attribute and item traversal internally and return live object references. This can bypass RestrictedPython's normal attribute guards and may allow access to sensitive objects such as function globals, builtins, file access, or code execution primitives.
Users are impacted if they run untrusted code with RestrictedPython and expose string.Formatter, directly or indirectly, for example through a custom import policy or globals.
Patches
The problem has been patched by blocking access to string.Formatter and unsafe string.Formatter traversal methods in safer_getattr.
Users should upgrade to the patched release once available. Affected and patched version numbers should be filled in when the release is published.
Workarounds
Do not expose the standard library string module or string.Formatter to restricted code.
If a custom import hook is used, deny imports of string or provide only a restricted wrapper that does not expose Formatter. If custom globals are supplied, ensure neither string.Formatter nor Formatter instances are available to restricted code.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | restrictedpython | < 8.4 | 8.4 |
Verweise
- https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-hp3v-5vw7-fx9w
- https://nvd.nist.gov/vuln/detail/CVE-2026-76825
- https://github.com/zopefoundation/RestrictedPython/commit/3b47440070b91f8807c2b2998aca99e94783639a
- https://github.com/zopefoundation/RestrictedPython
- https://github.com/zopefoundation/RestrictedPython/releases/tag/8.4
- https://pypi.org/project/restrictedpython
- https://github.com/advisories/GHSA-hp3v-5vw7-fx9w
- CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H- Schwäche (CWE)
CWE-200, CWE-470, CWE-680, CWE-693- Plattform
- Python (PyPI)
- Paket
restrictedpython- Veröffentlicht
- 17.09.2026
- Aktualisiert
- 11.10.2026 15:18
Quellen und Lizenzen
OSV / GitHub Advisory Database - PYSEC-2026-4161 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-hp3v-5vw7-fx9w - CC BY 4.0
Schwachstellenhistorie: restrictedpython
Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 6
- Erste → letzte
- 07.2023 09.2026
- Ohne Fix
- 0
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Hoch 6
Veröffentlichungen pro Jahr
- 2023: 2
- 2024: 1
- 2025: 1
- 2026: 2
-
RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.