VAITP Dataset

← Back to the dataset

CVE-2026-42315

pyLoad path traversal allows users with modify perms to write files anywhere.

  • 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, when passing a folder name in the set_package_data() API function call inside the data object with key "_folder", there is no sanitization at all, allowing a user with Perms.MODIFY to specify arbitrary directories as download locations for a package. 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
Missing 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 to pyLoad version 0.5.0b3.dev100 or later.

Vulnerable code sample

import os

class Package:
    def __init__(self, name):
        self.name = name
        self.folder = name
        self.download_dir = "/opt/pyload/downloads"

    def set_package_data(self, data):
        if "_folder" in data:
            self.folder = data["_folder"]

    def get_full_path(self, filename):
        return os.path.join(self.download_dir, self.folder, filename)

Patched code sample

import os

# Assume DOWNLOAD_BASE_DIR is a pre-configured, trusted base path, e.g., "/opt/pyload/downloads"
DOWNLOAD_BASE_DIR = os.path.abspath("./downloads")

def set_package_data(data):
    """
    Hypothetical function to set package data, including the download folder.
    This version includes the fix for the path traversal vulnerability.
    """
    if "_folder" in data:
        # User-supplied folder name, which could be malicious (e.g., "../../etc")
        folder_name_from_user = data["_folder"]

        # --- FIX ---
        # Sanitize the input by taking only the base name component.
        # This effectively strips any directory traversal characters like '..' or '/'.
        sanitized_folder = os.path.basename(folder_name_from_user)

        # Construct the final path using the sanitized name.
        # This ensures the path is always created inside the intended base directory.
        safe_path = os.path.join(DOWNLOAD_BASE_DIR, sanitized_folder)

        # As a secondary defense, resolve the real path and verify it is a child
        # of the base directory before using it.
        resolved_path = os.path.abspath(safe_path)
        if not resolved_path.startswith(DOWNLOAD_BASE_DIR):
            # Handle the error, for example by raising an exception or logging.
            raise ValueError("Path traversal attempt detected.")

        # The 'resolved_path' is now safe to use as the download location.
        # In a real application, this path would be used to update the package settings.
        # print(f"Path has been sanitized and set to: {resolved_path}")
        pass

Payload

{"_folder": "../../../../../../../../tmp"}

Cite this entry

@misc{vaitp:cve202642315,
  title        = {{pyLoad path traversal allows users with modify perms to write files anywhere.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-42315},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-42315/}}
}
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 ::