CVE-2026-12345: Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory

Published Sep 29, 2026
·
Updated

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.avoidssymlinkattacks is false, remain affected, and file flags may still be reset outside of the tree on all platforms.

Affected Software

1 affected component
Python Software Foundation CPython

Event History

Sep 29, 2026
CVE Published
via MITRE·05:46 PM
Data Sourced
via MITRE·05:46 PM
Description
Data Sourced
via NVD·06:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What access does an attacker need to exploit this issue?

The attacker must be able to modify the temporary directory tree while cleanup is in progress. Exploitation relies on replacing a directory in that tree with a symbolic link during the race window.

2

How does the affected platform influence exposure?

Platforms where shutil.rmtree.avoids_symlink_attacks is false remain affected. On all platforms, file flags may still be reset outside the temporary-directory tree.

3

What privileges are used for the unintended file operations?

Any deletion, permission reset, or file-flag reset outside the temporary directory occurs with the privileges of the process performing the cleanup.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203