CVE-2023-41039 | Sandbox escape via various forms of "format" in RestrictedPython

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.

Published: 2023-08-30 Last update: 2026-06-17 Assigner: [email protected] Source: [email protected]

Conclusion & alert: CVE-2023-41039 is rated Moderate Risk (49.6/100): CVSS High severity, with low exploitation likelihood (EPSS 0.64%). Mandatory action: Review affected assets and schedule remediation.

Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.

Exploit prediction scoring system (EPSS) score for CVE-2023-41039

EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).

# Date Old EPSS score New EPSS score Delta (New - Old)
1 2026-06-15 0.16% 0.64% +0.47%
2 2026-04-28 0.08% 0.16% +0.08%
3 2025-11-21 0.08%

Full EPSS history (11 records total)

Common vulnerability scoring system (CVSS) metrics for CVE-2023-41039

CVSS metrics for this CVE.

Base score Version Severity Vector Exploitability Impact Score source
8.3 3.1 HIGH
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:H)
They need powerful rights—admin, root, or similar—before this pays off.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:L)
Might cause slowdowns, glitches, or partial disruption—not a full brick.
1.7 6.0 [email protected]
7.7 3.1 HIGH
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:L)
A normal user session is enough; they don’t have to be admin.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:N)
Data isn’t meaningfully altered or forged.
Availability (A:N)
Service keeps running; no real outage angle.
3.1 4.0 [email protected]

Weakness enumeration for CVE-2023-41039

GitHub Security Advisory for CVE-2023-41039

GHSA-xjw2-6jm9-rf67 · Severity: high · Ecosystem: pip — Sandbox escape via various forms of "format".

OS Trackers for CVE-2023-41039

vendor priority summary link
debian not yet assigned CVE-2023-41039 not yet assigned priority: Debian including 1 source packages (restrictedpython), 5 status rows across 5 suites (bookworm, bullseye, forky, sid, trixie): resolved 3, open 2. https://security-tracker.debian.org/tracker/CVE-2023-41039
ubuntu medium CVE-2023-41039 medium priority: Ubuntu including 1 source packages (restrictedpython), 12 status rows across 12 suites (bionic, focal, jammy, lunar, mantic, noble, oracular, plucky, questing, trusty, upstream, xenial): not-affected 6, ignored 3, released 3. https://ubuntu.com/security/CVE-2023-41039

Affected software / configurations for CVE-2023-41039

Vendor Product Version Raw CPE
zope restrictedpython < 5.4 cpe:2.3:a:zope:restrictedpython:*:*:*:*:*:*:*:*
zope restrictedpython >= 6.0, < 6.2 cpe:2.3:a:zope:restrictedpython:*:*:*:*:*:*:*:*

References for CVE-2023-41039

cvelogic Threat Intelligence