{"answers":{"affected":"5 open source packages ship an affected version, including restrictedpython and RestrictedPython. It affects 1 product.","exploited":"There is no known exploitation of CVE-2023-41039 in the wild and no public exploit code.","fix":"Upgrade restrictedpython to a fixed version for your release line: 5.4 or 6.2.","what":"CVE-2023-41039 is a high-severity vulnerability in zopefoundation RestrictedPython, published on 30 Aug 2023. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2023-41039 and fix it if it is affected.\n\nWhat it is: CVE-2023-41039 is a high-severity vulnerability in zopefoundation RestrictedPython, published on 30 Aug 2023. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2023-41039 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- restrictedpython (PyPI): affected all versions; fixed in 5.4\n- restrictedpython (PyPI): affected from 6.0; fixed in 6.2, 5.4\n- restrictedpython (PyPI): affected from 6.0; fixed in 6.2\n- RestrictedPython (PyPI): affected all versions; fixed in 5.4\n- RestrictedPython (PyPI): affected from 6.0; fixed in 6.2\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2023-41039/ (Markdown: https://insights.sbomify.com/CVE-2023-41039/index.md)","id":"CVE-2023-41039","markdown":"https://insights.sbomify.com/CVE-2023-41039/index.md","name":"CVE-2023-41039","record":{"aliases":["DEBIAN-CVE-2023-41039","GHSA-xjw2-6jm9-rf67","PYSEC-2023-159","UBUNTU-CVE-2023-41039"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_read"],"network_reachable":"yes","non_default_config":false,"product_category":"Python sandbox library","requires_auth":"high_privilege","summary":"Attackers can escape the RestrictedPython sandbox to read sensitive objects via format string manipulation, requiring an upgrade to secure versions.","user_interaction":"required","vuln_class":"information_disclosure"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"restrictedpython","vendor":"zope"}],"cvss":{"score":8.3,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L","version":"3.1"},"cwes":[{"id":"CWE-74","name":"Improper Neutralization of Special Elements in Output Used by a Downstream Component"}],"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.","ecosystems":["PyPI"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Sandbox escape via various forms of \"format\" in RestrictedPython","id":"CVE-2023-41039","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"information_disclosure","year":"2023"},"n_packages":5,"n_references":2,"next":{"headline":"GitPython blind local file inclusion","id":"CVE-2023-41040"},"packages":[{"ecosystem":"PyPI","fixed":["5.4"],"introduced":["0"],"last_affected":[],"package":"RestrictedPython","purl":null,"source":"GHSA-xjw2-6jm9-rf67"},{"ecosystem":"PyPI","fixed":["6.2"],"introduced":["6.0"],"last_affected":[],"package":"RestrictedPython","purl":null,"source":"GHSA-xjw2-6jm9-rf67"},{"ecosystem":"PyPI","fixed":["5.4"],"introduced":["0"],"last_affected":[],"package":"restrictedpython","purl":"pkg:pypi/restrictedpython","source":"GHSA-xjw2-6jm9-rf67"},{"ecosystem":"PyPI","fixed":["6.2","5.4"],"introduced":["6.0","0"],"last_affected":[],"package":"restrictedpython","purl":"pkg:pypi/restrictedpython","source":"PYSEC-2023-159"},{"ecosystem":"PyPI","fixed":["6.2"],"introduced":["6.0"],"last_affected":[],"package":"restrictedpython","purl":"pkg:pypi/restrictedpython","source":"GHSA-xjw2-6jm9-rf67"}],"prev":{"headline":"Server crash when using specific form of SET BIND statement","id":"CVE-2023-41038"},"products":["RestrictedPython"],"published":"2023-08-30","related":[{"cvss_score":8.7,"headline":"RestrictedPython information leakage via `AttributeError.obj` and the `string` module","id":"CVE-2024-47532","kev_date_added":null,"published":"2024-09-30"},{"cvss_score":8.4,"headline":"RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape","id":"CVE-2023-37271","kev_date_added":null,"published":"2023-07-11"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-10-01","vendors":["zopefoundation"]},"summary":"Attackers can escape the RestrictedPython sandbox to read sensitive objects via format string manipulation, requiring an upgrade to secure versions.","url":"https://insights.sbomify.com/CVE-2023-41039/"}