Code executionin zopefoundation RestrictedPython.
No public exploit found; not on exploited lists.
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.
- Upgrade RestrictedPython to 5.3, 6.1 or later, whichever matches your release line.
- Upgrade RestrictedPython (PyPI) to 5.3, 6.1 or later, whichever matches your release line.
- Upgrade restrictedpython (PyPI) to 5.3 or later.
Affected and fixed versions
From the CVE record, NVD and package advisories. When no source has versions yet, this table says "not confirmed" instead of guessing.
From first report to first attacks
- 29 Jun 2023CVE ID reserved by GitHub_M.
- 11 Jul 2023Published in the CVE List.
- 7 Nov 2024CVE record last updated.
Attack code anyone can find
Exploit maturity: No public exploit found. CISA assessment (SSVC): exploitation none.
Listed so defenders can judge how urgent this is and test systems they are authorised to test. Patchminder does not host exploit code; links open the source page. Labels for GitHub repositories come from their public details and are never a promise about the code. Run anything only in an isolated lab.
Report a link
Nothing on this page links to exploit code right now. To report anything else, write to the contact point in the legal notice.
Other RestrictedPython vulnerabilities
Same weakness: Improper control of dynamic code resources
- github.com x_refsource_CONFIRM
- github.com x_refsource_MISC
Patchminder. CVE-2023-37271: Code execution in zopefoundation RestrictedPython. https://patchminder.com/cve/cve-2023-37271/ (accessed 5 December 2026).