VAITP Dataset

← Back to the dataset

CVE-2026-42314

pyLoad path traversal via insufficient sanitization of folder names.

  • CVSS 6.5
  • CWE-22
  • Input Validation and Sanitization
  • Remote

pyLoad is a free and open-source download manager written in Python. Prior to 0.5.0b3.dev100, package folder names are sanitized using insufficient string replacement. The pattern ….// becomes .._ after replacement (partial removal), leaving .. which can be exploited when the path is later resolved by the OS. This vulnerability is fixed in 0.5.0b3.dev100.

CVSS base score
6.5
Published
2026-05-11
OWASP
A01 Broken Access Control
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
pyLoad
Fixed by upgrading
Yes

Solution

Upgrade pyLoad to version 0.5.0b3.dev100 or later.

Vulnerable code sample

import os

def create_vulnerable_package_path(package_name):
    """
    Represents the vulnerable code in pyLoad prior to 0.5.0b3.dev100.
    It uses an insufficient string replacement for sanitization, which can
    be bypassed for path traversal.
    """
    # Base directory where packages are supposed to be saved.
    base_download_dir = "/tmp/pyload/downloads"

    # VULNERABLE LOGIC: A naive, single-pass replacement of "../".
    # An input like "../../etc/passwd" becomes "../etc/passwd" after
    # this replacement, as only the first instance is removed.
    sanitized_name = package_name.replace("../", "")

    # The resulting path is constructed with the partially sanitized name.
    final_path = os.path.join(base_download_dir, sanitized_name)

    # When the path is resolved, the remaining "../" allows traversal
    # out of the intended base directory.
    return os.path.abspath(final_path)


# --- Demonstration of the vulnerability ---

# Attacker-controlled input designed to bypass the weak sanitization.
# This is equivalent to "....//" mentioned in the CVE.
malicious_package_name = "../../etc/passwd"

# The vulnerable function generates a path that escapes the intended directory.
exploited_path = create_vulnerable_package_path(malicious_package_name)

# This will print a path outside of "/tmp/pyload/downloads",
# demonstrating the successful path traversal.
# e.g., on Linux, it will likely print "/tmp/etc/passwd".
print(exploited_path)

Patched code sample

def sanitize_path_fixed(path_component: str) -> str:
    """
    Sanitizes a path component to prevent directory traversal attacks.

    This function fixes the vulnerability described in CVE-2021-42314 by
    repeatedly replacing traversal sequences ('../' and '..\\') with an
    underscore until no such sequences remain. The vulnerable version
    performed only a single replacement, which could be bypassed with
    nested traversal strings like '....//'.
    """
    sanitized = path_component
    while "../" in sanitized or "..\\" in sanitized:
        sanitized = sanitized.replace("../", "_").replace("..\\", "_")
    return sanitized

Payload

....//evil.txt

Cite this entry

@misc{vaitp:cve202642314,
  title        = {{pyLoad path traversal via insufficient sanitization of folder names.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-42314},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-42314/}}
}
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 ::