VAITP Dataset

← Back to the dataset

CVE-2024-24808

Open redirect vulnerability due to incorrect URL validation in pyLoad.

  • CVSS 6.1
  • CWE-601
  • Input Validation and Sanitization
  • Remote

pyLoad is an open-source Download Manager written in pure Python. There is an open redirect vulnerability due to incorrect validation of input values when redirecting users after login. pyLoad is validating URLs via the `get_redirect_url` function when redirecting users at login. This vulnerability has been patched with commit fe94451.

CVSS base score
6.1
Published
2024-02-06
OWASP
A01 Broken Access Control
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
Category
Input Validation and Sanitization
Subcategory
Open Redirects
Accessibility scope
Remote
Impact
Unauthorized Access
Affected component
pyLoad
Fixed by upgrading
Yes

Solution

Upgrade to the latest version of pyLoad that includes the patch from commit fe94451 to fix the open redirect vulnerability.

Vulnerable code sample

def get_redirect_url(redirect_url):
    return redirect_url

redirect = get_redirect_url("https://example.com/dashboard")
print("Redirecting to:", redirect)

Patched code sample

from urllib.parse import urlparse, urljoin

def get_redirect_url(base_url, redirect_url):
    base_parsed = urlparse(base_url)

    redirect_parsed = urlparse(redirect_url)

    if redirect_parsed.scheme in ["http", "https"] and redirect_parsed.netloc != base_parsed.netloc:
        raise ValueError("Invalid redirect URL")

    return urljoin(base_url, redirect_url)

try:
    redirect = get_redirect_url("https://example.com/dashboard", "/home")
    print("Redirecting to:", redirect)
except ValueError as e:
    print(e)

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.

  • fix GHSA-g3cm-qg2v-2hj5 security advisory (pyload/pyload)
    src/pyload/webui/app/blueprints/app_blueprint.py · login, src/pyload/webui/app/helpers.py, src/pyload/webui/app/helpers.py · get_redirect_url, src/pyload/webui/app/helpers.py · is_safe_url, src/pyload/webui/app/helpers.py · login_required

Cite this entry

@misc{vaitp:cve202424808,
  title        = {{Open redirect vulnerability due to incorrect URL validation in pyLoad.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2024},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2024-24808},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-24808/}}
}

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.