Next.js CVE-2026-44580
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify Next.js application accepting user input
-
DeliveryLocate beforeInteractive script usage with dynamic content
-
ExploitInject malicious JavaScript breaking script boundary
-
ExecutionExecute arbitrary code in visitor browser
-
ImpactSteal session tokens or perform unauthorized actions
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The vulnerability exists only when an application passes untrusted user-controlled content (from form inputs, URL parameters, database fields, API responses, or any external source) directly into beforeInteractive script features without prior sanitization or escaping. Default Next.js installations that do not use beforeInteractive scripts are not affected. Applications that use beforeInteractive only with hardcoded, server-generated, or trusted internal data are not vulnerable. The vulnerability requires that the untrusted content be embedded as a string within an inline script context in the HTML head, not merely loaded as an external script. Next.js applications that follow secure coding practices of sanitizing or escaping user input before embedding it in scripts, or that use alternative script loading mechanisms (such as next/script with external sources and proper strategy configuration), are not vulnerable. The scope of impact (S:C) indicates that successful exploitation can affect other security domains, making it particularly critical in multi-tenant or user-data-dependent applications. |
| Impact | The CVSS vector AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N indicates a network-accessible vulnerability with low attack complexity, no privilege requirement, and low integrity and confidentiality impact, but requires user interaction (UI:R). This suggests an attacker must craft a malicious application or inject untrusted content that gets served to a visitor's browser. The UI:R flag indicates the vulnerability is not automatically exploitable without a victim visiting a compromised page or one containing injected untrusted data. The CVSS score of 6.1 is moderate, consistent with reflected or stored XSS rather than network-level attacks. The scope change (S:C) indicates impact extends beyond the security scope of the vulnerable component. No public exploit code has been identified, and no active exploitation is documented in CISA KEV, suggesting this remains a patched vulnerability without widespread weaponization. The real-world risk depends entirely on whether applications actually follow the vulnerable pattern of passing untrusted data directly into beforeInteractive scripts - this is a developer misuse vulnerability, not an automatic default exposure. Teams using Next.js should assess whether their applications embed dynamic or user-controlled content in beforeInteractive scripts; if not, immediate patching may be lower priority than for data-driven applications. The moderate CVSS combined with lack of public POC and required user interaction suggests lower real-world urgency compared to remote code execution vulnerabilities, but the criticality of the impact (arbitrary JavaScript execution in user browsers) warrants prompt patching for affected applications. |
| Exploit ScenarioDerived | An attacker identifies a Next.js application that uses beforeInteractive scripts with dynamic content, such as embedding user-provided configuration values, API response data, or database-sourced values into a beforeInteractive script. The attacker submits malicious JavaScript code as user input, such as embedding it in a form field, URL parameter, or API response. When the application renders the page and passes this untrusted content to beforeInteractive without escaping, the malicious script executes in the victim's browser with the same privileges as the legitimate page content, allowing the attacker to steal session cookies, redirect users to phishing sites, or perform actions on behalf of the user. The attack requires the victim to visit the compromised page (reflecting user interaction) but does not require prior authentication or special configuration. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 11, 2026
Cross-site scripting in Next.js beforeInteractive scripts allows remote unauthenticated attackers to execute arbitrary JavaScript in visitor browsers when applications pass untrusted content to beforeInteractive script features. The vulnerability arises from insufficient HTML escaping of serialized script content before embedding into the document, enabling attackers to break out of the script context. Affected versions include 13.0.0 through 15.5.15 and 16.0.0 through 16.2.4; patched versions 15.5.16 and 16.2.5 are available. No public exploit code or active exploitation has been identified at time of analysis, though the CVSS score of 6.1 reflects moderate risk with required user interaction.
RemediationAI
Upgrade Next.js to version 15.5.16 or later for the 15.x branch, or version 16.2.5 or later for the 16.x branch. These versions implement HTML-escaping of serialized beforeInteractive script content, preventing attacker-controlled input from breaking out of the script boundary. The upgrade can be performed via npm update next or by modifying package.json and reinstalling dependencies. If immediate upgrade is not feasible, implement the following compensating controls with noted trade-offs: (1) Do not pass untrusted data (user input, database-sourced content, or API responses) directly into beforeInteractive script features - this is the primary mitigation and involves code review of all beforeInteractive usage; (2) If passing dynamic content to beforeInteractive is unavoidable, manually HTML-escape all untrusted input using libraries like he or xss before embedding, though this shifts responsibility to developers and increases risk of escape failures; (3) Implement Content Security Policy (CSP) with script-src restrictions to limit the impact of successfully injected scripts, though CSP does not prevent inline script execution without nonce or hash whitelisting, which Next.js may not support for dynamically-generated beforeInteractive scripts. Vercel recommends immediate patching as the primary remediation path.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Next.js is a React framework that provides the beforeInteractive script feature for executing JavaScript in the page head before React hydration. The vulnerability exists in how Next.js serializes and embeds beforeInteractive script content into the HTML document. When application code passes untrusted user input (such as from database queries, API responses, or URL parameters) directly into beforeInteractive script payloads, the framework failed to properly HTML-escape the content before inserting it into inline script tags. This is a classic DOM-based XSS vulnerability (CWE-79) where unsafe string concatenation allows malicious input containing script delimiters or JavaScript syntax to escape the intended script context and execute arbitrary code in the visitor's browser. The vulnerability is specific to the beforeInteractive feature and does not affect other Next.js script loading mechanisms that properly handle content sanitization.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Primary rating from Vendor (https://github.com/vercel/next.js).
CVSS VectorVendor: https://github.com/vercel/next.js
DescriptionCVE.org
Impact
Applications that use beforeInteractive scripts together with untrusted content can be vulnerable to cross-site scripting. In affected versions, serialized script content was not escaped safely before being embedded into the document, which could allow attacker-controlled input to break out of the intended script context and execute arbitrary JavaScript in a visitor's browser.
Fix
We now HTML-escape serialized beforeInteractive script content before embedding it into the page, preventing attacker-controlled content from breaking out of the inline script boundary.
Workarounds
If you cannot upgrade immediately, do not pass untrusted data into beforeInteractive scripts. If that pattern is unavoidable, sanitize or escape the content before embedding it.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
GHSA-gx5p-jg67-6x7h
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB