Skip to main content

Next.js CVE-2026-44580

MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-05-11 https://github.com/vercel/next.js GHSA-gx5p-jg67-6x7h
6.1
CVSS 3.1 · Vendor: https://github.com/vercel/next.js
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify Next.js application accepting user input
  2. Delivery
    Locate beforeInteractive script usage with dynamic content
  3. Exploit
    Inject malicious JavaScript breaking script boundary
  4. Execution
    Execute arbitrary code in visitor browser
  5. Impact
    Steal 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

npm next fix: 15.5.16, 16.2.5

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

Vendor (https://github.com/vercel/next.js) PRIMARY 6.1 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Red Hat 6.1 MEDIUM

Primary rating from Vendor (https://github.com/vercel/next.js).

CVSS VectorVendor: https://github.com/vercel/next.js

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

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

EPSS Score
0.0%
Top 99% exploitable
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment GHSA Vendor CIRCL GitHub VulDB

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Affected Products (CPE)CVE.org

pkg:npm/next
pkg:npm/next

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy