CVE-2026-12345

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

State
Published
Severity
5.9 Medium
Published
Sep 29, 2026
Updated
Oct 26, 2026
Reserved
Jun 15, 2026

Read the record on cve.org

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.

Scores

CVSSScoreVectorSource
4.05.9 MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:NPSF

Weaknesses

  • CWE-59 Improper Link Resolution Before File Access ('Link Following')

Affected Products

ProductVersions
CPythonPython Software Foundation
  • before 3.12.15Affected
  • 3.13.0 to before 3.13.18Affected
  • 3.14.0 to before 3.14.9Affected
  • 3.15.0a1 to before 3.15.0rc3Affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.