CVE-2025-30218: Next.js may leak x-middleware-subrequest-id to external hosts
1.7
CVSS Score
4.0
Basic Information
CVE ID
GHSA ID
EPSS Score
0.19919%
CWE
Published
4/2/2025
Updated
4/3/2025
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
next | npm | = 12.3.5 | 12.3.6 |
next | npm | = 13.5.9 | 13.5.10 |
next | npm | = 14.2.25 | 14.2.26 |
next | npm | = 15.2.3 | 15.2.4 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key behaviors visible in the provided code snippets: 1) The middlewareSubrequestId
is stored in global scope without proper isolation, and 2) The x-middleware-subrequest-id
header is added to all fetch requests regardless of destination. The primary vulnerable function is the request handler that adds the header to outgoing requests (NextMiddleware.run
), while the global storage mechanism (MiddlewareRequestHandler.processRequest
) enables the leakage. These would appear in runtime profiles during middleware execution and external fetch operations.