Medium severity · published Sep 29, 2026
CVE-2026-12345
Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
5.9
CVSS
0.3%
EPSS
No
On KEV
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.
Exploitation
Is it being used?
Exploit prediction (EPSS)0.3% · higher than 28% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
CP
CPython · Python Software Foundation
before 3.12.15; 3.13.0 before 3.13.18; 3.14.0 before 3.14.9; 3.15.0a1 before 3.15.0rc3 · source: vendor
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-12345
CVE.org
https://www.cve.org/CVERecord?id=CVE-2026-12345
patch
https://github.com/python/cpython/pull/157580
issue-tracking
https://github.com/python/cpython/issues/157579
patch
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
More from CPython
9.4
CVE-2026-115557
Distrust compromised intermediate certificates in ssl module
9.2
CVE-2026-19445
Use-after-free of a server-side SSLContext when sni_callback switches contexts
8.8
CVE-2026-3298
Out-of-bounds write in Windows asyncio.ProacterEventLoop.sock_recvfrom_into() when using nbytes
8.4
CVE-2026-82049
tarfile extraction filters allow file modification and content disclosure via hard link to symlink
8.2
CVE-2026-11972
tarfile opened in streaming mode mishandles EOF
