VAITP Dataset

← Back to the dataset

CVE-2026-53940

Conda 26.5.2 allows malicious entry‑point paths to write files outside the env prefix.

  • CVSS 8.8
  • CWE-22
  • Input Validation and Sanitization
  • Local

Conda is a system-level binary package and environment manager that runs on major operating systems and platforms. Prior to 26.5.2, parse_entry_point_def in conda/common/path/python.py accepted an unvalidated entry-point command from a noarch:python package's info/link.json metadata. CreatePythonEntryPointAction in conda/core/path_actions.py interpolated that command into target_short_path, and PrefixPathAction.target_full_path joined it to the installation prefix without verifying that the result remained under the intended bin or Scripts directory. create_python_entry_point in conda/gateways/disk/create.py then wrote an executable wrapper to the resulting path. A malicious package could use path separators, traversal segments, or an absolute command path to write outside the prefix or overwrite another in-prefix entry point during default install and environment transactions. Out-of-prefix writes require the target parent directory to exist, while an overwritten entry point can execute attacker-controlled Python when later invoked with the installing user's privileges. This issue is fixed in version 26.5.2.

CVSS base score
8.8
Published
2026-09-21
OWASP
A04 Insecure Design
Orthogonal defect classification
Assignment
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
conda
Fixed by upgrading
Yes

Solution

Upgrade Conda to version 26.5.2 or later.

Vulnerable code sample

import os

def create_entry_point(prefix: str, entry_cmd: str) -> str:
    """
    Mimic Conda's pre‑26.5.2 behavior: directly interpolate the entry‑point command
    into the target path and write a wrapper there.
    """
    # VULNERABLE: directly joins unvalidated entry_cmd, allowing path traversal
    target_path = os.path.join(prefix, "bin", entry_cmd)
    os.makedirs(os.path.dirname(target_path), exist_ok=True)
    with open(target_path, "w") as f:
        f.write("#!/usr/bin/env python\n")
        f.write(f"import subprocess; subprocess.run(['{entry_cmd}'])\n")
    os.chmod(target_path, 0o755)
    return target_path

Patched code sample

import os

def create_entry_point(prefix: str, entry_cmd: str) -> str:
    """
    Hardened version: normalize and validate the target path to ensure it stays
    within the intended bin directory.
    """
    # FIX: normalize and enforce that the result resides under the bin directory
    unsafe_path = os.path.join(prefix, "bin", entry_cmd)
    safe_path = os.path.normpath(unsafe_path)
    bin_dir = os.path.normpath(os.path.join(prefix, "bin"))
    if not safe_path.startswith(bin_dir + os.sep):
        raise ValueError("Entry command resolves outside the bin directory")
    os.makedirs(os.path.dirname(safe_path), exist_ok=True)
    with open(safe_path, "w") as f:
        f.write("#!/usr/bin/env python\n")
        f.write(f"import subprocess; subprocess.run(['{entry_cmd}'])\n")
    os.chmod(safe_path, 0o755)
    return safe_path

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • Backport fix for a 26.5.x patch release (#16168) (conda/conda)
    conda/common/path/python.py, conda/common/path/python.py · parse_entry_point_def, conda/core/path_actions.py, conda/core/path_actions.py · CreatePythonEntryPointAction.create_actions, conda/core/path_actions.py · LinkPathAction.create_python_entry_point_windows_exe_action, conda/gateways/disk/create.py, conda/gateways/disk/create.py · create_python_entry_point

Cite this entry

@misc{vaitp:cve202653940,
  title        = {{Conda 26.5.2 allows malicious entry‑point paths to write files outside the env prefix.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-53940},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-53940/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.