# CVE-2026-40864: JupyterHub XSRF protection bypass in HTTP form endpoints

Source: https://junglewise.ai/threats/cve-2026-40864-jupyterhub-xsrf-protection-bypass-in-http-form-endpoints  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-22. Updated: 2026-06-09  
License: CC BY 4.0 with a link back

CVE-2026-40864 · Severity: medium · CVSS 5.4 · Published 2026-05-22

JupyterHub, a multi-user platform for Jupyter notebooks, contains a security flaw in its cross-site request forgery (XSRF) protection. An attacker could trick a logged-in user into performing unintended actions, such as starting a server or accepting a shared server connection. While this does not grant the attacker direct access to the user's data, it can be used to manipulate user sessions and server states.

Technologies: [jupyterhub (PyPI)](https://junglewise.ai/threats/technologies/jupyterhub). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

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

**How severe is CVE-2026-40864?** Medium severity, with a CVSS score of 5.4, published 22 May 2026.

**Which products and versions are affected?** jupyterhub (PyPI) >= 4.1.0, < 5.4.5, ECOSYSTEM:introduced=4.1.0,fixed=5.4.5.

**Is there a fix for CVE-2026-40864?** Yes. jupyterhub (PyPI): upgrade to 5.4.5 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

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

**Am I affected by CVE-2026-40864?** Check whether you run jupyterhub (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

- jupyterhub (PyPI): upgrade to 5.4.5 or later

  ```sh
  pip install "jupyterhub>=5.4.5"
  ```


## Technical details

A Cross-Site Request Forgery (CSRF/XSRF) vulnerability exists in JupyterHub due to an improper implementation of origin checks. The application incorrectly identifies requests containing the 'Sec-Fetch-Mode: no-cors' header as same-origin requests, effectively bypassing XSRF validation for HTTP form endpoints like /hub/spawn and /hub/accept-share. An attacker can exploit this by inducing a victim to submit a cross-origin POST request. This allows the attacker to trigger server spawns or force a user to accept a server share from the attacker. The JSON API is not affected. The issue is resolved in version 5.4.5.

## Affected products

- jupyterhub jupyterhub >= 4.1.0, < 5.4.5

## Identifiers

- CVE-2026-40864
- GHSA-m68r-v472-jgq9
- PYSEC-2026-2189

## Timeline

- 2026-05-05: disclosed
- 2026-05-05: advisory
- 2026-05-05: patched

## References

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

## Related threats

- [JupyterHub unauthenticated denial of service in login form handling](https://junglewise.ai/threats/cve-2026-54338-jupyterhub-unauthenticated-denial-of-service-in-login-form)
- [PYSEC-2026-1480 - Cross site scripting (XSS) in JupyterHub via Self-XSS leveraged by Cookie Tossing](https://junglewise.ai/threats/cve-2024-28233-cross-site-scripting-xss-in-jupyterhub-via-self-xss-leveraged-by)
- [PYSEC-2026-647 - Open Redirect vulnerability in jupyterhub and notebook](https://junglewise.ai/threats/cve-2019-10255-open-redirect-vulnerability-in-jupyterhub-and-notebook)
- [Jupyter JupyterHub open redirect vulnerability](https://junglewise.ai/threats/cve-2026-33709-jupyter-jupyterhub-open-redirect-vulnerability)
- [JupyterHub has a privilege escalation vulnerability with the `admin:users` scope](https://junglewise.ai/threats/cve-2024-41942-jupyterhub-has-a-privilege-escalation-vulnerability-with-the)
