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

- Priority: **Routine**
- Reason: Not severe (CVSS 5.9, local access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2026-09-29 · Modified: 2026-12-01
- Aliases: RHSA-2026:74870, RHSA-2026:74922, RHSA-2026:75119, UBUNTU-CVE-2026-12345, DEBIAN-CVE-2026-12345, CGA-2w26-qvh7-3jhg, CGA-3ghx-j4h4-2hj2, CGA-5hh2-cq82-m3hc, CGA-6p3c-479h-x32j, CGA-856h-m5xq-m9xq, CGA-g73w-6cxg-73cx, CGA-m48m-44w3-h42c, CGA-mc6m-j8hf-7329, CGA-mp3h-w2rr-vq2f, CGA-qq2w-53jr-v29w, CGA-qx8x-26cc-44gv, CGA-x8vg-p55m-fr9h, ALPINE-CVE-2026-12345, RHSA-2026:98615, RHSA-2026:104720
- Record: https://cvemate.com/vulnerability/CVE-2026-12345 · JSON: https://cvemate.com/vulnerability/CVE-2026-12345/json

## Description

```text
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.
```

## Signals

- CVSS: 5.9 medium (v4.0, CVE.org) CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N
- EPSS: 0.357%, percentile 31.453%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 64)

- alpine python3 (Alpine Linux): \< 3.12.16-r0 \| \< 3.14.10-r0 \| \< 3.14.9-r2
- chainguard python-3.10 (Chainguard): All versions (No fix recorded)
- chainguard python-3.11 (Chainguard): All versions (No fix recorded)
- chainguard python-3.12 (Chainguard): All versions (No fix recorded) \| \< 3.12.16-r0
- chainguard python-3.13 (Chainguard): All versions (No fix recorded) \| \< 3.13.18\_git20261030-r0
- chainguard python-3.14 (Chainguard): All versions (No fix recorded) \| \< 3.14.8\_git20261014-r0
- chainguard python-3.15 (Chainguard): All versions (No fix recorded)
- wolfi python-3.10 (Wolfi): All versions (No fix recorded)
- wolfi python-3.11 (Wolfi): All versions (No fix recorded)
- wolfi python-3.12 (Wolfi): All versions (No fix recorded) \| \< 3.12.16-r0
- wolfi python-3.13 (Wolfi): All versions (No fix recorded) \| \< 3.13.18\_git20261030-r0
- wolfi python-3.14 (Wolfi): All versions (No fix recorded) \| \< 3.14.8\_git20261014-r0
- wolfi python-3.15 (Wolfi): All versions (No fix recorded)
- debian pypy3 (Debian): All versions (No fix recorded)
- debian python3.11 (Debian): All versions (No fix recorded)
- debian python3.13 (Debian): All versions (No fix recorded)
- debian python3.14 (Debian): All versions (No fix recorded) \| \< 3.14.9-1
- debian python3.15 (Debian): All versions (No fix recorded) \| \< 3.15.0~rc3-1
- ubuntu python2.7 (Ubuntu): All versions (No fix recorded)
- ubuntu python3.10 (Ubuntu): All versions (No fix recorded)

## References (first 20 of 36)

- <https://github.com/python/cpython/pull/157580>
- <https://github.com/python/cpython/issues/157579>
- <https://github.com/python/cpython/commit/5c20517a4fc56683efe63a7751020db9573f538d>
- <https://github.com/python/cpython/commit/458e7134a5af7f86aee9d21b51cf499b41aa4420>
- <https://github.com/python/cpython/commit/e1f3590f155c6d66007e958c98c9d69316551993>
- <https://github.com/python/cpython/commit/06ef3d43fdaf4da97af12fa694b4886092c4b970>
- <https://github.com/python/cpython/commit/58ed0259cae509a19138795df302fe60b544dc74>
- <http://www.openwall.com/lists/oss-security/2026/09/29/40>
- <https://access.redhat.com/errata/RHSA-2026:74870>
- <https://images.redhat.com/>
- <https://access.redhat.com/security/cve/CVE-2026-12345>
- <https://access.redhat.com/security/updates/classification/>
- <https://security.access.redhat.com/data/csaf/v2/advisories/2026/rhsa-2026_74870.json>
- <https://bugzilla.redhat.com/show_bug.cgi?id=2543492>
- <https://www.cve.org/CVERecord?id=CVE-2026-12345>
- <https://nvd.nist.gov/vuln/detail/CVE-2026-12345>
- <https://access.redhat.com/errata/RHSA-2026:74922>
- <https://security.access.redhat.com/data/csaf/v2/advisories/2026/rhsa-2026_74922.json>
- <https://access.redhat.com/errata/RHSA-2026:75119>
- <https://security.access.redhat.com/data/csaf/v2/advisories/2026/rhsa-2026_75119.json>

---

Data as of 2026-12-05T04:47:41.460Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
