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.

Severity (CVSS 4.0)5.9Medium
Exploit odds (30 days)0.3%top 71.9% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack tooling1Public PoC

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

EcosystemPackageFixed inAdvisory
AlmaLinux:8platform-python3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:8platform-python-debug3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:8platform-python-devel3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:9python-unversioned-command3.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:9python33.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:9python3-debug3.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:9python3-devel3.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:8python3-idle3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:9python3-idle3.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:8python3-libs3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:9python3-libs3.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:8python3-test3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:9python3-test3.9.25-7.el9_8.6ALSA-2026:89742
AlmaLinux:8python3-tkinter3.6.8-79.el8_10.alma.1ALSA-2026:85239
AlmaLinux:9python3-tkinter3.9.25-7.el9_8.6ALSA-2026:89742
Alpine:v3.21python33.12.16-r0ALPINE-CVE-2026-12345
Alpine:v3.22python33.12.16-r0ALPINE-CVE-2026-12345
Alpine:v3.23python33.12.16-r0ALPINE-CVE-2026-12345
Alpine:v3.24python33.14.10-r0ALPINE-CVE-2026-12345
Debian:12pypy3no fix listedDEBIAN-CVE-2026-12345
Debian:13pypy3no fix listedDEBIAN-CVE-2026-12345
Debian:14pypy3no fix listedDEBIAN-CVE-2026-12345
Debian:12python3.11no fix listedDEBIAN-CVE-2026-12345
Debian:13python3.13no fix listedDEBIAN-CVE-2026-12345
Debian:14python3.143.14.9-1DEBIAN-CVE-2026-12345
Debian:14python3.153.15.0~rc3-1DEBIAN-CVE-2026-12345
Rocky Linux:8python30:3.6.8-79.el8_10.rocky.0RLSA-2026:85239
Rocky Linux:9python3.90:3.9.25-7.el9_8.6RLSA-2026:89742
Ubuntu:22.04:LTSpython3.10no fix listedUBUNTU-CVE-2026-12345
Ubuntu:24.04:LTSpython3.12no fix listedUBUNTU-CVE-2026-12345
Ubuntu:26.04:LTSpython3.14no fix listedUBUNTU-CVE-2026-12345
Ubuntu:26.10python3.14no fix listedUBUNTU-CVE-2026-12345

Affected products (as reported)

VendorProductVersions
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