Vulnerabilities in pkg:npm/h3
PACKAGECVE-2026-86250 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting H3 libraries in the npm ecosystem. The issue involves unbounded chunked cookie count in session cleanup loop may lead to denial of service. Remediation is available by upgrading affected packages to version 2.0.1-rc.18.
pkg:npm/h3
Vulnerability advisories affecting package pkg:npm/h3. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-q5pr-72pq-83v3 | CVE-2026-86250 | MODERATE | H3: Unbounded Chunked Cookie Count in Session Cleanup Loop may Lead to Denial of Service |
| GHSA-fg72-q65g-wm5w | - | HIGH | Duplicate Advisory: H3: Unbounded Chunked Cookie Count in Session Cleanup Loop may Lead to Denial of Service |
| GHSA-mp2g-9vg9-f4cg | CVE-2026-23527 | HIGH | h3 v1 has Request Smuggling (TE.TE) issue |
| GHSA-2j6q-whv2-gh6w | CVE-2026-33490 | LOW | h3: Missing Path Segment Boundary Check in `mount()` Causes Middleware Execution on Unrelated Prefix-Matching Routes |
| GHSA-fp4x-ggrf-wmc6 | - | MODERATE | H3 has an Open Redirect via Protocol-Relative Path in redirectBack() Referer Validation |
| GHSA-3vj8-jmxq-cgj5 | CVE-2026-33131 | HIGH | h3 has a middleware bypass with one gadget |
| GHSA-26f5-8h2x-34xh | CVE-2026-33129 | MODERATE | h3 has an observable timing discrepancy in basic auth utils |
| GHSA-22cc-p3c6-wpvm | CVE-2026-33128 | HIGH | h3 has a Server-Sent Events Injection via Unsanitized Newlines in Event Stream Fields |
| GHSA-4hxc-9384-m385 | - | MODERATE | h3: SSE Event Injection via Unsanitized Carriage Return (`\r`) in EventStream Data and Comment Fields (Bypass of CVE Fix) |
| GHSA-72gr-qfp7-vwhw | - | MODERATE | h3: Double Decoding in `serveStatic` Bypasses `resolveDotSegments` Path Traversal Protection via `%252e%252e` |
| GHSA-wr4h-v87w-p3r7 | - | MODERATE | h3 has a Path Traversal via Percent-Encoded Dot Segments in serveStatic Allows Arbitrary File Read |
CVE-2026-86250 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2026-86250
To remediate this vulnerability, upgrade all affected H3 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install h3@2.0.1-rc.18
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls h3
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-86250, inspect your project dependencies using npm:
npm ls h3
Analyze the terminal output to locate any version of H3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.1-rc.18), your application is affected.
Note: The npm ls h3 command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In H3, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-86250 Affected H3 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
h3
|
npm |
≥ 2.0.0-beta.4
< 2.0.1-rc.18
|
2.0.1-rc.18
|
References
Frequently Asked Questions
What is CVE-2026-86250?
Which H3 versions are affected?
What version fixes CVE-2026-86250?
Is h3 affected?
What is the CVSS score of CVE-2026-86250?
What CWE is associated with CVE-2026-86250?
How can I check npm dependencies for CVE-2026-86250?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q5pr-72pq-83v3",
"modified" : "2026-09-30T23:46:51Z",
"published" : "2026-03-23T21:44:55Z",
"aliases" : [ "CVE-2026-86250" ],
"summary" : "H3: Unbounded Chunked Cookie Count in Session Cleanup Loop may Lead to Denial of Service",
"details" : "## Summary\n\nThe `setChunkedCookie()` and `deleteChunkedCookie()` functions in h3 trust the chunk count parsed from a user-controlled cookie value (`__chunked__N`) without any upper bound validation. An unauthenticated attacker can send a single request with a crafted cookie header (e.g., `Cookie: h3=__chunked__999999`) to any endpoint using sessions, causing the server to enter an O(n²) loop that hangs the process.\n\n## Details\n\nThe chunked cookie system stores large cookie values by splitting them into numbered chunks. The main cookie stores a sentinel value `__chunked__N` indicating how many chunks exist. When setting a new chunked cookie, the code cleans up any previous chunks that are no longer needed.\n\nThe vulnerability is in `getChunkedCookieCount()` at `src/utils/cookie.ts:244-249`:\n\n```typescript\nfunction getChunkedCookieCount(cookie: string | undefined): number {\n if (!cookie?.startsWith(CHUNKED_COOKIE)) {\n return Number.NaN;\n }\n return Number.parseInt(cookie.slice(CHUNKED_COOKIE.length));\n // No upper bound check — attacker controls this value\n}\n```\n\nThis value is consumed without validation in the cleanup loop of `setChunkedCookie()` at `src/utils/cookie.ts:182-190`:\n\n```typescript\nconst previousCookie = getCookie(event, name); // reads from request headers\nif (previousCookie?.startsWith(CHUNKED_COOKIE)) {\n const previousChunkCount = getChunkedCookieCount(previousCookie);\n if (previousChunkCount > chunkCount) {\n for (let i = chunkCount; i <= previousChunkCount; i++) {\n deleteCookie(event, chunkCookieName(name, i), options);\n // Each deleteCookie → setCookie → scans ALL existing set-cookie headers\n }\n }\n}\n```\n\nThe same issue exists in `deleteChunkedCookie()` at `src/utils/cookie.ts:227-232`:\n\n```typescript\nconst chunksCount = getChunkedCookieCount(mainCookie);\nif (chunksCount >= 0) {\n for (let i = 0; i < chunksCount; i++) {\n deleteCookie(event, chunkCookieName(name, i + 1), serializeOptions);\n }\n}\n```\n\n**The exploit chain through sessions:**\n\n1. Attacker sends `Cookie: h3=__chunked__999999` to any session-using endpoint\n2. `getSession()` (`src/utils/session.ts:83`) calls `getChunkedCookie(event, \"h3\")` (line 124)\n3. `getChunkedCookie()` returns `undefined` — the early return at line 153 fires because no actual chunk cookies (e.g., `h3.1`) exist in the request\n4. Since `sealedSession` is undefined, `session.id` remains empty (line 140), triggering `updateSession()` (line 143)\n5. `updateSession()` calls `setChunkedCookie()` with the newly sealed session value (line 179)\n6. Inside `setChunkedCookie()`, `getCookie(event, name)` re-reads the original request cookie `__chunked__999999` at line 182\n7. `previousChunkCount` = 999999, `chunkCount` = 1 (new sealed session is small)\n8. The cleanup loop runs 999,998 iterations, each calling `deleteCookie()` → `setCookie()`\n9. Each `setCookie()` call reads ALL existing `set-cookie` response headers via `getSetCookie()` (line 91) and iterates through them for deduplication (lines 100-106)\n10. This creates O(n²) complexity — approximately 10¹² operations for n=999999\n\n**Key observation:** While `getChunkedCookie()` has an early-return optimization (line 153) that prevents it from looping on missing chunks, the cleanup loops in `setChunkedCookie()` and `deleteChunkedCookie()` have no such protection and run unconditionally for the full claimed chunk count.\n\n## PoC\n\n**Prerequisites:** An h3 application with any endpoint using `getSession()` or `useSession()`.\n\nExample minimal server:\n\n```typescript\nimport { H3 } from \"h3\";\nimport { getSession } from \"h3\";\n\nconst app = new H3();\n\napp.get(\"/dashboard\", async (event) => {\n const session = await getSession(event, {\n password: \"my-secret-password-at-least-32-chars-long!\",\n });\n return { user: session.data.user || \"anonymous\" };\n});\n\nexport default app;\n```\n\n**Attack (single request, no authentication):**\n\n```bash\n# This single request will hang the server process\ncurl -H 'Cookie: h3=__chunked__999999' http://localhost:3000/dashboard\n```\n\nFor a less extreme but still impactful test:\n\n```bash\n# ~100K iterations — will take several seconds and block all other requests\ncurl -H 'Cookie: h3=__chunked__100000' http://localhost:3000/dashboard\n```\n\nThe `deleteChunkedCookie()` path is exploitable via `clearSession()`:\n\n```typescript\napp.post(\"/logout\", async (event) => {\n await clearSession(event, {\n password: \"my-secret-password-at-least-32-chars-long!\",\n });\n return { ok: true };\n});\n```\n\n```bash\ncurl -X POST -H 'Cookie: h3=__chunked__999999' http://localhost:3000/logout\n```\n\n## Impact\n\n- **Complete Denial of Service**: A single unauthenticated request with a 27-byte cookie header can hang the server process indefinitely. Node.js is single-threaded, so this blocks all request handling.\n- **No authentication required**: The attack only requires the ability to send HTTP requests with a crafted cookie header.\n- **Minimal attacker effort**: The payload is trivially small (`Cookie: h3=__chunked__999999`), making it easy to automate or repeat.\n- **Wide attack surface**: Any endpoint in the application that uses `getSession()`, `useSession()`, or `clearSession()` is vulnerable. Session usage is extremely common in web applications.\n- **Amplification**: The ratio of attacker input (27 bytes) to server work (billions of operations) is extreme.\n\n## Recommended Fix\n\nAdd a maximum chunk count constant and validate in `getChunkedCookieCount()`:\n\n```typescript\nconst MAX_CHUNKED_COOKIE_COUNT = 100;\n\nfunction getChunkedCookieCount(cookie: string | undefined): number {\n if (!cookie?.startsWith(CHUNKED_COOKIE)) {\n return Number.NaN;\n }\n const count = Number.parseInt(cookie.slice(CHUNKED_COOKIE.length));\n if (Number.isNaN(count) || count < 0 || count > MAX_CHUNKED_COOKIE_COUNT) {\n return Number.NaN;\n }\n return count;\n}\n```\n\nThis clamps the parsed count at a safe maximum. Since each chunk can hold ~4000 bytes and 100 chunks would allow ~400KB of cookie data (far beyond any practical limit), `MAX_CHUNKED_COOKIE_COUNT = 100` is generous while eliminating the DoS vector.\n\nAdditionally, the callers should be updated to handle `NaN` safely. The cleanup loop in `setChunkedCookie()` already handles this correctly since `NaN > chunkCount` is false, so the loop won't execute. The `deleteChunkedCookie()` loop also handles it since `NaN >= 0` is false.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "h3"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0-beta.4"
}, {
"fixed" : "2.0.1-rc.18"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/h3js/h3/security/advisories/GHSA-q5pr-72pq-83v3"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-86250"
}, {
"type" : "WEB",
"url" : "https://github.com/h3js/h3/commit/399257cb406fbeda313d88c1e288a15124fc82af"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/h3js/h3"
}, {
"type" : "WEB",
"url" : "https://github.com/h3js/h3/releases/tag/v2.0.1-rc.18"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/h3-before-2.0.1-rc.18-denial-of-service-via-unbounded-chunked-cookie"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-23T21:44:55Z",
"nvd_published_at" : null
}
}