CVE-2026-12345

Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory

MEDIUM
5.9
CVSS Score
Published: September 29, 2026 at 05:46 PM UTC
Updated: October 26, 2026 at 01:17 AM UTC
1 product affected across 1 vendorPython

Using CPython by Python Software Foundation?

Get instant alerts when new vulnerabilities affect CPython - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
MEDIUM5.9
Exploit prediction
EPSS 0.3%
SSVC
No known exploit

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

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

Affected range stops below 3.12.15, so it looks safe — our inference, not a vendor statement
Affected range stops below 3.15.0rc3, so it looks safe — our inference, not a vendor statement

SSVC — Action Prioritization

SSVCNo known exploitNot automatablePartial impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

5.9MEDIUMPSF
Vector?

Quick Info

StatusAWAITING ANALYSIS
CWE
CWE-59

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card