Skip to content
Heist/ feed
Back to feed
CriticalFix available

restrictedpython — security advisory

Type: advisorySources: OSVAdvisory ID: DEBIAN-CVE-2023-37271

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.

Products
restrictedpython
Affected versions
4.0~b3-3, 6.2-1, 8.0-1, 8.1-1, 8.4-1
Fixed versions
6.2-1
CVEs
CVE-2023-37271
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 16:23 UTC · Revision 1

Source evidence

DEBIAN-CVE-2023-37271

core-osv · Original source

Published 11 Jul 2023, 18:15 UTC

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.

osv:DEBIAN-CVE-2023-37271

restrictedpython

Fixed versions: Not specified

restrictedpython

Fixed versions: 6.2-1

restrictedpython

Fixed versions: 6.2-1

Complete source record
{
  "id": "e05b670df732708625cd1692ae8f34bba65a7fa1dfe18cb2244a13f2f258c6bc",
  "url": "https://osv.dev/vulnerability/DEBIAN-CVE-2023-37271",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "DEBIAN-CVE-2023-37271",
    "summary": "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.",
    "evidence": "osv:DEBIAN-CVE-2023-37271",
    "products": [
      {
        "name": {
          "value": "restrictedpython",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "4.0~b3-3",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "6.2-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "8.0-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "8.1-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "8.4-1",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "restrictedpython",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "6.2-1",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      },
      {
        "name": {
          "value": "restrictedpython",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "6.2-1",
            "evidence": "/affected/2/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "critical",
    "structured": {
      "id": "DEBIAN-CVE-2023-37271",
      "aliases": [
        "DEBIAN-CVE-2023-37271"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "restrictedpython",
            "purl": "pkg:deb/debian/restrictedpython?arch=source&distro=bookworm",
            "ecosystem": "Debian:12"
          },
          "versions": [
            "4.0~b3-3",
            "6.2-1",
            "8.0-1",
            "8.1-1",
            "8.4-1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-37271.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "6.2-1"
                }
              ]
            }
          ],
          "package": {
            "name": "restrictedpython",
            "purl": "pkg:deb/debian/restrictedpython?arch=source&distro=trixie",
            "ecosystem": "Debian:13"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-37271.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "6.2-1"
                }
              ]
            }
          ],
          "package": {
            "name": "restrictedpython",
            "purl": "pkg:deb/debian/restrictedpython?arch=source&distro=forky",
            "ecosystem": "Debian:14"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-37271.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        }
      ],
      "modified": "2026-10-26T18:03:05.581000232Z",
      "provider": "osv",
      "upstream": [
        "CVE-2023-37271"
      ],
      "references": [
        "https://security-tracker.debian.org/tracker/CVE-2023-37271"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2023-37271",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 457604,
  "published_at": "2023-07-11T18:15:20.787+00:00"
}