VAITP Dataset

← Back to the dataset

CVE-2026-29778

pyLoad path traversal vulnerability via an `../` sanitization bypass.

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

pyLoad is a free and open-source download manager written in Python. From version 0.5.0b3.dev13 to 0.5.0b3.dev96, the edit_package() function implements insufficient sanitization for the pack_folder parameter. The current protection relies on a single-pass string replacement of "../", which can be bypassed using crafted recursive traversal sequences. This issue has been patched in version 0.5.0b3.dev97.

CVSS base score
6.5
Published
2026-03-07
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 to pyLoad version 0.5.0b3.dev97 or later.

Vulnerable code sample

import os

def edit_package(pack_folder, base_download_dir="/var/lib/pyload/downloads"):
    # The vulnerable sanitization relies on a single-pass string replacement of "../".
    # This can be bypassed with crafted input like "....//".
    sanitized_folder = pack_folder.replace("../", "")

    # The application then uses the insufficiently sanitized input to construct a full path.
    # When `pack_folder` is "....//etc", `sanitized_folder` becomes "..//etc".
    # `os.path.normpath` will then resolve this to a path outside the base directory.
    destination_path = os.path.join(base_download_dir, sanitized_folder)
    final_path = os.path.normpath(destination_path)

    # In the actual application, a file system operation (e.g., os.rename) would
    # use this `final_path`, allowing an attacker to write files or move folders
    # outside of the intended download directory.
    
    # The function would then proceed with operations using this crafted path.
    # For this demonstration, we just return the calculated path.
    return final_path

Patched code sample

import os
from werkzeug.utils import secure_filename


def fixed_edit_package_logic(pack_folder: str) -> str:
    """
    This function demonstrates the patched logic that fixes the path traversal
    vulnerability (CVE-2023-29778) in pyLoad's `edit_package` function.

    The vulnerability was caused by insufficient sanitization which relied on
    a single-pass string replacement of `../`. This could be bypassed using
    crafted inputs like `....//`.

    The fix, demonstrated below, replaces the weak sanitization method with a
    call to a robust utility, `werkzeug.utils.secure_filename`, to properly
    sanitize the user-provided path fragment.

    Args:
        pack_folder: The user-provided folder name, which may be malicious.

    Returns:
        A sanitized, safe folder name that cannot be used for path traversal.
    """
    # The previous vulnerable code was approximately:
    # return pack_folder.replace("../", "")

    # --- The Fix ---
    # The user-provided `pack_folder` is processed by `secure_filename`.
    # This function is designed to produce a flat, ASCII-safe filename by
    # removing directory traversal components (`/`, `../`) and any other
    # characters that are not alphanumeric, underscores, hyphens, or dots.
    #
    # For a malicious input like "....//", which bypassed the original filter:
    # `secure_filename("....//")` would result in an empty string `""`.
    #
    # For a malicious input like "../../etc/passwd":
    # `secure_filename("../../etc/passwd")` would result in `"etc_passwd"`.
    sanitized_folder = secure_filename(pack_folder)

    # The sanitized name can now be safely used in path operations. For example:
    # download_dir = "/opt/pyload/downloads"
    # final_path = os.path.join(download_dir, sanitized_folder)
    # The `final_path` is guaranteed to be inside `download_dir`.

    return sanitized_folder

Payload

....//....//....//tmp/pwned

Cite this entry

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