Skip to content

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

HighCVSS 7.7 EPSS 0.68%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: total
Technology
UbuntuDebian

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.

Upgrade path

9 packages: 7 fixed, 1 with no fix yet.

PackageAffectedFixed inStatus
debian/restrictedpython(Debian 12) = 4.0~b3-3; = 6.2-1; = 8.0-1; = 8.1-1 +2 more No fix listed No fix yet
debian/restrictedpython(Debian 13) < 6.2-1 6.2-1 Fixed
debian/restrictedpython(Debian 14) < 6.2-1 6.2-1 Fixed
pypi restrictedpython(PyPI) < 5.4; <= 5.3; = 3.4.2; = 3.4.3 +27 more 5.4, 6.2 Fixed
ubuntu/restrictedpython(Ubuntu 22.04) < 4.0~b3-3ubuntu0.1~esm1 4.0~b3-3ubuntu0.1~esm1 Fixed
ubuntu/restrictedpython(Ubuntu Pro 20.04) < 4.0~b3-2ubuntu0.1~esm1; = 4.0~b3-2 4.0~b3-2ubuntu0.1~esm1 Fixed
ubuntu/restrictedpython(Ubuntu Pro 22.04) < 4.0~b3-3ubuntu0.1~esm1; = 4.0~b3-2; = 4.0~b3-2ubuntu1; = 4.0~b3-3 4.0~b3-3ubuntu0.1~esm1 Fixed
zope restrictedpython < 5.4; >= 6.0, < 6.2 5.4, 6.2 Fixed
zopefoundation RestrictedPython = < 5.4; = >= 6.0, < 6.1 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
pypi restrictedpython(PyPI) < 5.4 5.4
pypi restrictedpython(PyPI) = 3.4.2 No fix listed
pypi restrictedpython(PyPI) = 3.4.3 No fix listed
pypi restrictedpython(PyPI) = 3.5.0 No fix listed
pypi restrictedpython(PyPI) = 3.5.1 No fix listed
pypi restrictedpython(PyPI) = 3.5.2 No fix listed
pypi restrictedpython(PyPI) = 3.6.0 No fix listed
pypi restrictedpython(PyPI) = 3.6.0a1 No fix listed
pypi restrictedpython(PyPI) = 4.0 No fix listed
pypi restrictedpython(PyPI) = 4.0a1 No fix listed
pypi restrictedpython(PyPI) = 4.0a2 No fix listed
pypi restrictedpython(PyPI) = 4.0a3 No fix listed
pypi restrictedpython(PyPI) = 4.0b1 No fix listed
pypi restrictedpython(PyPI) = 4.0b2 No fix listed
pypi restrictedpython(PyPI) = 4.0b3 No fix listed
pypi restrictedpython(PyPI) = 4.0b4 No fix listed
pypi restrictedpython(PyPI) = 4.0b5 No fix listed
pypi restrictedpython(PyPI) = 4.0b6 No fix listed
pypi restrictedpython(PyPI) = 4.0b7 No fix listed
pypi restrictedpython(PyPI) = 4.0b8 No fix listed
pypi restrictedpython(PyPI) = 5.0 No fix listed
pypi restrictedpython(PyPI) = 5.1 No fix listed
pypi restrictedpython(PyPI) = 5.2 No fix listed
pypi restrictedpython(PyPI) = 5.2a1.dev0 No fix listed
pypi restrictedpython(PyPI) = 5.3 No fix listed
Show 25 more
ProductAffected versionsFixed in
pypi restrictedpython(PyPI) = 5.3a1.dev0 No fix listed
pypi restrictedpython(PyPI) >= 6.0, < 6.2 6.2
pypi restrictedpython(PyPI) = 6.0 No fix listed
pypi restrictedpython(PyPI) = 6.1 No fix listed
pypi restrictedpython(PyPI) <= 5.3 No fix listed
pypi restrictedpython(PyPI) >= 6.0, <= 6.1 No fix listed
debian/restrictedpython(Debian:12) All versions No fix listed
debian/restrictedpython(Debian:12) = 4.0~b3-3 No fix listed
debian/restrictedpython(Debian:12) = 6.2-1 No fix listed
debian/restrictedpython(Debian:12) = 8.0-1 No fix listed
debian/restrictedpython(Debian:12) = 8.1-1 No fix listed
debian/restrictedpython(Debian:12) = 8.4-1 No fix listed
debian/restrictedpython(Debian:13) < 6.2-1 6.2-1
debian/restrictedpython(Debian:14) < 6.2-1 6.2-1
zopefoundation RestrictedPython = < 5.4 No fix listed
zopefoundation RestrictedPython = >= 6.0, < 6.1 No fix listed
ubuntu/restrictedpython(Ubuntu:22.04) < 4.0~b3-3ubuntu0.1~esm1 4.0~b3-3ubuntu0.1~esm1
zope restrictedpython < 5.4 5.4
zope restrictedpython >= 6.0, < 6.2 6.2
ubuntu/restrictedpython(Ubuntu:Pro:20.04) < 4.0~b3-2ubuntu0.1~esm1 4.0~b3-2ubuntu0.1~esm1
ubuntu/restrictedpython(Ubuntu:Pro:20.04) = 4.0~b3-2 No fix listed
ubuntu/restrictedpython(Ubuntu:Pro:22.04) < 4.0~b3-3ubuntu0.1~esm1 4.0~b3-3ubuntu0.1~esm1
ubuntu/restrictedpython(Ubuntu:Pro:22.04) = 4.0~b3-2 No fix listed
ubuntu/restrictedpython(Ubuntu:Pro:22.04) = 4.0~b3-2ubuntu1 No fix listed
ubuntu/restrictedpython(Ubuntu:Pro:22.04) = 4.0~b3-3 No fix listed

References