# What is CVE-2023-37271?

> CVE-2023-37271 is a critical-severity flaw (CVSS 9.9) in Restrictedpython from Zope, published on 11 July 2023. It is not on the list of flaws known to be exploited today. The latest forecast puts its chance of use in the next 30 days at 0.8%. If you run an affected version, plan in the vendor’s fix.

Canonical page: https://www.precursorintelligence.com/what-is/cve-2023-37271

## At a glance

- **Verdict:** Fix this soon. Not confirmed as exploited yet, but serious or likely enough that it should not wait for a quiet month.
- **Precursor Intelligence risk score:** 55 out of 100 (Medium); action: Plan remediation. Kept up to date as the evidence changes.
- **Severity:** Critical (CVSS 9.9 out of 10)
- **Known to be exploited:** No, not on the list of flaws known to be exploited today
- **Chance of use in the next 30 days:** 0.8% (latest exploit-likelihood forecast)
- **Published:** 11 July 2023
- **Record last updated:** 19 July 2023
- **Main product:** Restrictedpython from Zope
- **Affected products:** 1

## What is CVE-2023-37271? In plain terms

It can be attacked from anywhere on the internet with an ordinary user account, and nobody has to click anything. If it works, the attacker can read data, change data and take it offline.

### The official 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.

### What kind of flaw is it?

- CWE-913: Improper Control of Dynamically-Managed Code Resources

### How an attack on it works

- Where an attacker can be: Anywhere on the internet
- How hard it is to pull off: Easy: no special conditions
- Login needed first: An ordinary user account
- Does someone have to click: No, nobody has to do anything
- What an attacker gets: Can read data, change data and take it offline

Severity vector: `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`

## Is CVE-2023-37271 being exploited? Not that we know of

It is not on the list of flaws known to be exploited today. The latest forecast puts the chance of it being used in the next 30 days at 0.8%. That can change at any time, which is why we keep watching.

Exploit likelihood over the last 7 days: 0.8%, 0.8%, 0.8%, 0.8%, 0.8%, 0.8%, 0.8%.

### Timeline

- 11 July 2023: Published
- 19 July 2023: Record last updated

### How Precursor Intelligence ranks it

CVE-2023-37271 scores **55 out of 100 (Medium)**, with the action "Plan remediation".

Every published flaw gets a risk score from 0 to 100, kept up to date as the evidence changes. Four things go into the score, from the one that counts most to the ones that count less:

- Evidence it is being exploited: biggest factor
- How severe it is: strong factor
- How widely exposed it is: smaller factor
- Threat activity around it: smaller factor

85 and above is Critical. Anything confirmed as exploited is always marked for an emergency patch, whatever its score. When this flaw matches software you track, it lands in your list with its score and the reasons behind it.

## Who is affected by CVE-2023-37271?

The published record lists 1 product. Versions are as published: "before 5.3" means every version up to, but not including, 5.3.

- [Restrictedpython](https://www.precursorintelligence.com/product/zope/restrictedpython) by [Zope](https://www.precursorintelligence.com/vendors/zope) (Application): before 5.3, 6.0-a1.dev0, 6.0

## How do I fix CVE-2023-37271?

1. **Check whether you run it.** Compare your versions with the affected products above. Not sure what you run? Precursor Intelligence can work it out from your public website, or you can pick it from a list.
2. **Apply the vendor’s fix.** Install the update named in the vendor’s advisory. We’ve put the advisories and patch notes first in the list.
3. **If you can’t patch today.** Follow any mitigation the vendor publishes, and limit who can reach the affected system from the internet until the update is in.
4. **Keep an eye on it.** Track the product and we tell you as soon as we spot this flaw on the list of exploited flaws, or a jump in its exploit likelihood.

### References

- [github.com](https://github.com/zopefoundation/RestrictedPython/commit/c8eca66ae49081f0016d2e1f094c3d72095ef531) (Patch)
- [github.com](https://github.com/zopefoundation/RestrictedPython/security/advisories/GHSA-wqc8-x2pr-7jqh) (Vendor advisory)

## Questions

### What is CVE-2023-37271?

CVE-2023-37271 is a critical-severity flaw in Restrictedpython from Zope, published on 11 July 2023. It can be attacked from anywhere on the internet with an ordinary user account, and nobody has to click anything. If it works, the attacker can read data, change data and take it offline.

### How serious is CVE-2023-37271?

It scores 9.9 out of 10 on the CVSS severity scale, which is critical. Our risk score for CVE-2023-37271 is 55 out of 100, which is Medium. Its action is "Plan remediation". Not confirmed as exploited yet, but serious or likely enough that it should not wait for a quiet month.

### Is CVE-2023-37271 being exploited?

It is not on the list of flaws known to be exploited today. The latest forecast puts the chance of it being used in the next 30 days at 0.8%. That can change at any time, which is why we keep watching.

### Which versions does CVE-2023-37271 affect?

For Restrictedpython from Zope: before 5.3, 6.0-a1.dev0, 6.0.

### How do I fix CVE-2023-37271?

Install the update the vendor names in its advisory, linked first under "How do I fix" on this page. If you can't patch today, follow the vendor's mitigation and limit who can reach the affected system from the internet.

## Does CVE-2023-37271 affect you?

Precursor Intelligence keeps checking for you:

- **Tell us what you run.** Pick your software from a list, or let us work it out from your website.
- **We match it to every flaw.** Over 400,000 published flaws, checked against your list.
- **Ranked by real-world risk.** Every flaw gets a 0 to 100 risk score, kept up to date, led by evidence criminals are using it.
- **Told as soon as we know.** An alert by email, in the app or by webhook to your own tools.

Start free (no card, nothing to install): https://www.precursorintelligence.com/register
Book a demo: https://www.precursorintelligence.com/contact

