GHSA-hp3v-5vw7-fx9w

Suggest an improvement
Source
https://github.com/advisories/GHSA-hp3v-5vw7-fx9w
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hp3v-5vw7-fx9w/GHSA-hp3v-5vw7-fx9w.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-hp3v-5vw7-fx9w
Aliases
Downstream
Published
2026-09-17T16:30:22Z
Modified
2026-09-17T16:45:06Z
Severity
  • 8.4 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H CVSS Calculator
Summary
RestrictedPython vulnerable to sandbox escape via string.Formatter field resolution
Details

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.

Database specific
{
    "cwe_ids": [
        "CWE-200",
        "CWE-470",
        "CWE-680",
        "CWE-693"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-09-17T16:30:22Z",
    "nvd_published_at": "2026-09-16T15:17:46Z",
    "severity": "HIGH"
}
References

Affected packages

PyPI / restrictedpython

Package

Name
restrictedpython
View open source insights on deps.dev
Purl
pkg:pypi/restrictedpython

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
8.4

Affected versions

3.*
3.4.2
3.4.3
3.5.0
3.5.1
3.5.2
3.6.0a1
3.6.0
4.*
4.0a1
4.0a2
4.0a3
4.0b1
4.0b2
4.0b3
4.0b4
4.0b5
4.0b6
4.0b7
4.0b8
4.0
5.*
5.0
5.1
5.2a1.dev0
5.2
5.3a1.dev0
5.3
5.4
6.*
6.0a1.dev0
6.0
6.1
6.2
7.*
7.0a1.dev0
7.0a1.dev1
7.0a2.dev0
7.0
7.1
7.2a1.dev0
7.2
7.3
7.4
8.*
8.0
8.1a1.dev0
8.1
8.2
8.3a1.dev0
8.3

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"