CVE-2023-41039: Sandbox escape via various forms of "format" in RestrictedPython
Vulnerability summary
CVE-2023-41039 is a high (CVSS 8.3) vulnerability in zope restrictedpython. EPSS estimates a 0.68% chance of exploitation in the next 30 days, higher than 52.5% of scored vulnerabilities.
Not severe (CVSS 8.3, network access); no exploitation reported by the 5 checked sources
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 1 · Related 1Timeline
- 30-08-2023PublishedVulnerability first disclosed.
- 01-10-2024Last modifiedVulnerability information updated.
Description
RestrictedPython is a restricted execution environment for Python to run untrusted code. Python's "format" functionality allows someone controlling the format string to "read" all objects accessible through recursive attribute lookup and subscription from objects he can access. This can lead to critical information disclosure. With `RestrictedPython`, the format functionality is available via the `format` and `format_map` methods of `str` (and `unicode`) (accessed either via the class or its instances) and via `string.Formatter`. All known versions of `RestrictedPython` are vulnerable. This issue has been addressed in commit `4134aedcff1` which has been included in the 5.4 and 6.2 releases. Users are advised to upgrade. There are no known workarounds for this vulnerability.
CVSS metrics
5 scores · 5 sources · 1 version- OSV · PypiEcosystem advisory · calculated7.7HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:NDiffers
- OSV · UbuntuEcosystem advisory · calculated7.7HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:NDiffers
- OSV · DebianEcosystem advisory · calculated7.7HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:NDiffers
- NVDNIST7.7HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:NDiffers
EPSS trend
Probability
0.68%
Chance of exploitation in the next 30 days
Percentile
53%
Versus all other CVEs
30-day change
No change 0.00 pp
From 0.68% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root causeAffected systems
Known conditions: network-reachable, administrative account, user interaction (CVSS vector). Other conditions: not stated in public data.
Debian1 product
- restrictedpythonAll versions (No fix recorded) | < 6.2-1
PyPI1 product
- restrictedpython≥ 6.0, < 6.2 | < 4134aedcff17c977da7717693ed89ce56d54c120 | < 5.4
Ubuntu1 product
- restrictedpython< 4.0~b3-2ubuntu0.1~esm1 | < 4.0~b3-3ubuntu0.1~esm1
Zope1 product
- restrictedpython< 5.4 | ≥ 6.0, < 6.2
Zopefoundation1 product
- restrictedpython< 5.4 | ≥ 6.0, < 6.1
5 vendors · 5 products
References
8 links- github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-xjw2-6jm9-rf67X Refsource CONFIRMWEBAdvisoryREPORTVendor Advisory
- github.com/zopefoundation/RestrictedPython/commit/4134aedcff17c977da7717693ed89ce56d54c120X Refsource MISCWEBFIXREPORTPatch