Description
Next.js is a React framework for building full-stack web applications. From 13.0.0 to before 15.5.16 and 16.2.5, 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. This vulnerability is fixed in 15.5.16 and 16.2.5.
Published: 2026-05-13
Score: 6.1 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Next.js, a React framework, embeds untrusted data into beforeInteractive scripts without proper escaping. The vulnerability, classified as CWE‑79, allows an attacker to inject JavaScript that runs in the victim’s browser when the script content is parsed. This can lead to session hijacking, credential theft, or execution of arbitrary client‑side code.

Affected Systems

Vercel's Next.js framework. Affected releases include all versions from 13.0.0 through 15.5.15 and every 16.x release prior to 16.2.5, as the fix is incorporated in Next.js 15.5.16 and 16.2.5.

Risk and Exploitability

The CVSS score of 6.1 indicates a moderate severity, and there is no EPSS data available, so the likelihood of widespread exploitation is uncertain. The vulnerability can be exploited by inserting attacker‑controlled content into a beforeInteractive script that is later rendered to the page, a scenario that is feasible in typical SSR or S deployments. The reported KEV status indicates it has not yet been cataloged by CISA; however, the nature of the flaw means any vulnerable site that renders untrusted content is at risk of XSS in user browsers.

Generated by OpenCVE AI on May 13, 2026 at 19:55 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update Next.js to version 15.5.16 or newer to incorporate the fixed serialization logic.
  • If an upgrade cannot be performed immediately, remove or enforce strict sanitization on any untrusted content before it is included in beforeInteractive scripts, ensuring that script tags are escaped.
  • Additionally, implement a Content Security Policy that restricts inline scripts and mitigates the impact of any accidental XSS.

Generated by OpenCVE AI on May 13, 2026 at 19:55 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-gx5p-jg67-6x7h Next.js has cross-site scripting in beforeInteractive scripts with untrusted input
History

Thu, 14 May 2026 18:45:00 +0000

Type Values Removed Values Added
CPEs cpe:2.3:a:vercel:next.js:*:*:*:*:*:node.js:*:*

Wed, 13 May 2026 20:15:00 +0000

Type Values Removed Values Added
First Time appeared Vercel
Vercel next.js
Vendors & Products Vercel
Vercel next.js

Wed, 13 May 2026 19:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 13 May 2026 18:00:00 +0000

Type Values Removed Values Added
Description Next.js is a React framework for building full-stack web applications. From 13.0.0 to before 15.5.16 and 16.2.5, 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. This vulnerability is fixed in 15.5.16 and 16.2.5.
Title Next.js: Cross-site scripting in beforeInteractive scripts with untrusted input
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-05-13T18:28:15.512Z

Reserved: 2026-05-06T21:49:12.424Z

Link: CVE-2026-44580

cve-icon Vulnrichment

Updated: 2026-05-13T18:28:06.351Z

cve-icon NVD

Status : Analyzed

Published: 2026-05-13T18:16:18.260

Modified: 2026-05-14T18:33:34.170

Link: CVE-2026-44580

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-05-13T20:00:04Z

Weaknesses