Read the docs
TI-2023-21665 Aliases CVE-2023-41039GHSA-xjw2-6jm9-rf67

Sandbox escape via various forms of "format" in RestrictedPython

Priority LOW 39CWE-74Published · Updated

Key facts

Attack vector
Network
Privileges required
High
User interaction
Required
Attack complexity
Low
Impact type
—
Confidentiality · integrity · availability
High · High · Low
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00683 52nd percentileScored 2026-11-07
Fix Fixed RestrictedPython (zopefoundation): 5.4, 6.1RestrictedPython (PyPI): 5.4, 6.2

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Total

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
zopefoundationRestrictedPythonbefore 5.4; 6.0 to before 6.15.4, 6.1Patch availableCNA
—RestrictedPython (PyPI)before 5.45.4Patch availableGHSA-xjw2-6jm9-rf67
—RestrictedPython (PyPI)6.0 to before 6.26.2Patch availableGHSA-xjw2-6jm9-rf67
  • RestrictedPython Vendorzopefoundation Affected before 5.4; 6.0 to before 6.1 Fixed in 5.4, 6.1 Patch available CNA
  • RestrictedPython (PyPI) Vendor— Affected before 5.4 Fixed in 5.4 Patch available GHSA-xjw2-6jm9-rf67
  • RestrictedPython (PyPI) Vendor— Affected 6.0 to before 6.2 Fixed in 6.2 Patch available GHSA-xjw2-6jm9-rf67

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:zope:restrictedpython:*:*:*:*:*:*:*:*before 5.4; 6.0 to before 6.2Vulnerablezopefoundation
  • cpe:2.3:a:zope:restrictedpython:*:*:*:*:*:*:*:* Versions before 5.4; 6.0 to before 6.2 Vulnerable ·zopefoundation

Remediation

  • Fix · CNA RestrictedPython (zopefoundation) Fixed in 5.4, 6.1
  • Fix · GHSA-xjw2-6jm9-rf67 RestrictedPython (PyPI) Fixed in 5.4 Advisory →
  • Fix · GHSA-xjw2-6jm9-rf67 RestrictedPython (PyPI) Fixed in 6.2 Advisory →

Timeline

  1. 2026-10-02 Threatist record created from CVE-2023-41039
  2. 2026-10-03 Alias added: GHSA-xjw2-6jm9-rf67

References

  • TI-2024-31821 RestrictedPython information leakage via `AttributeError.obj` and the `string` module CVSS 4.0HIGH 8.7
  • TI-2023-18901 RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape CVSS 3.1CRITICAL 9.9

Sources