Aug 8, 2026·5 min read·3 visits
Unauthenticated remote attackers can cause complete Denial of Service (DoS) in Hono applications running versions 4.12.0 to 4.12.33 by sending excessively long hyphen-separated language strings in headers, cookies, or query parameters.
An Algorithmic Complexity Denial of Service (DoS) vulnerability exists in the Hono web application framework within its languageDetector middleware. From version 4.12.0 to 4.12.33, the progressive language-tag truncation routine (normalizeLanguage) performs string operations with a quadratic time complexity O(N^2) relative to the number of hyphen-separated subtags in the user-supplied language tag. This allows an unauthenticated remote attacker to cause resource exhaustion and CPU spikes, resulting in a full denial of service of the single-threaded JavaScript runtime.
The Hono web application framework provides a languageDetector middleware designed to parse language tags and match client preferences against a developer-defined array of supported languages. This functionality is crucial for internationalization, allowing applications to dynamically serve content customized to the locale of the user.
Within Hono versions 4.12.0 through 4.12.33, the language detection routine implements a progressive truncation mechanism to resolve language matches. This routine exposes an attack surface where an unauthenticated remote attacker can supply a crafted language tag to trigger high resource consumption.
The underlying vulnerability is classified as an Algorithmic Complexity Denial of Service (CWE-407). It occurs when the progressive truncation routine processes incoming language tags containing an excessively large number of hyphen-separated subtags, leading to extreme CPU utilization and blocking behavior.
The root cause of this vulnerability lies in the implementation of the language-tag progressive truncation algorithm in src/middleware/language/language.ts. When a client requests a specific locale, such as en-US-POSIX, the middleware evaluates candidate prefixes by iteratively stripping the right-most subtag to match against developer-defined supported languages.
To perform this operation, the code splits the user-controlled input string compLang into an array using the hyphen delimiter. It then loops backward through this array, performing slice and join operations in each iteration to generate candidate strings. These candidates are subsequently looked up in the supported languages array using indexOf.
This specific sequence of operations introduces a quadratic time complexity O(N^2), where N represents the number of hyphenated segments in the input string. Because JavaScript runtimes operate on a single-threaded event loop, executing hundreds of thousands of string copying and concatenation operations synchronously halts all execution. As a result, the entire server process becomes unresponsive to concurrent HTTP traffic while processing a single malicious request.
To understand the technical mechanics of the flaw, compare the vulnerable implementation with the patched version. The vulnerable implementation in versions 4.12.0 through 4.12.33 relies on an input-driven loop:
// Vulnerable Implementation
const parts = compLang.split('-')
for (let i = parts.length - 1; i > 0; i--) {
// O(i) slice and O(i) join operations within a loop of length N
const candidate = parts.slice(0, i).join('-')
const prefixIndex = compSupported.indexOf(candidate)
if (prefixIndex !== -1) {
return options.supportedLanguages[prefixIndex]
}
}The patched version, implemented in commit f70e2c31684387b3231cc38512a31df6ca76a1c7, reverses the evaluation direction. Instead of truncating the user input, the routine loops over the static, developer-defined array of supported languages:
// Patched Implementation in v4.12.34
let longestMatchIndex = -1
let longestMatchLength = -1
for (let i = 0; i < compSupported.length; i++) {
const candidate = compSupported[i]
if (
candidate.length < compLang.length &&
candidate.length > longestMatchLength &&
compLang.startsWith(candidate) &&
compLang[candidate.length] === '-'
) {
longestMatchIndex = i
longestMatchLength = candidate.length
}
}
if (longestMatchIndex !== -1) {
return options.supportedLanguages[longestMatchIndex]
}This architectural shift bounds the computational complexity to O(M * L), where M is the number of supported languages and L is the length of the matching prefix. Because the developer controls the size of M, the execution time remains small and independent of the attacker's input length.
Exploitation of CVE-2026-71848 requires no privileges or special authentication state. An attacker needs network access to any endpoint exposing the languageDetector middleware. By default, the middleware parses the query string parameter lang, cookies, or the Accept-Language HTTP header, meaning any of these vectors can be utilized.
The payload is constructed by concatenating a single-character subtag with a hyphen repeatedly. For example, a payload sequence such as x- repeated 30,000 times generates a string of 60,000 characters with 30,000 individual segments.
When sent to the target server via curl or fetch, this payload forces the underlying V8 or JavaScript runtime to execute approximately 450 million iterations of copying and joining operations. This blocks the main thread for several seconds, dropping the server's availability to zero for all other clients during that execution window.
The security impact of this vulnerability is a complete Denial of Service (DoS) for the affected service instance. Because Hono is highly optimized for serverless, edge, and containerized environments, the severity of the impact depends on the hosting runtime environment.
In containerized and persistent server environments (such as Node.js or Bun running on virtual machines or Kubernetes), a continuous stream of such requests will saturate the server's CPU. This results in prolonged downtime and forces manual scaling or service restarts to recover availability.
In serverless environments (such as Cloudflare Workers or AWS Lambda), individual execution limits or timeout thresholds may terminate the blocked worker. However, this still leads to increased latency, potential cost inflation due to CPU usage bills, and localized denial of service during execution peaks.
The recommended remediation is to upgrade the Hono framework dependency to version 4.12.34 or later. This replaces the vulnerable loop with the safer configuration-driven prefix checking routine.
For environments where immediate upgrading is not possible, security teams should implement edge-level mitigations. Specifically, configure web application firewalls (WAF) or reverse proxies to enforce limits on maximum header sizes and query string lengths.
Additionally, a custom regex rule can be deployed at the API gateway to filter out incoming requests containing excessive hyphenated patterns. A rule pattern such as ([a-zA-Z0-9]+-){50,} can effectively detect and drop anomalous language strings before they reach the Node.js or serverless execution layer.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
hono honojs | >= 4.12.0, <= 4.12.33 | 4.12.34 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-407 (Inefficient Algorithmic Complexity) |
| Attack Vector | Network (AV:N) |
| CVSS Score | 5.3 |
| Exploit Status | Proof of Concept (PoC) available |
| KEV Status | Not Listed |
| Impact | Denial of Service (DoS) |
The program uses an algorithm with an inefficient complexity that can be triggered by a specific input, leading to excessive CPU consumption.
A technical analysis of the use-after-free (UAF) vulnerability in the Ruby JSON gem (CVE-2026-71847) that impacts versions 2.20.0 through 2.21.1. This vulnerability occurs when parsing incomplete stream data containing duplicate keys.
A vulnerability in the Hono framework's Proxy Helper allows the exposure of connection-scoped, internal, or session-specific metadata to unauthorized actors. The proxy helper fails to remove header fields dynamically listed in the response's Connection header, violating RFC 9110 Section 7.6.1.
A session data exposure vulnerability in the Hono web application framework (hono/jsx module) allows consecutive users to receive cached HTML outputs containing private data. When JSX components wrapped in `memo()` are rendered on the server, the caching mechanism utilizes a module-level closure that persists across independent HTTP requests. When subsequent requests occur with matching props, the components are not re-evaluated, and cached HTML is served. If these components read request-scoped or session-specific data via ambient APIs, the data of the first user is exposed to subsequent users.
A severe, twelve-year-old cryptographic weakness in crypto-js (versions < 4.0.0) generated pseudorandom numbers using a custom Multiply-With-Carry (MWC) algorithm seeded from the non-secure Math.random(). This reduces 128-bit and 256-bit key spaces to just 2^39 and 2^47 possibilities, allowing offline brute-force attacks.
An uncontrolled resource consumption vulnerability (CWE-400) exists in pypdf prior to version 6.15.0. When extracting text from a specially crafted PDF document, the parser fails to restrict token lengths within /ToUnicode CMap streams, causing unbounded memory allocation and process termination via Out-of-Memory (OOM) crashes.
A Denial of Service (DoS) vulnerability exists in pypdf prior to version 6.15.0. When parsing maliciously crafted PDF files containing excessively large CID font width ranges, the library suffers from CPU starvation and memory exhaustion due to unconstrained loop expansion.