The vulnerability, CVE-2026-40864, is a Cross-Site Request Forgery (CSRF) bypass in JupyterHub. The root cause was an error in the logic that determines whether an XSRF check is necessary. The analysis of the provided patches, specifically commit 9c5ec277d3cda5a59de2d8c8117efa77bd941127, pinpointed the vulnerable function as _needs_check_xsrf located in jupyterhub/_xsrf_utils.py. The patch explicitly removes the string 'no-cors' from a condition that checks the 'Sec-Fetch-Mode' request header. In the vulnerable versions, the presence of Sec-Fetch-Mode: no-cors caused the XSRF check to be skipped. Since cross-origin form POSTs are sent with this header, it created a CSRF vulnerability. An attacker could host a malicious form on an external website that, when submitted by a logged-in JupyterHub user, would execute actions on their behalf, such as spawning a new server. The fix ensures that requests with Sec-Fetch-Mode: no-cors are no longer exempt from XSRF checks, thereby mitigating the vulnerability.