Race condition in tempfile.TemporaryDirectory cleanup allows deleting files outside the temporary directory
- CVE-2026-12345
- EUVD-2026-89183
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.
Text from the CVE.org record.
Recommendation
Python Software Foundation CPython
- If you run 3.15.xupdate to 3.15.0rc3 or laterPatch update: breaking changes are unlikely
- If you run 3.14.xupdate to 3.14.9 or laterPatch update: breaking changes are unlikely
- If you run 3.13.xupdate to 3.13.18 or laterPatch update: breaking changes are unlikely
- If you run a version before 3.12.15update to 3.12.15 or later
Taken from the version ranges of the CVE.org record. Check the vendor advisory: nothing is said about versions the ranges do not list. Breaking-change risk is read from the version numbers only.
Affected
Python Software Foundation CPython
Affected versions Fixed in from 3.15.0a1 to before 3.15.0rc3 3.15.0rc3 from 3.14.0 to before 3.14.9 3.14.9 from 3.13.0 to before 3.13.18 3.13.18 before 3.12.15 3.12.15
Product versions from the CVE.org record.
Timeline
- Published
Related news
No article from the followed outlets names this vulnerability.