{"cve":"CVE-2023-37271","nvd":{"published":"2023-07-11T18:15:20.787","modified":"2026-06-17T06:07:51.617","status":"Modified","description":"RestrictedPython is a tool that helps to define a subset of the Python language which allows users to provide a program input into a trusted environment. RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. Prior to versions 6.1 and 5.3, an attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted sandbox and potentially allowing arbitrary code execution in the Python interpreter. All RestrictedPython deployments that allow untrusted users to write Python code in the RestrictedPython environment are at risk. In terms of Zope and Plone, this would mean deployments where the administrator allows untrusted users to create and/or edit objects of type `Script (Python)`, `DTML Method`, `DTML Document` or `Zope Page Template`. This is a non-default configuration and likely to be extremely rare. The problem has been fixed in versions 6.1 and 5.3.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","score":9.9},"cwes":["CWE-913"],"references":["https://github.com/zopefoundation/RestrictedPython/commit/c8eca66ae49081f0016d2e1f094c3d72095ef531","https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-wqc8-x2pr-7jqh","https://github.com/zopefoundation/RestrictedPython/commit/c8eca66ae49081f0016d2e1f094c3d72095ef531","https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-wqc8-x2pr-7jqh"],"products":["zope:restrictedpython"],"source":"nvd","synced_at":"2026-10-19T21:38:30.124994567+00:00"},"epss":{"cve":"CVE-2023-37271","score":0.00847,"percentile":0.581,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-wqc8-x2pr-7jqh","url":"https://osv.dev/vulnerability/GHSA-wqc8-x2pr-7jqh","summary":"RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape","modified":"2026-09-10T03:49:57.340113468Z","packages":[{"ecosystem":"PyPI","name":"restrictedpython","purl":"pkg:pypi/restrictedpython","ranges":["<5.3"],"fixed":["5.3"]},{"ecosystem":"PyPI","name":"restrictedpython","purl":"pkg:pypi/restrictedpython","ranges":[">=6.0a1.dev0 <6.1"],"fixed":["6.1"]},{"ecosystem":"PyPI","name":"restrictedpython","purl":"pkg:pypi/restrictedpython","ranges":["<5.3"],"fixed":["5.3"]}]},{"id":"PYSEC-2023-118","url":"https://osv.dev/vulnerability/PYSEC-2023-118","summary":"","modified":"2023-11-08T04:13:00.793569Z","packages":[{"ecosystem":"PyPI","name":"restrictedpython","purl":"pkg:pypi/restrictedpython","ranges":["<5.3"],"fixed":["5.3"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}