CVE-2026-12345
Medium 5.9No known exploitationFix availableRace condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
Record last updated
CVSS score
Medium on a 0 to 10 scale
EPSS, chance of exploitation in 30 days
Higher than 29% of scored CVEs. A prediction, not evidence.
CISA remediation deadline
Not in the KEV catalog
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.
Weakness: CWE-59
Patching and mitigation
- Patch status
- Fix available (source: Microsoft MSRC)
- Fix documented (source date)
- Mitigation
- None documented
- Vendor guidance
- msrc.microsoft.com (opens in a new tab)
Affected products
| Vendor | Product | Affected versions | Fixed in | Per |
|---|---|---|---|---|
| Microsoft | azl3 python3 3.12.14-2 on Azure Linux 3.0 | Not documented | 3.12.16-1 | Microsoft MSRC |
| Python Software Foundation | CPython | from 3.13.0 before 3.13.18 | 3.13.18 | CVE Program |
| Python Software Foundation | CPython | from 3.14.0 before 3.14.9 | 3.14.9 | CVE Program |
| Python Software Foundation | CPython | from 3.15.0a1 before 3.15.0rc3 | 3.15.0rc3 | CVE Program |
| Python Software Foundation | CPython | all versions before 3.12.15 | 3.12.15 | CVE Program |
Timeline
Disclosure
CVE record published by PSF
Source: CVE Program (opens in a new tab)
Advisory
Microsoft advisory published
Advisory change
Microsoft advisory revised (2.0): Information published.
Advisory change
Microsoft advisory revised (3.0): Information published.
Advisory change
Microsoft advisory revised (4.0): Information published.
Advisory change
Microsoft advisory revised (5.0): Information published.
Advisory change
Microsoft advisory revised (6.0): Information published.
Patch
Fix documented by Microsoft MSRC
Vendor guidance and references
- https://github.com/python/cpython/commit/0478b52788117db4b831b3efd648f56b777628aa (opens in a new tab)patch
- https://github.com/python/cpython/commit/06ef3d43fdaf4da97af12fa694b4886092c4b970 (opens in a new tab)patch
- https://github.com/python/cpython/commit/458e7134a5af7f86aee9d21b51cf499b41aa4420 (opens in a new tab)patch
- https://github.com/python/cpython/commit/58ed0259cae509a19138795df302fe60b544dc74 (opens in a new tab)patch
- https://github.com/python/cpython/commit/5c20517a4fc56683efe63a7751020db9573f538d (opens in a new tab)patch
- https://github.com/python/cpython/commit/aa17c688d2c160969f2c8963f4454cdd139808e7 (opens in a new tab)patch
- https://github.com/python/cpython/commit/c39b52d00b42200aaadff679e2fe3f1006d57c58 (opens in a new tab)patch
- https://github.com/python/cpython/commit/e1f3590f155c6d66007e958c98c9d69316551993 (opens in a new tab)patch
- https://github.com/python/cpython/pull/157580 (opens in a new tab)patch
- Microsoft Security Update Guide (opens in a new tab)vendor-advisory
- http://www.openwall.com/lists/oss-security/2026/09/29/40 (opens in a new tab)
- https://github.com/python/cpython/issues/157579 (opens in a new tab)issue-tracking