{"id":"GHSA-hp3v-5vw7-fx9w","summary":"RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution","details":"### Impact\nRestrictedPython could allow a sandbox escape when a policy exposes the standard library `string` module, or otherwise exposes `string.Formatter`, to restricted code.\n\n`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.\n\nUsers 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.\n\n### Patches\nThe problem has been patched by blocking access to `string.Formatter` and unsafe `string.Formatter` traversal methods in `safer_getattr`.\n\nUsers should upgrade to the patched release once available. Affected and patched version numbers should be filled in when the release is published.\n\n### Workarounds\nDo not expose the standard library `string` module or `string.Formatter` to restricted code.\n\nIf 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.","aliases":["CVE-2026-76825"],"modified":"2026-09-17T16:45:06.276365932Z","published":"2026-09-17T16:30:22Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-09-17T16:30:22Z","nvd_published_at":"2026-09-16T15:17:46Z","cwe_ids":["CWE-200","CWE-470","CWE-680","CWE-693"],"severity":"HIGH"},"references":[{"type":"WEB","url":"https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-hp3v-5vw7-fx9w"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-76825"},{"type":"WEB","url":"https://github.com/zopefoundation/RestrictedPython/commit/3b47440070b91f8807c2b2998aca99e94783639a"},{"type":"PACKAGE","url":"https://github.com/zopefoundation/RestrictedPython"},{"type":"WEB","url":"https://github.com/zopefoundation/RestrictedPython/releases/tag/8.4"}],"affected":[{"package":{"name":"restrictedpython","ecosystem":"PyPI","purl":"pkg:pypi/restrictedpython"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"8.4"}]}],"versions":["3.4.2","3.4.3","3.5.0","3.5.1","3.5.2","3.6.0","3.6.0a1","4.0","4.0a1","4.0a2","4.0a3","4.0b1","4.0b2","4.0b3","4.0b4","4.0b5","4.0b6","4.0b7","4.0b8","5.0","5.1","5.2","5.2a1.dev0","5.3","5.3a1.dev0","5.4","6.0","6.0a1.dev0","6.1","6.2","7.0","7.0a1.dev0","7.0a1.dev1","7.0a2.dev0","7.1","7.2","7.2a1.dev0","7.3","7.4","8.0","8.1","8.1a1.dev0","8.2","8.3","8.3a1.dev0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hp3v-5vw7-fx9w/GHSA-hp3v-5vw7-fx9w.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H"}]}