CVE-2026-12345
5.9medium
Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
- Severity
- 5.9medium CVSS:4.0 by PSF
- Exploit likelihood
- 0.36% (higher than 31% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- PSF
- Also known as
- PSF-2026-42BIT-LIBPYTHON-2026-12345BIT-PYTHON-2026-12345BIT-PYTHON-MIN-2026-12345
Description
The cleanup of tempfile.TemporaryDirectory is vulnerable to a race condition. An attacker who can modify the tree during cleanup can replace a directory with a symbolic link, causing files outside of the temporary directory to be deleted or have their permissions and file flags reset, with the privileges of the process performing the cleanup. Note that platforms where shutil.rmtree.avoids_symlink_attacks is false, remain affected, and file flags may still be reset outside of the tree on all platforms.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Python Software Foundation CPython | before 3.12.15, from 3.13.0 before 3.13.18, from 3.14.0 before 3.14.9, from 3.15.0a1 before 3.15.0rc3 | CVE List |
| https://github.com/python/cpython | before 5c20517a4fc56683efe63a7751020db9573f538d, before 458e7134a5af7f86aee9d21b51cf499b41aa4420, before e1f3590f155c6d66007e958c98c9d69316551993, before 06ef3d43fdaf4da97af12fa694b4886092c4b970, before 58ed0259cae509a19138795df302fe60b544dc74, before 0478b52788117db4b831b3efd648f56b777628aa, before c39b52d00b42200aaadff679e2fe3f1006d57c58 | Python Software Foundation |
| libpython (Bitnami) | before 3.12.16, from 3.13.0 before 3.13.18, from 3.14.0 before 3.14.9 | Bitnami Vulnerability Database |
| python (Bitnami) | before 3.12.16, from 3.13.0 before 3.13.18, from 3.14.0 before 3.14.9 | Bitnami Vulnerability Database |
| python-min (Bitnami) | before 3.12.16, from 3.13.0 before 3.13.18, from 3.14.0 before 3.14.9 | Bitnami Vulnerability Database |
All scores
| PSF | 5.9medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N |
| Bitnami Vulnerability Database | medium rating |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-12345 changed 2026-12-01 | CVE Terms of Use |
| Python Software Foundation | PSF-2026-42 changed 2026-10-26 | CC-BY-4.0 |
| NVD | CVE-2026-12345 changed 2026-11-19 | Public domain |
| Bitnami Vulnerability Database | BIT-LIBPYTHON-2026-12345 changed 2026-11-27 | Apache-2.0 |
| Bitnami Vulnerability Database | BIT-PYTHON-2026-12345 changed 2026-11-27 | Apache-2.0 |
| Bitnami Vulnerability Database | BIT-PYTHON-MIN-2026-12345 changed 2026-11-27 | Apache-2.0 |