CVE-2023-41039 json
Sandbox escape via various forms of "format" in RestrictedPython
published 3y ago modified 4mo ago also EUVD-2023-0229 , GHSA-xjw2-6jm9-rf67 , PYSEC-2023-159
- cvss
- 8.3
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.7%
- EPSS 0.7% chance of exploitation in 30 days, percentile 53%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- pypi restrictedpython 5.4, 6.2
- zope restrictedpython 5.4, 6.2
- restrictedpython Debian 14, Debian 13 6.2-1
debian advisories DEBIAN-CVE-2023-41039
- restrictedpython Ubuntu Pro 20.04 LTS 4.0~b3-2ubuntu0.1~esm1
- restrictedpython Ubuntu Pro 22.04 LTS 4.0~b3-3ubuntu0.1~esm1
ubuntu advisories UBUNTU-CVE-2023-41039
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
Is CVE-2023-41039 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerCISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- 2y ago
Exploit prediction
0.68% chance of exploitation in the next 30 days, higher than 53% of all scored CVEs (FIRST EPSS, 2026-11-15).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 8.3 | CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L |
| GitHub | 3.1 | 8.3 | CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L |
| NVD | 3.1 | 7.7 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N |
| OSV | 3.1 | 7.7 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | restrictedpython | <5.4 >=6.0, <6.2 |
5.4 6.2 |
Affected products
- zopefoundation RestrictedPython
Classification
- Weakness
-
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component
References
-
github.com
/zopefoundation/RestrictedPython/commit/4134aedcff17c977da7717693ed89ce56d54c120
web, patch
-
github.com
/zopefoundation/RestrictedPython/security/advisories/GHSA-xjw2-6jm9-rf67
web, vendor-advisory, advisory
-
nvd.nist.gov
/vuln/detail/CVE-2023-41039
advisory
-
github.com
/zopefoundation/RestrictedPython
package
Sources
- CVE List CVE-2023-41039
- GitHub Advisory GHSA-xjw2-6jm9-rf67
- NVD CVE-2023-41039
- OSV PYSEC-2023-159
- Maintainer advisory GHSA-xjw2-6jm9-rf67
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.
The maintainers of zopefoundation/RestrictedPython published their own advisory on GitHub. Reviewed sources take precedence over it.