9.9

CVE-2023-37271: RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape

Modified
AliasesGHSA-wqc8-x2pr-7jqhPYSEC-2023-118UBUNTU-CVE-2023-37271
Published 11-07-2023Last modified 07-11-2024

Vulnerability summary

CVE-2023-37271 is a critical (CVSS 9.9) vulnerability in zope restrictedpython. EPSS estimates a 0.85% chance of exploitation in the next 30 days, higher than 58.1% of scored vulnerabilities.

Priority
Routine

Not severe (CVSS 8.4, network access); no exploitation reported by the 5 checked sources

Source freshness unavailable

How is this decided?
CVSS score
9.9/10
010
Critical · v3.1 (NVD)
EPSS score
0.85%
0%100%
Low · 0.00 pp in 30 days
KEVNot listedNot listed by any tracked catalog.
RansomwareNot flaggedNo ransomware use recorded.
Public exploits0No public exploits recorded

Advisory lineage

Upstream 0 · Downstream 1 · Related 1

Timeline

  1. 11-07-2023
    PublishedVulnerability first disclosed.
  2. 07-11-2024
    Last modifiedVulnerability information updated.

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 metrics

5 scores · 5 sources · 1 version

EPSS trend

Probability

0.85%

Chance of exploitation in the next 30 days

Percentile

58%

Versus all other CVEs

30-day change

No change 0.00 pp

From 0.85% on 04-10-2026

04-10-202603-11-2026

Known exploited

Compare KEV catalogs
CISA KEV

Not in the CISA KEV catalog.

ENISA CNW

Not in the ENISA CNW catalog.

CIRCL

Not in the CIRCL catalog.

Public exploits

0 found

No public exploits indexed.

Weaknesses

CWE · root cause

Affected systems

Version check

Known conditions: network-reachable, low-privilege account, no user interaction (CVSS vector). Other conditions: not stated in public data.

Debian1 product
  • restrictedpythonAll versions (No fix recorded) | < 6.2-1
PyPI1 product
  • restrictedpython≥ 6.0a1.dev0, < 6.1 | < c8eca66ae49081f0016d2e1f094c3d72095ef531 | < 5.3
Ubuntu1 product
  • restrictedpython< 4.0~b3-2ubuntu0.1~esm1 | < 4.0~b3-3ubuntu0.1~esm1
Zope1 product
Zopefoundation1 product

5 vendors · 5 products

References

9 links