Next.js Cross-Site Scripting Vulnerability in BeforeInteractive Scripts

Vulnerability

A cross-site scripting vulnerability has been identified in Next.js, a React framework for full-stack web applications. This issue affects versions 13.0.0 prior to 15.5.16 and 16.0.0 prior to 16.2.5. The vulnerability arises when applications use beforeInteractive scripts with untrusted content, allowing attacker-controlled input to escape the intended script context and execute arbitrary JavaScript in a user's browser. The problem stems from serialized script content not being properly escaped before being added to the document.

Impact

Exploitation allows for cross-site scripting, where an attacker can execute arbitrary JavaScript in the context of the user's browser.

Remediation

Users can upgrade to Next.js versions 15.5.16 or 16.2.5, where this vulnerability is fixed. If an immediate upgrade is not possible, it is advised to avoid passing untrusted data into beforeInteractive scripts or to sanitize or escape the content before embedding it.

Added: May 13, 2026, 7:47 PM
Updated: May 13, 2026, 7:47 PM

Vulnerability Rating

Custom Algorithm
spread
5.2
impact
1.7
exploitability
6.5
remediation
8.3
relevance
8.2
threat
0.0
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.