Skip to content

GHSA-3vhc-576x-3qv4 CVE-2026-22818

Hono JWK Auth Middleware has JWT algorithm confusion when JWK lacks "alg" (untrusted header.alg fallback)

Medium npm
Severity
8.2 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.14%
Chance of exploitation in the next 30 days. Higher than 3.14% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-347 Improper Verification of Cryptographic Signature
Fix
4.11.4
Upgrade hono to this version or later

Description

Summary

A flaw in Hono’s JWK/JWKS JWT verification middleware allowed the algorithm specified in the JWT header to influence signature verification when the selected JWK did not explicitly define an algorithm. This could enable JWT algorithm confusion and, in certain configurations, allow forged tokens to be accepted.

Details

When verifying JWTs using JWKs or a JWKS endpoint, the middleware selected the verification algorithm based on the JWK’s alg field if present. If the JWK did not specify an algorithm, the middleware fell back to using the alg value provided in the unverified JWT header.

Because the alg field in a JWK is optional and commonly omitted in real-world JWKS configurations, this behavior could allow an attacker to influence which algorithm is used for verification. In some environments, this may result in authentication or authorization bypass through crafted JWTs.

The practical impact depends on application configuration, including which algorithms are accepted and how JWTs are used to make authorization decisions.

Impact

In affected configurations, an attacker may be able to forge JWTs with attacker-controlled claims, potentially leading to authentication or authorization bypass.

Applications that do not use the JWK/JWKS middleware, do not rely on JWT-based authentication, or explicitly restrict allowed algorithms are not affected.

Resolution

Update to the latest patched release.

Breaking change:

The JWK/JWKS JWT verification middleware has been updated to require an explicit allowlist of asymmetric algorithms when verifying tokens. The middleware no longer derives the verification algorithm from untrusted JWT header values.

Instead, callers must explicitly specify which asymmetric algorithms are permitted, and only tokens signed with those algorithms will be accepted. This prevents JWT algorithm confusion by ensuring that algorithm selection is fully controlled by application configuration.

As part of this fix, the alg option is now required when using the JWK/JWKS middleware, and symmetric (HS*) algorithms are no longer accepted in this context.

Before (vulnerable configuration)

import { jwk } from 'hono/jwk'

app.use(
  '/auth/*',
  jwk({
    jwks_uri: 'https://example.com/.well-known/jwks.json',
    // alg was optional
  })
)

After (patched configuration)

import { jwk } from 'hono/jwk'

app.use(
  '/auth/*',
  jwk({
    jwks_uri: 'https://example.com/.well-known/jwks.json',
    alg: ['RS256'], // required: explicit asymmetric algorithm allowlist
  })
)

Affected versions

npm

PackageVulnerableFixed in
hono
< 4.11.4
4.11.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

hono npm → 4.11.4

npm
npm install hono@4.11.4
yarn
yarn add hono@4.11.4
pnpm
pnpm add hono@4.11.4

Severity breakdown

CVSS 3.1 8.2

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
High
Availability
None

Weakness

CWE-347: Improper Verification of Cryptographic Signature

The product does not verify, or incorrectly verifies, the cryptographic signature for data.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-5r4p-p66f-jhc7
Hono: `serveStatic` decodes the request path a second time, leading to bypass of middleware on static paths
Medium Also affects hono
GHSA-hxh3-vqpv-xpqv
hono/jsx renders plain strings unescaped in boundary components, leading to XSS
Low Also affects hono
GHSA-gqvv-2mrq-wpjv
Hono: Incomplete fix for CVE-2026-39408: `toSSG()` still writes files outside the output directory
Medium Also affects hono
GHSA-g6gw-c38x-mqfc
Hono: Unbounded dot-notation nesting in `parseBody()` can cause memory exhaustion
Medium Also affects hono
GHSA-crvj-82cr-hjcx
Hono: Query parser reads parameters after the URL fragment, causing cache-key and proxy interpretation differentials
Medium Also affects hono
GHSA-f23p-vx2j-j53r
Hono: `memo()` retains SSR output across requests, leading to cross-user data disclosure
Medium Also affects hono
GHSA-79qm-7rj5-m7r9
Hono: Proxy Helper does not remove response headers listed in the `Connection` header
Low Also affects hono
GHSA-54fx-42gc-7vw4
Hono: Algorithmic Complexity DoS in Language Middleware
Medium Also affects hono
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor