Vulnerability in CPython TemporaryDirectory Class

python3 Updated 02 Oct 2025

Summary

19/03/2024
N/A
Yes i
Unrated
Not published

CVE-2023-6597: 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. Affects python3 across 7 version ranges.

< 02a9259c717738dfe6b463c44d7e17f2b6d2cb3a < 3.10.14-r0 < 6ceb8aeda504b079fef7a57b8d81472f15cdd9a5 < 8eaeefe49d179ca4908d052745e3bb8b6f238f82 < 81c16cd94ec38d61aa478b9a452436dc3b1b524d < 5585334d772b253a01a6730e8202ffb1607c3d25 < d54e22a669ae6e987199bb5d2c69bb5a46b0083b

Fixed in 3.10.14-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

CPython is an implementation of the Python programming language. It provides a comprehensive standard library, including the tempfile module, which offers functions and classes for working with temporary files and directories. One of these classes is TemporaryDirectory, which creates a temporary directory that is automatically deleted when it is no longer needed. However, a vulnerability has been discovered in the TemporaryDirectory class that affects versions 3.12.2, 3.11.8, 3.10.13, 3.9.18, and 3.8.18 and prior.

Vulnerability Detail

The vulnerability, identified as CVE-2023-6597, occurs when the TemporaryDirectory class dereferences symlinks during the cleanup process of permissions-related errors. This means that users who can run privileged programs may be able to modify the permissions of files referenced by symlinks under certain circumstances. This could potentially lead to unauthorized access or manipulation of sensitive files.

How To Fix

Minimum fixed version

3.10.14-r0

This is the first release that contains the fix.

sudo apk add --upgrade python3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can manually check and modify the permissions of files referenced by symlinks to prevent unauthorized access. However, this is not a comprehensive solution and should only be used until the package update can be applied.

Conclusion

In conclusion, the CPython TemporaryDirectory class is vulnerable to symlink dereferencing, which could allow unauthorized access or manipulation of files. It is crucial to update to version 3.10.14 or later of the python3 package to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for python3 →

Share this vulnerability

FAQ

The vulnerability allows users with the ability to run privileged programs to potentially modify the permissions of files referenced by symlinks. This could lead to unauthorized access or manipulation of sensitive files.

Versions 3.12.2, 3.11.8, 3.10.13, 3.9.18, and 3.8.18 and prior are affected by this vulnerability.

You can use the Vulert Playground at Vulert Scanner to check if your Python installation is affected by this vulnerability. Simply upload your manifest file, such as package-lock.json, and the tool will analyze it for any open-source vulnerabilities.

Yes, a fix is available in version 3.10.14 or later of the python3 package. It is recommended to update your Python installation to the latest fixed version.

You can find more information about this vulnerability, including the technical details and the CVE identifier, in the CVE-2023-6597 JSON report available at https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-6597.json.

Related vulnerabilities

Recent vulnerabilities recorded for python3.

How To Fix

Minimum fixed version

3.10.14-r0

This is the first release that contains the fix.

sudo apk add --upgrade python3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback