Skip to content

[GHSA-9gxv-x7rp-r2hc] gree/jose - "None" Algorithm treated as valid in tokens#8014

Open
RainSignal wants to merge 1 commit into
RainSignal/advisory-improvement-8014from
RainSignal-GHSA-9gxv-x7rp-r2hc
Open

[GHSA-9gxv-x7rp-r2hc] gree/jose - "None" Algorithm treated as valid in tokens#8014
RainSignal wants to merge 1 commit into
RainSignal/advisory-improvement-8014from
RainSignal-GHSA-9gxv-x7rp-r2hc

Conversation

@RainSignal

Copy link
Copy Markdown

Updates

  • Affected products
  • CWEs

Comments

  1. Patched version exists (2.2.1)

The advisory states no solution is available, but version 2.2.1
contains a fix. The patch can be verified at:
https://github.com/nov/jose-php/blob/2.2.1/src/JOSE/JWS.php

The fix in 2.2.1 addresses the algorithm confusion attack in
_verify() by adding a $using_autodetected_alg flag. When the
algorithm is auto-detected from the JWT header (i.e. $expected_alg
is not explicitly provided by the caller), HMAC algorithms (HS256,
HS384, HS512) are now explicitly rejected with an exception:
"HMAC algs MUST be explicitly specified as $expected_alg"

This prevents attackers from changing the algorithm in the JWT
header from RS256 to HS256 and using the public key as the HMAC
secret to forge a valid signature.

  1. Additional fix: timing attack

Version 2.2.1 also fixes a timing attack vulnerability by replacing
direct string comparison (===) with hash_equals() for HMAC
signature verification, preventing timing-based side-channel attacks.

  1. Description is incorrect

The current description refers to vulnerabilities in other JWT
libraries (node-jsonwebtoken, pyjwt, namshi/jose, php-jwt, jsjwt)
and does not describe the actual vulnerability in gree/jose. The
correct description should be:

The _verify() method in JOSE_JWS trusts the algorithm specified
in the JWT header when $expected_alg is not explicitly provided
by the caller. This allows an attacker to change the algorithm
from RS256 to HS256 in the token header and sign the token using
the server's public key as the HMAC secret, bypassing signature
verification entirely.

Copilot stopped work on behalf of RainSignal due to an error June 11, 2026 18:07
@github-actions github-actions Bot changed the base branch from main to RainSignal/advisory-improvement-8014 June 11, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant