CVE-2023-6597: Symlink-following permission modification in CPython TemporaryDirectory cleanup
- Vendor
- Python Software Foundation
CVE-2023-6597 is a symlink-handling vulnerability in CPython's tempfile.TemporaryDirectory cleanup logic. When recursive deletion encounters a permission-related error, the _rmtree error handler can call os.chmod with mode 0700 on a symbolic link. Because this operation follows symbolic links, it can change the permissions of the target file, including files outside the temporary directory. An attacker who can influence temporary-directory contents processed by a higher-privileged Python program may cause unauthorized permission changes. Affected releases include Python 3.12.1, 3.11.7, 3.10.13, 3.9.18, 3.8.18, and earlier releases in those branches.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Successful exploitation can cause a privileged Python process to reset permissions on an attacker-selected symlink target to 0700, crossing the intended temporary-directory boundary. This can compromise filesystem access controls and potentially enable confidentiality or integrity violations, depending on target ownership and application behavior. It does not inherently grant the attacker ownership, arbitrary file contents modification, or code execution. Without sufficient process privileges to change the target's permissions, cleanup may instead fail and leave temporary files behind.
Mitigation
If you can’t patch tonight, do this now.
Until an update is installed, avoid processing attacker-controlled temporary-directory trees or extracting untrusted archives with symbolic links in privileged Python processes. Run such processing with the minimum necessary filesystem privileges. A code-level workaround is to use follow_symlinks=False for permission and flag changes where supported, and otherwise avoid applying those operations to symbolic links.
Remediation
Patch, then assume compromise.
Upgrade to Python 3.12.2, 3.11.8, 3.10.14, 3.9.19, or 3.8.19, or a later fixed release in the corresponding branch. Alternatively, install the operating-system vendor's backported security update. Fixed Debian packages include python3.7 3.7.3-2+deb10u7 for Debian 10, python3.9 3.9.2-1+deb11u2 for Debian 11, and pypy3 7.3.5+dfsg-2+deb11u3 for Debian 11. For affected container deployments, update the base image and rebuild and redeploy dependent images. The code fix prevents symlink dereferencing during permission-error recovery.
Exploits
No public exploits tracked yet. Mallory keeps watching.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2023-6597 exploited in the wild?
- As of Oct 22, 2026, Mallory has no reports of CVE-2023-6597 being exploited in the wild. It is not listed in CISA KEV.
- Is there a public exploit for CVE-2023-6597?
- As of Oct 22, 2026, Mallory has found no public exploit for CVE-2023-6597.
- Is there a patch for CVE-2023-6597?
- Upgrade to Python 3.12.2, 3.11.8, 3.10.14, 3.9.19, or 3.8.19, or a later fixed release in the corresponding branch. Alternatively, install the operating-system vendor's backported security update.
- What products are affected by CVE-2023-6597?
- Python Software Foundation Cpython.
- How severe is CVE-2023-6597?
- CVE-2023-6597 has a CVSS v3.1 score of 7.8 (High) and an EPSS score of 0.39% (24th percentile) as of Oct 22, 2026.
Recent activity
64 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.