# CVE-2026-40594: pyLoad session cookie security downgrade via header spoofing

Source: https://junglewise.ai/threats/cve-2026-40594-pyload-session-cookie-security-downgrade-via-header-spoofing  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-21. Updated: 2026-06-08  
License: CC BY 4.0 with a link back

CVE-2026-40594 · Severity: medium · CVSS 4.8 · Published 2026-04-21

pyLoad, a download manager, contains a flaw in how it handles secure web connections. An attacker can trick the system into sending login cookies over insecure channels, potentially allowing them to hijack user accounts. Additionally, an attacker can cause a service disruption where users are repeatedly logged out and unable to use the web interface.

Technologies: [pyLoad Next Gen](https://junglewise.ai/threats/technologies/pyload-next-gen), [pyload-ng (PyPI)](https://junglewise.ai/threats/technologies/pyload-ng). Vendors: [pyLoad](https://junglewise.ai/threats/vendors/pyload), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-40594 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40594 being exploited in the wild.

**How severe is CVE-2026-40594?** Medium severity, with a CVSS score of 4.8, published 21 April 2026.

**Which products and versions are affected?** pyLoad Next Gen <= 0.5.0b3.dev97; pyload-ng (PyPI) <= 0.5.0b3.dev97, ECOSYSTEM:introduced=0,fixed=0.5.0b3.dev69, ECOSYSTEM:introduced=0,fixed=0.5.0b3.dev98.

**Is there a fix for CVE-2026-40594?** Yes. pyload-ng (PyPI): upgrade to 0.5.0b3.dev69, 0.5.0b3.dev98 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-40594 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-40594?** Check whether you run pyLoad Next Gen, Pyload-Ng Project Pyload-Ng or pyload-ng (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- pyload-ng (PyPI): upgrade to 0.5.0b3.dev69, 0.5.0b3.dev98 or later

  ```sh
  pip install "pyload-ng>=0.5.0b3.dev98"
  ```


## Technical details

The vulnerability exists in the `set_session_cookie_secure` handler within `src/pyload/webui/app/__init__.py`. The application reads the `X-Forwarded-Proto` header without validation and uses it to mutate the global Flask configuration `SESSION_COOKIE_SECURE`. In the multi-threaded Cheroot WSGI server environment, this creates a race condition. An unauthenticated remote attacker can spoof this header to either force the `Secure` flag to `False` (enabling session hijacking via cleartext transmission behind a proxy) or force it to `True` on plain HTTP deployments (causing browsers to reject cookies and creating a denial-of-service). The issue is fixed in version 0.5.0b3.dev98.

## Affected products

- pyLoad pyload-ng <= 0.5.0b3.dev97

## Identifiers

- CVE-2026-40594
- GHSA-mp82-fmj6-f22v
- PYSEC-2026-125

## Timeline

- 2026-04-14: disclosed
- 2026-04-16: advisory
- 2026-04-16: patched

## References

- [https://api.github.com/users/offset](https://api.github.com/users/offset)
- [https://github.com/offset](https://github.com/offset)
- [https://api.github.com/users/offset/gists%7B/gist_id%7D](https://api.github.com/users/offset/gists%7B/gist_id%7D)
- [https://api.github.com/users/offset/repos](https://api.github.com/users/offset/repos)
- [https://avatars.githubusercontent.com/u/114768995?v=4](https://avatars.githubusercontent.com/u/114768995?v=4)
- [https://api.github.com/users/offset/events%7B/privacy%7D](https://api.github.com/users/offset/events%7B/privacy%7D)

## Related threats

- [pyLoad unauthenticated template access and information disclosure](https://junglewise.ai/threats/cve-2026-75597-pyload-unauthenticated-access-to-web-path-filename-bypasses)
- [pyLoad API denial of service in multipart file upload handling](https://junglewise.ai/threats/cve-2026-48484-pyload-lack-of-input-size-validation-leads-to-denial-of-service)
- [pyload-ng authentication bypass in getUserData/get_userdata](https://junglewise.ai/threats/pyload-ng-getuserdata-get-userdata-exposed-at-perms-any-allow-any-cd197c9d)
- [pyLoad rate-limit bypass and audit-log spoofing via X-Forwarded-For header](https://junglewise.ai/threats/pyload-rate-limit-bypass-and-audit-log-spoofing-via-trusted-client-0df0fd12)
- [pyLoad session invalidation bypass in privilege revocation and password change](https://junglewise.ai/threats/pyload-privilege-revocation-and-password-change-through-the-rest-api-do-8e7301ba)
