VDB

CVE-2023-41039

CVE-2023-41039 PUBLISHED CVSS 8.3 HIGH

Sandbox escape via various forms of "format" in RestrictedPython

Reported by github_m · Published August 30, 2023

RestrictedPython is fixed in 6.1 and 5.3 (PyPI)

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.

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
RestrictedPythonPyPI6.1, 5.3

Risk scores

CVSS 3.1
8.3
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L

Affected products

VendorProductVersions
zopefoundationRestrictedPython< 5.4, >= 6.0, < 6.1
PyPIRestrictedPython0, 6.0
zopefoundationRestrictedPython0, 6.0

Timeline

  • Aug 30, 2023 CVE Published
  • Aug 31, 2023 EPSS Score (30 in total, the first dated here)
  • Feb 16, 2024 CVE Updated
  • Feb 6, 2026 Security Advisory
  • Aug 4, 2026 Coalition ESS Score

Query this with the API

The same record, from the CLI:

vulnetix vdb vuln CVE-2023-41039
vulnetix vdb fixes CVE-2023-41039

Or with curl, using the org id and key from your account page:

curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
  "https://api.vdb.vulnetix.com/v2/vuln/CVE-2023-41039/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›