CVE-2021-32807
Remote Code Execution via unsafe classes in otherwise permitted modules
Also known as GHSA-qcx9-j53g-ccgf, PYSEC-2021-335, PYSEC-2021-875
Mitigation
- Upgrade accesscontrol to one of 4.3, 5.2 (or later in the same release line).
- Upgrade zope to one of 4.3, 5.2 (or later in the same release line).
Who should check
- Projects that depend on PyPI package accesscontrol (>= 4.0, < 4.3)
- Projects that depend on PyPI package zope (>= 4.0, < 4.3)
- Anyone running zopefoundation AccessControl >= 4.0, < 4.3; >= 5.0, < 5.2
Vulnerability facts
- Affected
- accesscontrol >= 4.0, < 4.3; zope >= 4.0, < 4.3
- Fixed in
- 4.3, 5.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, login needed
- CVSS
- 4.4 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:H/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: High
- Privileges required: High
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: None
- Integrity impact: High
- Availability impact: None
- EPSS
- 2.11% chance of exploitation in 30 days (percentile 82, 2026-11-26)
- CWE
- CWE-915
- Modified
Description
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI accesscontrol | >= 4.0, < 4.3 | 4.3, 5.2 | osv |
| PyPI zope | >= 4.0, < 4.3 | 4.3, 5.2 | osv |
| zopefoundation AccessControl | >= 4.0, < 4.3; >= 5.0, < 5.2 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2021-32807. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2021-32807.md Affected: accesscontrol >= 4.0, < 4.3; zope >= 4.0, < 4.3 Fixed in: 4.3, 5.2 Steps: 1. Search this machine and project for accesscontrol (PyPI), zope (PyPI), zopefoundation AccessControl: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
- https://github.com/zopefoundation/AccessControl/commit/b42dd4badf803bb9fb71ac34cd9cb0c249262f2c
- https://github.com/zopefoundation/AccessControl/commit/ae2dab0cc34e6dd1561c5b12d4a56cd140f87e1d
- https://github.com/zopefoundation/Zope/commit/869f947e586517566509e0ccdd4d99b60704cc02
- https://github.com/zopefoundation/Zope/commit/f72a18dda8e9bf2aedb46168761668464a4be988
Other
- https://github.com/zopefoundation/AccessControl/blob/master/CHANGES.rst#51-2021-07-30
- https://github.com/pypa/advisory-database/tree/main/vulns/accesscontrol/PYSEC-2021-335.yaml
- https://github.com/pypa/advisory-database/tree/main/vulns/accesscontrol/PYSEC-2021-370.yaml
- https://github.com/pypa/advisory-database/tree/main/vulns/zope/PYSEC-2021-368.yaml
- https://github.com/pypa/advisory-database/tree/main/vulns/zope/PYSEC-2021-875.yaml
- https://github.com/zopefoundation/AccessControl
FAQ
Is CVE-2021-32807 being exploited?
There is no confirmed exploitation: CVE-2021-32807 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 2.11% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2021-32807?
Medium: CVSS 4.4 (v3.1, scored by CNA). Remote, login needed. The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2021-32807?
accesscontrol >= 4.0, < 4.3; zope >= 4.0, < 4.3.
Is there a fix for CVE-2021-32807?
Yes. Fixed in 4.3, 5.2. Upgrade accesscontrol to one of 4.3, 5.2 (or later in the same release line). Upgrade zope to one of 4.3, 5.2 (or later in the same release line).
How do I check if I'm affected by CVE-2021-32807?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.