CVE-2023-41039

Sandbox escape via various forms of "format" in RestrictedPython

HIGH
7.7
CVSS Score
Published: August 30, 2023 at 05:18 PM UTC
Updated: June 17, 2026 at 06:20 AM UTC
2 products affected across 2 vendorsRestrictedpythonRestrictedPython

Using RestrictedPython by zopefoundation?

Get instant alerts when new vulnerabilities affect RestrictedPython - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.7
Exploit prediction
EPSS 0.7%
SSVC
No known exploit

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v < 5.46.0 ≤ v < 6.2
Affected range stops below 5.4, so it looks safe — our inference, not a vendor statement
Affected range stops below 6.2, so it looks safe — our inference, not a vendor statement
v < 5.4v < 6.1
Affected range stops below 5.4, so it looks safe — our inference, not a vendor statement
Affected range stops below 6.1, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

SSVC — Action Prioritization

SSVCNo known exploitNot automatableTotal impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

Attack Vector
NETWORK
Complexity
LOW
Privileges
LOW
User Interaction
NONE
Scope
CHANGED
Confidentiality
HIGH
Integrity
NONE
Availability
NONE
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-74

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card