{"id":"CVE-2021-32807","published":"2021-07-30T21:20:11Z","modified":"2024-08-03T23:33:55Z","title":"Remote Code Execution via unsafe classes in otherwise permitted modules","vendor":"zopefoundation","product":"AccessControl","tier":"tail","description":{"text":"The module `AccessControl` defines security policies for Python code used in restricted code within Zope applications. Restricted code is any code that resides in Zope's object database, such as the contents of `Script (Python)` objects. The policies defined in `AccessControl` severely restrict access to Python modules and only exempt a few that are deemed safe, such as Python's `string` module. However, full access to the `string` module also allows access to the class `Formatter`, which can be overridden and extended within `Script (Python)` in a way that provides access to other unsafe Python libraries. Those unsafe Python libraries can be used for remote code execution. By default, you need to have the admin-level Zope \"Manager\" role to add or edit `Script (Python)` objects through the web. Only sites that allow untrusted users to add/edit these scripts through the web - which would be a very unusual configuration to begin with - are at risk. The problem has been fixed in AccessControl 4.3 and 5.2. Only AccessControl versions 4 and 5 are vulnerable, and only on Python 3, not Python 2.7. As a workaround, a site administrator can restrict adding/editing `Script (Python)` objects through the web using the standard Zope user/role permission mechanisms. Untrusted users should not be assigned the Zope Manager role and adding/editing these scripts through the web should be restricted to trusted users only. This is the default configuration in Zope.","provenance":"source","from":"CVE.org"},"cvss":{"score":4.4,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.02107,"percentile":0.82209,"provenance":"source"},"cwes":[{"id":"CWE-915","name":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"}],"references":[{"url":"https://github.com/zopefoundation/AccessControl/security/advisories/GHSA-qcx9-j53g-ccgf","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/zopefoundation/AccessControl/commit/b42dd4badf803bb9fb71ac34cd9cb0c249262f2c","tags":["x_refsource_MISC"]},{"url":"https://github.com/zopefoundation/AccessControl/blob/master/CHANGES.rst#51-2021-07-30","tags":["x_refsource_MISC"]}],"priority":{"score":19.5,"factors":[{"name":"EPSS percentile","points":16.44},{"name":"CVSS severity","points":3.08}]},"vendorSlug":"zopefoundation","affectedVersions":[{"vendor":"zopefoundation","product":"AccessControl","versions":[">= 4.0, < 4.3",">= 5.0, < 5.2"]}],"affected":[{"ecosystem":"PyPI","package":"AccessControl","vulnerableRanges":[">=4.0, <4.3",">=5.0, <5.2"],"patched":["4.3","5.2"],"from":["GHSA-qcx9-j53g-ccgf","PYSEC-2021-335"],"provenance":"source"},{"ecosystem":"PyPI","package":"zope","vulnerableRanges":[">=4.0, <4.3",">=5.0, <5.2"],"patched":["4.3","5.2"],"from":["GHSA-qcx9-j53g-ccgf","PYSEC-2021-875"],"provenance":"source"}],"summary":{"text":"A flaw in the AccessControl module of zopefoundation's Zope framework lets Python code running in restricted contexts, such as Script (Python) objects, reach unsafe libraries because the otherwise-permitted string module exposes the overridable Formatter class. An attacker who can add or edit Script (Python) objects through the web, which by default requires the admin-level Zope \"Manager\" role and is an unusual configuration, could use this to execute code on the server; the affected versions are AccessControl 4 and 5 on Python 3 only.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T20:34:26Z"},"euvd":{"id":"EUVD-2021-0001","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-zopefoundation-accesscontrol-cve-2021-32807","children":[{"from":"CVE-2021-32807","to":"CVE-2021-32811","relation":"related","confidence":"high","kind":"lineage","evidence":[{"kind":"osv-related","provenance":"source","id":"GHSA-qcx9-j53g-ccgf","via":"related"},{"kind":"osv-related","provenance":"source","id":"GHSA-g4gq-j4p2-j8fr","via":"reference","url":"https://github.com/zopefoundation/AccessControl/security/advisories/GHSA-qcx9-j53g-ccgf"},{"kind":"osv-related","provenance":"source","id":"GHSA-qcx9-j53g-ccgf","via":"reference","url":"https://github.com/zopefoundation/Zope/security/advisories/GHSA-g4gq-j4p2-j8fr"}]}]}}