NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2026-44580: Next.js has cross-site scripting in beforeInteractive scripts with untrusted input

mediumCVSS 3.1 6.1GHSA-gx5p-jg67-6x7h

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.

Published May 11, 2026 · Updated May 14, 2026

Affected packages

next

Ecosystem
npm
Affected
>= 13.0.0, < 15.5.16
Fixed in
15.5.16
Check
npm ls next

next

Ecosystem
npm
Affected
>= 16.0.0, < 16.2.5
Fixed in
16.2.5
Check
npm ls next

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More npm vulnerabilities

All npm entries