CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Dashboard
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-22817
8.20.02%

Trust Issues: Hono JWT Algorithm Confusion (CVE-2026-22817)

Alon Barad
Alon Barad
Software Engineer

Feb 20, 2026·7 min read·19 visits

PoC Available

Executive Summary (TL;DR)

Hono's JWT middleware implicitly trusted the algorithm specified in the incoming token header. Attackers can force the server to verify a token using 'HS256' with the server's own public key as the secret, effectively bypassing authentication. Fixed in version 4.11.4.

A critical authentication bypass in the Hono web framework allows attackers to forge JSON Web Tokens (JWTs) by confusing the verification middleware. By swapping the cryptographic algorithm from asymmetric (RS256) to symmetric (HS256) and signing the token with the victim's public key, an attacker can gain administrative access without a valid private key.

The Hook: A Classic Resurrection

In the world of web security, some vulnerabilities are like zombies—they just refuse to stay dead. Enter CVE-2026-22817, a classic 'Algorithm Confusion' attack targeting the Hono web framework. If you thought we left this class of bugs back in 2015 along with non-responsive layouts and Flash players, I have bad news for you.

Hono has been gaining massive traction in the JavaScript/TypeScript ecosystem for its speed and standards-based approach. It runs everywhere—Cloudflare Workers, Bun, Node.js, Deno. It is the darling of the edge computing world. But in version 4.11.3 and earlier, its JWT (JSON Web Token) middleware harbored a flaw that is almost nostalgic in its simplicity.

The vulnerability allows an attacker to look at your application, which is securely configured to use high-end asymmetric cryptography (RSA), and politely ask it to downgrade to a simple symmetric check using a key the attacker already possesses. It’s the cryptographic equivalent of a bank vault that opens if you just scribble 'I am the manager' on a sticky note and paste it to the door.

The Flaw: Symmetric-Asymmetric Confusion

To understand this exploit, you have to understand how JWT libraries decide how to verify a signature. A JWT header contains an alg field, which tells the recipient which mathematical operation was used to sign the token. Common values are RS256 (Asymmetric) and HS256 (Symmetric).

In an RS256 setup, the server holds a Private Key (secret) to sign tokens and distributes a Public Key (open to the world) so anyone can verify them. In an HS256 setup, the server uses a single shared secret to both sign and verify.

The flaw in Hono's middleware was a lack of conviction. If the developer didn't strictly enforce a specific algorithm in their configuration, the middleware looked at the incoming token's header to decide what to do. This is a fatal mistake.

When an attacker changes the header to alg: HS256, the middleware switches logic. Instead of treating the configured key as an RSA Public Key (for verification only), it treats the binary data of that Public Key as a shared HMAC secret. Since the Public Key is public, the attacker has it. They can then sign their own forged admin token using HMAC-SHA256 with the Public Key as the password. The server, seeing HS256 in the header and holding the Public Key, performs the same math, gets a match, and grants access.

The Code: Trusting the Untrustworthy

Let's look at the logic that caused this mess. The vulnerability existed because the middleware prioritized flexibility over security, allowing the incoming packet to dictate the terms of engagement.

In the vulnerable versions, the code logic (simplified) looked something like this:

// Vulnerable Logic Pseudocode
const algorithmToUse = config.alg || tokenHeader.alg;
 
if (algorithmToUse === 'HS256') {
  verifyHmac(token, key);
} else if (algorithmToUse === 'RS256') {
  verifyRsa(token, key);
}

Do you see the issue? If config.alg wasn't explicitly set by the developer (which was optional), the variable algorithmToUse fell back to tokenHeader.alg—a value controlled entirely by the attacker.

The fix in v4.11.4 introduces a strict mismatch check. It basically says, "I don't care what the token claims to be; if it doesn't match what I expect, throw it in the trash."

// The Fix in Hono v4.11.4
if (header.alg !== alg) {
  throw new JwtAlgorithmMismatch(alg, header.alg);
}
 
// Specific hardening for JWK (JSON Web Keys)
if (symmetricAlgorithms.includes(header.alg)) {
  throw new JwtSymmetricAlgorithmNotAllowed(header.alg);
}

This simple check kills the attack dead. Even if the attacker sends a validly signed HS256 token, the server checks its config, sees it expects RS256, and throws a JwtAlgorithmMismatch error before even attempting the crypto math.

The Exploit: Forging the Golden Ticket

Let's walk through a practical attack scenario. Imagine a target application running on Cloudflare Workers using Hono. It uses Auth0 or a similar provider, so it exposes a .well-known/jwks.json endpoint containing its RSA public keys.

Step 1: Reconnaissance

The attacker browses to https://target-app.com/.well-known/jwks.json and downloads the RSA Public Key. It looks like a standard JSON object containing a modulus (n) and exponent (e).

Step 2: The Setup

The attacker captures a valid JWT from the application. It looks like this: eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiYWRtaW4iOmZhbHNlfQ.Signature...

Step 3: Modification

The attacker decodes the token and changes the payload to give themselves superpowers:

{
  "sub": "hacker",
  "admin": true
}

Crucially, they change the header to lie about the algorithm:

{
  "alg": "HS256",
  "typ": "JWT"
}

Step 4: The Signature

Here is the magic trick. The attacker takes the RSA Public Key they downloaded in Step 1. They convert it to a string format (usually PEM) and use that string as the secret key for an HMAC-SHA256 signature.

// Attacker's script
const forgedToken = jwt.sign(
  { sub: 'hacker', admin: true },
  publicKeyPEM, // Using the PUBLIC key as a SECRET
  { algorithm: 'HS256' }
);

Step 5: Execution

The attacker sends this forged token to the Hono app. The app receives the header HS256. It looks at its config, sees the Public Key. It thinks, "Okay, I'll verify this HMAC using the key I have." The math aligns perfectly. The attacker is logged in as Admin.

The Impact: Why This Matters

The CVSS score of 8.2 implies high severity, but the practical impact is often total system compromise. Because JWTs are typically used for stateless authentication, bypassing the signature check allows an attacker to become anyone.

  • Identity Spoofing: Log in as the CEO, the administrator, or a support agent.
  • Privilege Escalation: Access endpoints restricted to specific roles (e.g., /admin/delete_user).
  • Data Exfiltration: If the JWT contains scopes or permissions for accessing other microservices, the attacker can pivot laterally through the infrastructure.

This isn't just a "theoretical" crypto bug. It works reliably against any system where the developer relied on defaults and didn't hardcode the expected algorithm. In the fast-moving world of JS frameworks, developers often copy-paste middleware configs without second-guessing the optional parameters.

The Fix: Closing the Loophole

If you are running Hono, stop reading and run npm update hono. The fix was released in version 4.11.4 on January 13, 2026.

Beyond just updating, this is a lesson in explicit configuration. Never rely on the "magic" of a library to guess your cryptographic intent. Explicit is better than implicit.

Remediation Steps:

  1. Update Hono: Ensure you are on v4.11.4 or higher.
  2. Enforce Algorithms: In your code, specifically tell the JWT middleware which algorithm you expect. Do not leave it undefined.
// BAD: Vulnerable to confusion if defaults are loose
app.use('/api/*', jwt({ secret: publicKey }))
 
// GOOD: Explicitly locks the algorithm
app.use('/api/*', jwt({ secret: publicKey, alg: 'RS256' }))

If you are using JWKs (JSON Web Key Sets), the new version forces you to provide an allowedAlgorithms whitelist or strictly rejects symmetric algorithms when fetching keys from a remote source. This prevents the library from ever attempting an HMAC verification when it should be doing RSA.

Official Patches

HonoOfficial GitHub Advisory and Fix Details

Fix Analysis (1)

Technical Appendix

CVSS Score
8.2/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N
EPSS Probability
0.02%
Top 96% most exploited

Affected Systems

Hono Web Framework (Node.js)Hono Web Framework (Bun)Hono Web Framework (Cloudflare Workers)Hono Web Framework (Deno)

Affected Versions Detail

Product
Affected Versions
Fixed Version
hono
honojs
< 4.11.44.11.4
AttributeDetail
CWE IDCWE-347
Attack VectorNetwork (Remote)
CVSS Score8.2 (Critical)
Exploit StatusPoC Available
ImpactAuthentication Bypass
EPSS Score0.017%

MITRE ATT&CK Mapping

T1550.004Use Alternate Authentication Material: Web Cookies
Defense Evasion
T1078Valid Accounts
Defense Evasion
CWE-347
Improper Verification of Cryptographic Signature

Improper Verification of Cryptographic Signature

Known Exploits & Detection

Hono GitHub RepositoryTest case demonstrating the algorithm confusion attack included in the fix commit.

Vulnerability Timeline

Vulnerability identified
2026-01-12
Patch released in v4.11.4
2026-01-13
Public disclosure via GHSA
2026-01-13

References & Sources

  • [1]GHSA-f67f-6cw9-8mq4: JWT Algorithm Confusion in Hono
  • [2]Understanding JWT Algorithm Confusion Attacks

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.