# CVE-2023-41050: Information disclosure through Python's "format" functionality in Zope AccessControl

> Attackers can read sensitive object attributes via unsafe str.format_map usage in Zope AccessControl, leading to information disclosure.

- **Severity:** Medium 6.8 (`CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Sep 2023
- **Updated:** 26 Sep 2024
- **Also known as:** GHSA-8xv7-89vj-q48c, PYSEC-2026-2075, PYSEC-2026-2325

## What is CVE-2023-41050?

CVE-2023-41050 is a medium-severity vulnerability in zopefoundation AccessControl, published on 6 Sep 2023. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

AccessControl provides a general security framework for use in Zope. Python's "format" functionality allows someone controlling the format string to "read" objects accessible (recursively) via attribute access and subscription from accessible objects. Those attribute accesses and subscriptions use Python's full blown `getattr` and `getitem`, not the policy restricted `AccessControl` variants `_getattr_` and `_getitem_`. This can lead to critical information disclosure. `AccessControl` already provides a safe variant for `str.format` and denies access to `string.Formatter`. However, `str.format_map` is still unsafe. Affected are all users who allow untrusted users to create `AccessControl` controlled Python code and execute it. A fix has been introduced in versions 4.4, 5.8 and 6.2. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2023-41050?

12 open source packages ship an affected version, including accesscontrol, AccessControl and Zope. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `accesscontrol` | PyPI | All versions | 4.4, 5.8, 6.2 |
| `accesscontrol` | PyPI | All versions | 4.4 |
| `accesscontrol` | PyPI | From 5.0 | 5.8 |
| `accesscontrol` | PyPI | From 6.0 | 6.2 |
| `AccessControl` | PyPI | All versions | 4.4 |
| `AccessControl` | PyPI | From 5.0 | 5.8 |
| `AccessControl` | PyPI | From 6.0 | 6.2 |
| `Zope` | PyPI | All versions | 4.8.9 |
| `Zope` | PyPI | From 5.0.0 | 5.8.4 |
| `zope` | PyPI | All versions | 4.8.9, 5.8.4 |
| `zope` | PyPI | All versions | 4.8.9 |
| `zope` | PyPI | From 5.0.0 | 5.8.4 |

Products: Zope Accesscontrol, Zope Zope.

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

Upgrade accesscontrol to a fixed version for your release line: 4.4, 5.8 or 6.2.

## Is CVE-2023-41050 being exploited?

There is no known exploitation of CVE-2023-41050 in the wild and no public exploit code.

## Other vulnerabilities in zopefoundation AccessControl

- [CVE-2021-32811](https://insights.sbomify.com/CVE-2021-32811/): Remote Code Execution via Script (Python) objects under Python 3 (high 7.5)
- [CVE-2021-32807](https://insights.sbomify.com/CVE-2021-32807/): Remote Code Execution via unsafe classes in otherwise permitted modules (medium 4.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-41050 and fix it if it is affected.

What it is: CVE-2023-41050 is a medium-severity vulnerability in zopefoundation AccessControl, published on 6 Sep 2023. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-41050 in the wild and no public exploit code.

Affected packages and fixed versions:
- accesscontrol (PyPI): affected all versions; fixed in 4.4, 5.8, 6.2
- accesscontrol (PyPI): affected all versions; fixed in 4.4
- accesscontrol (PyPI): affected from 5.0; fixed in 5.8
- accesscontrol (PyPI): affected from 6.0; fixed in 6.2
- AccessControl (PyPI): affected all versions; fixed in 4.4
- AccessControl (PyPI): affected from 5.0; fixed in 5.8
- AccessControl (PyPI): affected from 6.0; fixed in 6.2
- Zope (PyPI): affected all versions; fixed in 4.8.9
- Zope (PyPI): affected from 5.0.0; fixed in 5.8.4
- zope (PyPI): affected all versions; fixed in 4.8.9, 5.8.4
- zope (PyPI): affected all versions; fixed in 4.8.9
- zope (PyPI): affected from 5.0.0; fixed in 5.8.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-41050/ (Markdown: https://insights.sbomify.com/CVE-2023-41050/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-41050
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-41050
- OSV: https://osv.dev/vulnerability/CVE-2023-41050

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-41050/
Summaries are generated and may contain mistakes; the official description above is the record.
