CVE-2025-55156: Pyload ng SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-pwh4-6r3m-j2rf
CWE-89
Published
Advisory Summary

CVE-2025-55156 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Pyload ng libraries in the PyPI ecosystem. The issue involves pyload vulnerable to sql injection via api /json/add_package in add_links parameter. Remediation is available by upgrading affected packages to version 0.5.0b3.dev91.

CVE-2025-55156 at a Glance

CVE Identifier CVE-2025-55156
GHSA Identifier GHSA-pwh4-6r3m-j2rf
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Pyload ng
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2025-55156

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.

pyload-ng fixed: 0.5.0b3.dev91
pip install pyload-ng>=0.5.0b3.dev91
Verify Direct and Transitive Dependencies

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-2025-55156, 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.dev91), 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-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. 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

### Summary The parameter `add_links` in the API /json/add_package is vulnerable to SQL Injection. SQL injection vulnerabilities can lead to sensitive data leakage. ### Details - Affected file:https://github.com/pyload/pyload/blob/develop/src/pyload/core/database/file_database.py#L271 - Affected code: ```python @style.queue def update_link_info(self, data): """ data is list of tuples (name, size, status, url) """ self.c.executemany( "UPDATE links SET name=?, size=?, status=? WHERE url=? AND status IN (1,2,3,14)", data, ) ids = [] statuses = "','".join(x[3] for x in data) self.c.execute(f"SELECT id FROM links WHERE url IN ('{statuses}')") for r in self.c: ids.append(int(r[0])) return ids ```` statuses is constructed from data, and data is the value of the add_links parameter entered by the user through /json/add_packge. Because `{statuses}` is directly spliced into the SQL statement, it leads to the SQL injection vulnerability. - Vulnerability Chain ```xml josn_blueprint.py#add_package src/pyload/core/api/__init__.py#add_package src/pyload/core/managers/file_manager.py#add_links src/pyload/core/threads/info_thread.py#run src/pyload/core/threads/info_thread.py#update_info src/pyload/core/managers/file_manager.py#update_file_info src/pyload/core/database/file_database.py#update_link_info ``` ### PoC ```python import requests if __name__ == "__main__": url = "http://localhost:8000/json/add_package" data = { "add_name": "My Downloads1", "add_dest": "0", "add_links": "https://www.dailymotion.com/video/x8zzzzz') or 1; Drop table users;--", "add_password": "mypassword" } response = requests.post(url, cookies=your_cookies, data=data) print(response.status_code, response.text) ``` <img width="1599" height="827" alt="image" src="https://github.com/user-attachments/assets/9bdcef37-59b8-4e60-a2b5-beb8a88c3202" /> ### Remediation ```python def update_link_info(self, data): """ data is list of tuples (name, size, status, url) """ self.c.executemany( "UPDATE links SET name=?, size=?, status=? WHERE url=? AND status IN (1,2,3,14)", data, ) # 提取所有url urls = [x[3] for x in data] # 构建参数化查询,避免SQL注入 placeholders = ','.join(['?'] * len(urls)) query = f"SELECT id FROM links WHERE url IN ({placeholders}) AND status IN (1,2,3,14)" self.c.execute(query, urls) ids = [int(row[0]) for row in self.c.fetchall()] return ids ``` ### Impact Attackers can modify or delete data in the database, causing data errors or loss.

CVE-2025-55156 Affected Pyload ng Versions

1 component(s)
Fixed Versions:
0.5.0b3.dev91
Product / Package Ecosystem Affected Versions Fixed Version
pyload-ng
PyPI
< 0.5.0b3.dev91
0.5.0b3.dev91

References

Frequently Asked Questions

What is CVE-2025-55156?
CVE-2025-55156 is a security vulnerability in Pyload ng involving PyLoad vulnerable to SQL Injection via API /json/add_package in add_links parameter under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Pyload ng versions are affected?
Affected versions include releases prior to 0.5.0b3.dev91 across affected packages: pyload-ng.
What version fixes CVE-2025-55156?
Upgrading to 0.5.0b3.dev91 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pyload-ng affected?
Yes, pyload-ng is affected in releases prior to 0.5.0b3.dev91. Upgrade your dependency to 0.5.0b3.dev91 or later.
What CWE is associated with CVE-2025-55156?
CVE-2025-55156 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check PyPI dependencies for CVE-2025-55156?
Run the dependency tree command: 'pip show pyload-ng'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pwh4-6r3m-j2rf",
  "modified" : "2025-08-12T13:16:38Z",
  "published" : "2025-08-12T00:13:46Z",
  "aliases" : [ "CVE-2025-55156" ],
  "summary" : "PyLoad vulnerable to SQL Injection via API /json/add_package in add_links parameter",
  "details" : "### Summary\nThe parameter `add_links` in the API /json/add_package is vulnerable to SQL Injection. SQL injection vulnerabilities can lead to sensitive data leakage.\n\n### Details\n- Affected file:https://github.com/pyload/pyload/blob/develop/src/pyload/core/database/file_database.py#L271\n- Affected code:\n```python\n@style.queue\n    def update_link_info(self, data):\n        \"\"\"\n        data is list of tuples (name, size, status, url)\n        \"\"\"\n        self.c.executemany(\n            \"UPDATE links SET name=?, size=?, status=? WHERE url=? AND status IN (1,2,3,14)\",\n            data,\n        )\n        ids = []\n        statuses = \"','\".join(x[3] for x in data)\n        self.c.execute(f\"SELECT id FROM links WHERE url IN ('{statuses}')\")\n        for r in self.c:\n            ids.append(int(r[0]))\n        return ids\n````\nstatuses is constructed from data, and data is the value of the add_links parameter entered by the user through /json/add_packge. Because `{statuses}` is directly spliced into the SQL statement, it leads to the SQL injection vulnerability.\n\n- Vulnerability Chain\n```xml\njosn_blueprint.py#add_package\nsrc/pyload/core/api/__init__.py#add_package\nsrc/pyload/core/managers/file_manager.py#add_links\nsrc/pyload/core/threads/info_thread.py#run\nsrc/pyload/core/threads/info_thread.py#update_info\nsrc/pyload/core/managers/file_manager.py#update_file_info\nsrc/pyload/core/database/file_database.py#update_link_info\n```\n\n\n### PoC\n```python\nimport requests\n\n\nif __name__ == \"__main__\":\n    url = \"http://localhost:8000/json/add_package\"\n    data = {\n        \"add_name\": \"My Downloads1\",\n        \"add_dest\": \"0\",\n        \"add_links\": \"https://www.dailymotion.com/video/x8zzzzz') or 1; Drop table users;--\",\n        \"add_password\": \"mypassword\"\n    }\n\n    response = requests.post(url, cookies=your_cookies, data=data)\n    print(response.status_code, response.text)\n```\n<img width=\"1599\" height=\"827\" alt=\"image\" src=\"https://github.com/user-attachments/assets/9bdcef37-59b8-4e60-a2b5-beb8a88c3202\" />\n\n\n\n\n### Remediation\n ```python\ndef update_link_info(self, data):\n    \"\"\"\ndata is list of tuples (name, size, status, url)\n\"\"\"\n    self.c.executemany(\n        \"UPDATE links SET name=?, size=?, status=? WHERE url=? AND status IN (1,2,3,14)\",\n        data,\n    )\n    \n    # 提取所有url\n    urls = [x[3] for x in data]\n    \n    # 构建参数化查询,避免SQL注入\n    placeholders = ','.join(['?'] * len(urls))\n    query = f\"SELECT id FROM links WHERE url IN ({placeholders}) AND status IN (1,2,3,14)\"\n    self.c.execute(query, urls)\n    \n    ids = [int(row[0]) for row in self.c.fetchall()]\n    return ids\n```\n\n\n\n### Impact\nAttackers can modify or delete data in the database, causing data errors or loss.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pyload-ng"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.0b3.dev91"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/security/advisories/GHSA-pwh4-6r3m-j2rf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-55156"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/commit/134edcdf6e2a10c393743c254da3d9d90b74258f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pyload/pyload"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/blob/develop/src/pyload/core/database/file_database.py#L271"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-12T00:13:46Z",
    "nvd_published_at" : "2025-08-11T23:15:26Z"
  }
}