GitHub Advisoryadvisory · npm
GHSA-gx5p-jg67-6x7h Next.js has cross-site scripting in beforeInteractive scripts with untrusted input
MEDIUM
Official page ↗
- Aliases
- CVE-2026-44580
- Ecosystem
- npm
- Packages
- next
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Weaknesses
- CWE-79
- Reviewed
- 2026-05-11
Affected packages
• npm next: >= 13.0.0, < 15.5.16 → fixed in 15.5.16
• npm next: >= 16.0.0, < 16.2.5 → fixed in 16.2.5
Description
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.
Related
Alias · CVE (1)
- CVE-2026-44580 Next.js is a React framework for building full-stack web applications. vulnerability
Weakness · CWE (1)
- CWE-79 Improper Neutralization of Input During Web Page Generation weakness