Skip to content
CVE PROGRAM SOURCE RECORD5.9 Medium

CVE-2026-12345

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

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 products

Version statuses are supplied by the assigning organization. Consult the original record for detailed ranges and platform conditions.

Python Software Foundation CPython

Default version status: unaffected

  • 0 to < 3.12.15affected
  • 3.13.0 to < 3.13.18affected
  • 3.14.0 to < 3.14.9affected
  • 3.15.0a1 to < 3.15.0rc3affected

References