JOSE library allows forged JWT tokens (CVE-2026-34240)
CVE-2026-34240
JOSE is a Javascript Object Signing and Encryption (JOSE) library. Prior to version 0.3.5+1, a vulnerability in jose could allow an unauthenticated, remote attacker to forge valid JWS/JWT tokens by us...
Overview
A critical vulnerability in the JOSE (Javascript Object Signing and Encryption) library allows attackers to forge trusted digital signatures. This flaw, tracked as CVE-2026-34240, undermines the core security promise of JSON Web Tokens (JWTs) and signed objects.
Vulnerability Details
In affected versions (prior to 0.3.5+1), the library’s key selection logic contains a fundamental flaw. During token verification, the system would incorrectly accept a public key embedded directly within the token’s JOSE header (a jwk parameter) as a valid verification key, even if that key was not pre-approved in the application’s trusted key store.
Since an attacker fully controls the token header, they can create a malicious token, embed their own public key, and sign the token with the corresponding private key. The vulnerable library will then use the attacker’s embedded public key to verify their own signature, incorrectly validating the token as genuine.
Impact
The impact is severe for any application using the affected JOSE library to verify JWS or JWT tokens for authentication or data integrity. An unauthenticated remote attacker could forge tokens with any payload, such as creating administrator accounts, accessing another user’s data, or bypassing authorization checks entirely. The attack requires no user interaction and has low complexity.
Remediation and Mitigation
The primary fix is to immediately upgrade the JOSE library to version 0.3.5+1.
If immediate upgrading is not possible, implement the following workaround in your application code: Configure your token verification logic to reject any token where a jwk (JSON Web Key) parameter is present in the header, unless that exact key is already found within your application’s pre-configured, trusted key store. This workaround enforces the correct security model where trust is established out-of-band, not from the token itself.
For more on the consequences of authentication bypasses, recent incidents are detailed in our breach reports.
## Security Insight
This vulnerability is a classic example of a trust boundary violation, reminiscent of past JWT library flaws like the “alg:none” issue. It highlights a persistent challenge in cryptographic library design: ensuring the verification logic strictly adheres to the principle that all inputs from an untrusted source-including header parameters-must be distrusted by default. This incident underscores the necessity for rigorous security reviews of dependency updates, even in mature security-focused libraries. Stay informed on such trends through our security news.
Further Reading
Never miss a critical vulnerability
Get real-time security alerts delivered to your preferred platform.
Am I Affected by CVE-2026-34240?
Pick an ecosystem, paste your installed version, and we'll compare it against the fixed version published on OSV.dev. Browser-only — nothing is sent to a server.
Heuristic comparison only. Always cross-check against the vendor advisory before making patching decisions.
Related Advisories
OpenClaw before 2026.3.12 contains an authentication bypass vulnerability in Feishu webhook mode when only verificationToken is configured without encryptKey, allowing acceptance of forged events. Una...
A condition in ScreenConnect may allow an actor with access to server-level cryptographic material used for authentication to obtain unauthorized access, including elevated privileges, in certain scen...
Authlib is a Python library which builds OAuth and OpenID Connect servers. Prior to version 1.6.9, a JWK Header Injection vulnerability in authlib's JWS implementation allows an unauthenticated attack...
Postiz is an AI social media scheduling tool. Prior to version 2.21.6, a file upload validation bypass allows any authenticated user to upload arbitrary HTML, SVG, or other executable file types to th...