Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2023-6597: Vulnerability in Python Software Foundation CPython

0
High
VulnerabilityCVE-2023-6597cvecve-2023-6597
Published: Tue Mar 19 2024 (03/19/2024, 15:44:28 UTC)
Source: CVE Database V5
Vendor/Project: Python Software Foundation
Product: CPython

Description

An issue was found in the CPython `tempfile.TemporaryDirectory` class affecting versions 3.12.1, 3.11.7, 3.10.13, 3.9.18, and 3.8.18 and prior. The tempfile.TemporaryDirectory class would dereference symlinks during cleanup of permissions-related errors. This means users which can run privileged programs are potentially able to modify permissions of files referenced by symlinks in some circumstances.

AI-Powered Analysis

AILast updated: 11/03/2025, 23:09:32 UTC

Technical Analysis

CVE-2023-6597 is a vulnerability discovered in the CPython implementation of the tempfile.TemporaryDirectory class, impacting versions 3.8.18, 3.9.18, 3.10.13, 3.11.7, and 3.12.1. The flaw occurs during the cleanup phase of TemporaryDirectory when permissions-related errors arise. Specifically, the class dereferences symbolic links (symlinks) instead of handling them safely, which can lead to unintended modification of file permissions on the target files that symlinks point to. This behavior can be exploited by users who have the capability to run privileged programs locally, enabling them to manipulate permissions of arbitrary files referenced by symlinks. Such manipulation could facilitate privilege escalation or unauthorized access to sensitive files, compromising confidentiality and integrity. The vulnerability does not require user interaction but does require local access and the ability to execute privileged code. The CVSS 3.1 base score is 7.8, reflecting high severity with a vector indicating local attack vector, high attack complexity, no privileges required, no user interaction, and scope change with high confidentiality and integrity impact but no availability impact. No public exploits have been reported yet, but the vulnerability poses a significant risk in multi-user or shared environments where symlinks and privileged programs coexist. The Python Software Foundation has published the vulnerability details, but patch links were not provided at the time of this report.

Potential Impact

For European organizations, the vulnerability presents a risk primarily in environments where Python is used extensively for automation, scripting, or application development, especially in multi-user or shared systems such as servers or development platforms. Attackers with local access and the ability to run privileged programs could exploit this flaw to alter file permissions on critical files, potentially leading to privilege escalation or unauthorized data access. This could compromise sensitive information, disrupt application integrity, and undermine trust in automated processes. Sectors such as finance, healthcare, government, and critical infrastructure that rely on Python-based tools or services are particularly vulnerable. The impact is heightened in organizations that allow users to create symlinks or run privileged scripts without strict controls. Although no known exploits exist yet, the vulnerability’s presence in widely used Python versions means that unpatched systems remain at risk of targeted attacks or insider threats.

Mitigation Recommendations

1. Monitor for and apply official patches or updates from the Python Software Foundation as soon as they become available to address CVE-2023-6597. 2. Until patches are applied, restrict the ability of untrusted users to execute privileged programs or scripts that utilize tempfile.TemporaryDirectory, especially in environments where symlinks can be created. 3. Implement strict filesystem permissions and policies to limit symlink creation and usage by non-administrative users. 4. Audit existing codebases and scripts for usage of tempfile.TemporaryDirectory in privileged contexts and refactor or add safeguards to prevent symlink dereferencing during cleanup. 5. Employ runtime monitoring to detect unusual permission changes or symlink manipulations on critical files. 6. Educate developers and system administrators about the risks of symlink dereferencing in privileged operations and encourage secure coding practices. 7. Use containerization or sandboxing to isolate processes that handle temporary directories to minimize potential damage from exploitation.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.2
Assigner Short Name
PSF
Date Reserved
2023-12-07T20:59:23.246Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 69092613fe7723195e0b3005

Added to database: 11/3/2025, 10:00:51 PM

Last enriched: 11/3/2025, 11:09:32 PM

Last updated: 11/5/2025, 2:19:31 PM

Views: 1

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats