Vulnerability · Published Sep 29, 2026 · Assigned by PSF
CVE-2026-12345Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
Medium 5.9
In plain English
A medium-severity security flaw in CPython from Python Software Foundation. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 28% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:8 | platform-python | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:8 | platform-python-debug | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:8 | platform-python-devel | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:9 | python-unversioned-command | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:9 | python3 | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:9 | python3-debug | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:9 | python3-devel | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:8 | python3-idle | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:9 | python3-idle | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:8 | python3-libs | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:9 | python3-libs | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:8 | python3-test | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:9 | python3-test | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| AlmaLinux:8 | python3-tkinter | 3.6.8-79.el8_10.alma.1 | ALSA-2026:85239 |
| AlmaLinux:9 | python3-tkinter | 3.9.25-7.el9_8.6 | ALSA-2026:89742 |
| Alpine:v3.21 | python3 | 3.12.16-r0 | ALPINE-CVE-2026-12345 |
| Alpine:v3.22 | python3 | 3.12.16-r0 | ALPINE-CVE-2026-12345 |
| Alpine:v3.23 | python3 | 3.12.16-r0 | ALPINE-CVE-2026-12345 |
| Alpine:v3.24 | python3 | 3.14.10-r0 | ALPINE-CVE-2026-12345 |
| Debian:12 | pypy3 | no fix listed | DEBIAN-CVE-2026-12345 |
| Debian:13 | pypy3 | no fix listed | DEBIAN-CVE-2026-12345 |
| Debian:14 | pypy3 | no fix listed | DEBIAN-CVE-2026-12345 |
| Debian:12 | python3.11 | no fix listed | DEBIAN-CVE-2026-12345 |
| Debian:13 | python3.13 | no fix listed | DEBIAN-CVE-2026-12345 |
| Debian:14 | python3.14 | 3.14.9-1 | DEBIAN-CVE-2026-12345 |
| Debian:14 | python3.15 | 3.15.0~rc3-1 | DEBIAN-CVE-2026-12345 |
| Rocky Linux:8 | python3 | 0:3.6.8-79.el8_10.rocky.0 | RLSA-2026:85239 |
| Rocky Linux:9 | python3.9 | 0:3.9.25-7.el9_8.6 | RLSA-2026:89742 |
| Ubuntu:22.04:LTS | python3.10 | no fix listed | UBUNTU-CVE-2026-12345 |
| Ubuntu:24.04:LTS | python3.12 | no fix listed | UBUNTU-CVE-2026-12345 |
| Ubuntu:26.04:LTS | python3.14 | no fix listed | UBUNTU-CVE-2026-12345 |
| Ubuntu:26.10 | python3.14 | no fix listed | UBUNTU-CVE-2026-12345 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Python Software Foundation | CPython | 0 – before 3.12.153.13.0 – before 3.13.183.14.0 – before 3.14.93.15.0a1 – before 3.15.0rc3 |
Weakness: CWE-59 · Vector: 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
References
- https://github.com/python/cpython/pull/157580 patch
- https://github.com/python/cpython/issues/157579 issue-tracking
- https://github.com/python/cpython/commit/5c20517a4fc56683efe63a7751020db9573f538d patch
- https://github.com/python/cpython/commit/458e7134a5af7f86aee9d21b51cf499b41aa4420 patch
- https://github.com/python/cpython/commit/e1f3590f155c6d66007e958c98c9d69316551993 patch
- https://github.com/python/cpython/commit/06ef3d43fdaf4da97af12fa694b4886092c4b970 patch
- https://github.com/python/cpython/commit/58ed0259cae509a19138795df302fe60b544dc74 patch
- https://github.com/python/cpython/commit/0478b52788117db4b831b3efd648f56b777628aa patch
- https://github.com/python/cpython/commit/c39b52d00b42200aaadff679e2fe3f1006d57c58 patch
- http://www.openwall.com/lists/oss-security/2026/09/29/40