# CVE-2023-33595: Use after free in n/a

> A heap use-after-free in CPython's ascii_decode function allows attackers to potentially execute arbitrary code or cause a denial of service.

- **Severity:** Medium 5.5 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 7 Jun 2023
- **Updated:** 2 Aug 2024
- **Also known as:** BIT-libpython-2023-33595, BIT-python-2023-33595, BIT-python-min-2023-33595, GHSA-pqc2-g93j-9599, PSF-2023-3

## What is CVE-2023-33595?

CVE-2023-33595 is a medium-severity use after free vulnerability in Python Python, published on 7 Jun 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

CPython v3.12.0 alpha 7 was discovered to contain a heap use-after-free via the function ascii_decode at /Objects/unicodeobject.c.

Weakness: CWE-416 (Use After Free)

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

3 open source packages ship an affected version, including libpython, python and python-min. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libpython` | Bitnami | From 3.12.0-alpha0 | 3.12.0-alpha8 |
| `python` | Bitnami | From 3.12.0-alpha0 | 3.12.0-alpha8 |
| `python-min` | Bitnami | From 3.12.0-alpha0 | 3.12.0-alpha8 |

Products: Python Python.

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

Upgrade libpython to 3.12.0-alpha8 or later.

## Is CVE-2023-33595 being exploited?

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

## Other vulnerabilities in Python Python

- [CVE-2008-5031](https://insights.sbomify.com/CVE-2008-5031/): Integer overflow in n/a (critical 10.0)
- [CVE-2014-4650](https://insights.sbomify.com/CVE-2014-4650/): Path traversal in n/a (critical 9.8)
- [CVE-2016-5636](https://insights.sbomify.com/CVE-2016-5636/): Integer overflow in n/a (critical 9.8)
- [CVE-2007-4559](https://insights.sbomify.com/CVE-2007-4559/): Path traversal in n/a (critical 9.8)
- [CVE-2017-17522](https://insights.sbomify.com/CVE-2017-17522/): Command injection in n/a (high 8.8)

## Fix prompt for AI coding agents

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

What it is: CVE-2023-33595 is a medium-severity use after free vulnerability in Python Python, published on 7 Jun 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2023-33595 in the wild and no public exploit code.

Affected packages and fixed versions:
- libpython (Bitnami): affected from 3.12.0-alpha0; fixed in 3.12.0-alpha8
- python (Bitnami): affected from 3.12.0-alpha0; fixed in 3.12.0-alpha8
- python-min (Bitnami): affected from 3.12.0-alpha0; fixed in 3.12.0-alpha8

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-33595/ (Markdown: https://insights.sbomify.com/CVE-2023-33595/index.md)
```

## Sources

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

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