CVE-2023-41039
published high CVSS 3.1 · 8.3Sandbox escape via various forms of "format" in RestrictedPython
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| zopefoundation | — | RestrictedPython< 5.4 · >= 6.0, < 6.1 | Affected | Not stated | GitHub_M |
| Ubuntu | focal | python3-restrictedpython | Advisory build | 4.0~b3-2ubuntu0.1~esm1 | USN-7355-1 |
| Ubuntu | focal | restrictedpython | Advisory build | 4.0~b3-2ubuntu0.1~esm1 | USN-7355-1 |
| Ubuntu | jammy | python3-restrictedpython | Advisory build | 4.0~b3-3ubuntu0.1~esm1 | USN-7355-1 |
| Ubuntu | jammy | restrictedpython | Advisory build | 4.0~b3-3ubuntu0.1~esm1 | USN-7355-1 |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 8.3 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| zopefoundation | RestrictedPython | < 5.4 (affected)>= 6.0, < 6.1 (affected) | GitHub_M · cna |
Weaknesses
1- CWE-74 CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
References
2Provider assertions
3GitHub_M · cna
Sandbox escape via various forms of "format" in RestrictedPython
CISA-ADP · adp
CISA ADP Vulnrichment
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- 460a011e65331b5b3c38493a86aadd7d7d406989c709f7e36ac876eefa9f773c
- Ingested
- 23 Sep 2026, 08:11:26 UTC
- Source record
- Official CVE record