{"answers":{"affected":"2 open source packages ship an affected version, including pyload-ng.","exploited":"There is no known exploitation of GHSA-r44w-v6gf-x3p6 in the wild and no public exploit code.","fix":"Upgrade pyload-ng to 0.5.0b3.dev101 or later.","what":"GHSA-r44w-v6gf-x3p6 is an authentication bypass 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-r44w-v6gf-x3p6 and fix it if it is affected.\n\nWhat it is: GHSA-r44w-v6gf-x3p6 is an authentication bypass 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-r44w-v6gf-x3p6 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- pyload-ng (PyPI): affected all versions; fixed in 0.5.0b3.dev101\n- pyload-ng (PyPI): affected all versions; fixed in 0.5.0b3.dev101\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-r44w-v6gf-x3p6/ (Markdown: https://insights.sbomify.com/GHSA-r44w-v6gf-x3p6/index.md)","id":"GHSA-r44w-v6gf-x3p6","markdown":"https://insights.sbomify.com/GHSA-r44w-v6gf-x3p6/index.md","name":"GHSA-r44w-v6gf-x3p6","record":{"aliases":[],"analysis":{"component_type":"server_software","fix_type":"patch","impacts":["privilege_escalation","data_read"],"network_reachable":"yes","non_default_config":false,"product_category":"pyLoad download manager","requires_auth":"none","summary":"Attackers can bypass API authentication by exploiting a cache flaw that skips secret verification, allowing unauthorized access to user data and functions.","user_interaction":"not_required","vuln_class":"auth_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\nThe API-key cache in `check_apikey()` allows an attacker to authenticate with a **forged API key** as long as the legitimate key for the same `key_id` has been used recently.\n\nOn a cache hit, the API key **secret is never verified**, resulting in a complete authentication bypass during the cache lifetime.\n\n---\n\n# Affected Components\n\n- `src/pyload/core/api/init.py`\n  - `Api.check_apikey()`\n\n- `src/pyload/core/database/apikey_database.py`\n  - `check_apikey()`\n  - `_check_key()`\n\nThe cache is used by normal API requests through:\n\n- `src/pyload/webui/app/helpers.py`\n\nwhich calls:\n\n```python\napi.check_apikey(api_key)\n```\n\nwithout providing a `ttl`, meaning the default **300-second cache** is always enabled.\n\n---\n\n# Root Cause\n\nSuccessful API key validations are cached in:\n\n```python\nself._apikey_cache\n```\n\nusing the following structure:\n\n```python\n{\n    key_id: (timestamp, cached_data)\n}\n```\n\nThe cache key is based **only on `key_id`**, and that value is parsed directly from the user-supplied API key rather than being obtained from a trusted lookup.\n\nWhen a cache hit occurs within the TTL, `check_apikey()` returns:\n\n```python\n{\n    \"success\": True,\n    \"data\": cached_data\n}\n```\n\nafter checking only:\n\n- `expires_at`\n\nAt no point on this execution path is the supplied secret:\n\n```text\napikey[-43:]\n```\n\ncompared against the stored key hash.\n\n---\n\nThe actual secret verification exists only in:\n\n```python\n_check_key()\n```\n\nwhich correctly uses:\n\n```python\nhmac.compare_digest()\n```\n\nHowever, this function is only reached on a **cache miss** through the database layer's `check_apikey()` implementation.\n\nFurthermore, the cached object cannot be used for verification because it intentionally does **not** include the stored key hash.\n\nThe cached record contains only:\n\n- `id`\n- `user_id`\n- `name`\n- `created_at`\n- `expires_at`\n- `last_used`\n\nSince `key_hash` is absent, the cache lacks the information required to validate the presented secret.\n\nAs a result, once a legitimate request populates the cache, every subsequent request using the same `key_id` within the 300-second cache window is accepted **without validating the secret**.\n\n---\n\n# Impact\n\n`key_id` values are small sequential integers assigned when API keys are created (1, 2, 3, ...), making them trivial to enumerate.\n\nThe API key format is also publicly reconstructable from the source code.\n\nAn attacker therefore does **not** need to know any valid API key secret.\n\nThey only need a `key_id` whose legitimate key has been used within the previous five minutes, which is likely on an actively used deployment.\n\nDuring that cache window, a forged API key follows exactly the same authentication path as a legitimate key and inherits the associated user's permissions.\n\nThis results in a **complete remote authentication bypass**.\n\nI would classify the issue as **Critical** severity.\n\n---\n\n# Estimated CVSS v3.1\n\n```\nAV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H\n```\n\n(`AC:H` only because successful exploitation depends on the cache already containing an entry.)\n\n---\n\n# Reproduction\n\n### 1. Create an administrator account.\n\n---\n\n### 2. Generate an API key.\n\nExample:\n\n```text\npl_11\u003c43-character-secret\u003e\n```\n\nwhere:\n\n```\nkey_id = 1\n```\n\n---\n\n### 3. Send a legitimate authenticated request.\n\n```bash\ncurl \\\n  -H \"X-API-Key: pl_11\u003creal-43-char-secret\u003e\" \\\n  http://127.0.0.1:8000/api/status\n```\n\nExpected response:\n\n```text\nHTTP/1.1 200 OK\n```\n\n---\n\n### 4. Within 300 seconds, send the same request using a forged API key.\n\n```bash\ncurl \\\n  -H \"X-API-Key: pl_11xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" \\\n  http://127.0.0.1:8000/api/status\n```\n\nObserved response:\n\n```text\nHTTP/1.1 200 OK\n```\n\nThe request succeeds even though the API key secret is entirely incorrect.\n\n---\n\n# Control Test\n\nIf the forged API key is sent **before** any legitimate request has populated the cache, the server correctly returns:\n\n```text\nHTTP/1.1 401 Unauthorized\n```\n\nThe only difference between the failing and succeeding forged request is whether the cache already contains an entry for that `key_id`.\n\nThis isolates the vulnerability specifically to the cache-hit path.\n\n---\n\n# Suggested Fix\n\nCache hits should **never replace secret verification**.\n\nPossible approaches include:\n\n- Store a value derived from the complete API key (or its hash) in the cache and verify it using `hmac.compare_digest()` on every cache hit before returning success.\n\n- Alternatively, key the cache using a value derived from the **entire API key secret** (for example, a cryptographic hash of the complete API key) rather than using only `key_id`.\n\nRegardless of implementation, the security invariant should remain:\n\n\u003e **The API key secret must be validated on every authenticated request, regardless of whether the cache is hit or missed.**","ecosystems":["PyPI"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"pyLoad has an authentication bypass in API key validation (check_apikey cache)","id":"GHSA-r44w-v6gf-x3p6","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"auth_bypass","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"PyPI","fixed":["0.5.0b3.dev101"],"introduced":["0"],"last_affected":[],"package":"pyload-ng","purl":null,"source":"GHSA-r44w-v6gf-x3p6"},{"ecosystem":"PyPI","fixed":["0.5.0b3.dev101"],"introduced":["0"],"last_affected":[],"package":"pyload-ng","purl":"pkg:pypi/pyload-ng","source":"GHSA-r44w-v6gf-x3p6"}],"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 API authentication by exploiting a cache flaw that skips secret verification, allowing unauthorized access to user data and functions.","url":"https://insights.sbomify.com/GHSA-r44w-v6gf-x3p6/"}