Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
Summary
| CVE | CVE-2026-12345 |
|---|---|
| State | PUBLISHED |
| Assigner | PSF |
| Source Priority | CVE Program / NVD first with legacy fallback |
| Published | 2026-09-29 18:17:14 UTC |
| Updated | 2026-10-26 01:17:15 UTC |
| 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. |
Risk And Classification
Primary CVSS: v4.0 5.9 MEDIUM from [email protected]
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
EPSS: 0.001800000 probability, percentile 0.069470000 (date 2026-10-11)
Problem Types: CWE-59 | CWE-59 CWE-59 Improper Link Resolution Before File Access ('Link Following')
| Version | Source | Type | Score | Severity | Vector |
|---|---|---|---|---|---|
| 4.0 | [email protected] | Secondary | 5.9 | MEDIUM | 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/E:X/C... |
| 4.0 | CNA | CVSS | 5.9 | MEDIUM | 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 |
CVSS v4.0 Breakdown
Attack Vector
LocalAttack Complexity
LowAttack Requirements
PresentPrivileges Required
NoneUser Interaction
NoneConfidentiality
NoneIntegrity
HighAvailability
HighSub Conf.
NoneSub Integrity
NoneSub Availability
NoneCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Vendor Declared Affected Products
| Source | Vendor | Product | Version | Platforms |
|---|---|---|---|---|
| CNA | Python Software Foundation | CPython | affected 3.12.15 python | Not specified |
| CNA | Python Software Foundation | CPython | affected 3.13.0 3.13.18 python | Not specified |
| CNA | Python Software Foundation | CPython | affected 3.14.0 3.14.9 python | Not specified |
| CNA | Python Software Foundation | CPython | affected 3.15.0a1 3.15.0rc3 python | Not specified |
References
| Reference | Source | Link | Tags |
|---|---|---|---|
| github.com/python/cpython/commit/c39b52d00b42200aaadff679e2fe3f1006d57c58 | [email protected] | github.com | |
| github.com/python/cpython/commit/5c20517a4fc56683efe63a7751020db9573f538d | [email protected] | github.com | |
| github.com/python/cpython/commit/06ef3d43fdaf4da97af12fa694b4886092c4b970 | [email protected] | github.com | |
| github.com/python/cpython/commit/458e7134a5af7f86aee9d21b51cf499b41aa4420 | [email protected] | github.com | |
| github.com/python/cpython/commit/58ed0259cae509a19138795df302fe60b544dc74 | [email protected] | github.com | |
| github.com/python/cpython/pull/157580 | [email protected] | github.com | |
| github.com/python/cpython/commit/0478b52788117db4b831b3efd648f56b777628aa | [email protected] | github.com | |
| github.com/python/cpython/issues/157579 | [email protected] | github.com | |
| github.com/python/cpython/commit/e1f3590f155c6d66007e958c98c9d69316551993 | [email protected] | github.com | |
| www.openwall.com/lists/oss-security/2026/09/29/40 | af854a3a-2127-422b-91ae-364da2661108 | www.openwall.com | |
| CVE Program record | CVE.ORG | www.cve.org | canonical |
| NVD vulnerability detail | NVD | nvd.nist.gov | canonical, analysis |
Vendor Comments And Credit
Discovery Credit
CNA: Bitshift (https://github.com/TheShiftedBit) (en)
CNA: Stan Ulbrych (https://github.com/StanFromIreland) (en)
CNA: Petr Viktorin (https://github.com/encukou) (en)
There are currently no legacy QID mappings associated with this CVE.