Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- Present
- Impact type
- —
- Confidentiality · integrity · availability
- None · High · High
- Fix status
- Partial Red Hat: 7 fixed, 10 without a fix
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and Red Hat.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| Python Software Foundation | CPython | before 3.12.15; 3.13.0 to before 3.13.18; 3.14.0 to before 3.14.9; 3.15.0a1 to before 3.15.0rc3 | 3.12.15, 3.13.18, 3.14.9, 3.15.0rc3 | Patch available | CNA |
- CPython VendorPython Software Foundation Affected before 3.12.15; 3.13.0 to before 3.13.18; 3.14.0 to before 3.14.9; 3.15.0a1 to before 3.15.0rc3 Fixed in 3.12.15, 3.13.18, 3.14.9, 3.15.0rc3 Patch available CNA
CPE names Threatist (inferred) · 1
Inferred from how NVD named this product before; not given by a source.
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:python:python:*:*:*:*:*:*:*:* | — | — | python-pillow |
- cpe:2.3:a:python:python:*:*:*:*:*:*:*:* Versions — — ·python-pillow
Remediation
- Fix · CNA CPython (Python Software Foundation) Fixed in 3.12.15, 3.13.18, 3.14.9, 3.15.0rc3
Red Hat 6 advisories
- RHSA-2026:94802 Released 2026-11-04 · Red Hat rating CriticalA Subscription Management tool for finding and reporting Red Hat product usage
- Red Hat Discovery 2 registry.redhat.io/discovery/discovery-server-rhel9, registry.redhat.io/discovery/discovery-ui-rhel9
- RHSA-2026:89742 Released 2026-10-26 · Red Hat rating Importantpython3.9 security update
- Red Hat Enterprise Linux AppStream (v. 9) python-unversioned-command-3.9.25-7.el9_8.6, python3-devel-3.9.25-7.el9_8.6, python3-tkinter-3.9.25-7.el9_8.6
- Red Hat Enterprise Linux BaseOS (v. 9) python3-3.9.25-7.el9_8.6, python3-libs-3.9.25-7.el9_8.6, python3.9-3.9.25-7.el9_8.6
- Red Hat Enterprise Linux CodeReady Linux Builder (v. 9) python3-3.9.25-7.el9_8.6, python3-debug-3.9.25-7.el9_8.6, python3-idle-3.9.25-7.el9_8.6 +2
- RHSA-2026:85239 Released 2026-10-19 · Red Hat rating Importantpython3 security update
- Red Hat Enterprise Linux AppStream (v. 8) platform-python-3.6.8-79.el8_10, platform-python-debug-3.6.8-79.el8_10, platform-python-devel-3.6.8-79.el8_10 +3
- Red Hat Enterprise Linux BaseOS (v. 8) platform-python-3.6.8-79.el8_10, python3-3.6.8-79.el8_10, python3-libs-3.6.8-79.el8_10 +1
Show 3 more Red Hat advisories
- RHSA-2026:75119 Released 2026-10-03 · Red Hat rating ModerateRed Hat Hardened Images RPMs bug fix and enhancement update
- Red Hat Hardened Images python3.13-3.13.16-1.hum1@aarch64, python3.13-3.13.16-1.hum1@src, python3.13-3.13.16-1.hum1@x86_64 +16
- RHSA-2026:74922 Released 2026-10-02 · Red Hat rating ModerateRed Hat Hardened Images RPMs bug fix and enhancement update
- Red Hat Hardened Images python3.12-3.12.15-1.hum1@aarch64, python3.12-3.12.15-1.hum1@src, python3.12-3.12.15-1.hum1@x86_64 +12
- RHSA-2026:74870 Released 2026-10-02 · Red Hat rating ModerateRed Hat Hardened Images RPMs bug fix and enhancement update
- Red Hat Hardened Images python-unversioned-command-3.14.8-1.hum1@noarch@public-hummingbird-aarch64-rpms, python-unversioned-command-3.14.8-1.hum1@noarch@public-hummingbird-x86_64-rpms, python3-3.14.8-1.hum1@aarch64 +28
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Enterprise Linux 10 | Affected | No fix yet |
| Red Hat Enterprise Linux 6 | Affected | No fix planned: Out of support scope |
| Red Hat Enterprise Linux 7 | Affected | No fix yet: Fix deferred |
| Red Hat Enterprise Linux 8 | Affected | No fix yet: Fix deferred |
| Red Hat Enterprise Linux 9 | Affected | No fix yet: Fix deferred |
| Red Hat Enterprise Linux AI (RHEL AI) 3 | Affected | No fix yet: Fix deferred |
| Red Hat Hardened Images | Affected | No fix yet |
| Red Hat OpenShift AI (RHOAI) | Affected | — |
| Red Hat OpenShift Virtualization 4 | Affected | No fix yet: Fix deferred |
| Self-service automation portal 2 | Affected | No fix yet: Fix deferred |
| Red Hat Discovery 2 | Fixed | RHSA-2026:94802 |
| Red Hat Enterprise Linux AppStream (v. 8) | Fixed | RHSA-2026:85239 |
| Red Hat Enterprise Linux AppStream (v. 9) | Fixed | RHSA-2026:89742 |
| Red Hat Enterprise Linux BaseOS (v. 8) | Fixed | RHSA-2026:85239 |
| Red Hat Enterprise Linux BaseOS (v. 9) | Fixed | RHSA-2026:89742 |
| Red Hat Enterprise Linux CodeReady Linux Builder (v. 9) | Fixed | RHSA-2026:89742 |
| Red Hat Hardened Images | Fixed | RHSA-2026:74870, RHSA-2026:74922, RHSA-2026:75119 |
Timeline
- 2026-10-02 Threatist record created from CVE-2026-12345
- 2026-10-07 Affected versions changed · Red Hat
- 2026-10-10 1 new reference · CNA
- 2026-10-20 Fix available: RHSA-2026:85239 · Red Hat
- 2026-10-20 Fix available: Red Hat Enterprise Linux AppStream (v. 8), Red Hat Enterprise Linux BaseOS (v. 8) · Red Hat
- 2026-10-22 Fix available: Python Software Foundation/[email protected] · CNA
- 2026-10-26 Fix available: Python Software Foundation/[email protected] · CNA
- 2026-10-26 2 new references · CNA
- 2026-10-26 Fix available: RHSA-2026:89742 · Red Hat
- 2026-10-26 Fix available: Red Hat Enterprise Linux AppStream (v. 9), Red Hat Enterprise Linux BaseOS (v. 9), Red Hat Enterprise Linux CodeReady Linux Builder (v. 9) · Red Hat
- 2026-11-04 Fix available: RHSA-2026:94802 · Red Hat
- 2026-11-04 Fix available: Red Hat Discovery 2 · Red Hat
- 2026-11-06 Affected versions changed · Red Hat
References
Patch 8
- https://github.com/python/cpython/pull/157580
- https://github.com/python/cpython/commit/5c20517a4fc56683efe63a7751020db9573f538d
- https://github.com/python/cpython/commit/458e7134a5af7f86aee9d21b51cf499b41aa4420
- https://github.com/python/cpython/commit/e1f3590f155c6d66007e958c98c9d69316551993
- https://github.com/python/cpython/commit/06ef3d43fdaf4da97af12fa694b4886092c4b970
- https://github.com/python/cpython/commit/58ed0259cae509a19138795df302fe60b544dc74
- https://github.com/python/cpython/commit/0478b52788117db4b831b3efd648f56b777628aa
- https://github.com/python/cpython/commit/c39b52d00b42200aaadff679e2fe3f1006d57c58
More Python Software Foundation vulnerabilities
- TI-2024-07037 Quadratic complexity parsing cookies with backslashes CVSS 3.1HIGH 7.5
- TI-2024-11791 Bypass extraction filter to modify file metadata outside extraction directory CVSS 3.1MEDIUM 5.3
- TI-2024-00411 Quoted zip-bomb protection for zipfile CVSS 3.1MEDIUM 6.2
- TI-2026-13296 `HTTPPasswordMgr` can send saved HTTPS credentials via HTTP because of incorrect scheme matching CVSS 4.0MEDIUM 6.0
- TI-2024-06422 Email header injection due to unquoted newlines CVSS 3.1MEDIUM 5.5
- TI-2026-04606 Possible to hijack modules in current working directory CVSS 4.0MEDIUM 5.6
Sources
- CVE-2026-12345 · CVE Program
- CVE-2026-12345 · NVD
- FIRST EPSS
- CVE-2026-12345 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences