Symlink Attack Affecting cpython package, versions [0,]


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.18% (7th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-CONAN-CPYTHON-20341495
  • published1 Oct 2026
  • disclosed29 Sept 2026
  • creditBitshift

Introduced: 29 Sep 2026

NewCVE-2026-12345  (opens in a new tab)
CWE-59  (opens in a new tab)

How to fix?

A fix was pushed into the master branch but not yet published.

Overview

Affected versions of this package are vulnerable to Symlink Attack due to a race condition in the onexc handler of TemporaryDirectory._rmtree in Lib/tempfile.py, which responds to a PermissionError or IsADirectoryError by calling _resetperms() and os.unlink() on the absolute path, resolving that path again rather than operating relative to the directory descriptor rmtree already holds. An attacker can delete files outside the temporary directory, or reset their permissions and file flags, with the privileges of the process doing the cleanup, by replacing a directory in the tree with a symbolic link in the window between the failed operation and the retry. This requires local write access to the tree while cleanup is running and a cleanup operation that hits a permissions error to reach the handler at all, and deletion outside the tree is confined to platforms where shutil.rmtree.avoids_symlink_attacks is false, though the flag reset reaches outside the tree on every platform.

CVSS Base Scores

version 4.0
version 3.1