CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-X7MM-9VVV-64W8

GHSA-X7MM-9VVV-64W8: Reflected Cross-Site Scripting in unhead Streaming SSR

Amit Schendel
Amit Schendel
Senior Security Researcher

Apr 11, 2026·5 min read·22 visits

Executive Summary (TL;DR)

Reflected XSS in unhead's streaming SSR allows unauthenticated attackers to execute arbitrary JavaScript in the victim's browser via an unvalidated streamKey parameter.

The unhead package, specifically its streaming server-side rendering (SSR) functionality, is vulnerable to Reflected Cross-Site Scripting (XSS). The vulnerability stems from improper validation and unsafe string interpolation of the developer-configurable streamKey property when rendering inline JavaScript payload tags for client-side state hydration.

Vulnerability Overview

The unhead library provides document head management for server-side rendered (SSR) JavaScript applications. The streaming SSR implementation synchronizes state between the server environment and the client browser during hydration. This synchronization relies on a developer-configurable identifier known as the streamKey.

GHSA-X7MM-9VVV-64W8 tracks a Cross-Site Scripting (XSS) vulnerability classified under CWE-79: Improper Neutralization of Input During Web Page Generation. The flaw resides in the specific sub-packages responsible for handling streaming SSR, such as @unhead/ssr.

When the streamKey parameter is derived from untrusted input, the application fails to sanitize or validate the string before interpolating it into an inline script tag. The resulting output is rendered directly into the HTML document, permitting unauthenticated attackers to execute arbitrary JavaScript in the context of the user's browser session.

Root Cause Analysis

The vulnerability originates from unsafe string interpolation within the createBootstrapScript function. This function generates a bootstrapping script payload required for the client-side hydration process. The script initializes an array on the global window object using the streamKey variable as the property name.

In the vulnerable implementation, the streamKey string is directly appended to the window. object reference without prior lexical validation. The system implicitly trusts that the provided string strictly conforms to valid JavaScript identifier naming conventions.

If the streamKey configuration relies on dynamically parsed query parameters or multi-tenant headers without intermediary sanitization, an attacker gains direct control over the injected string. The JavaScript parser evaluates the raw input as code, breaking the intended dot-notation assignment and allowing execution of contiguous JavaScript expressions.

Code Analysis

The flaw manifests in packages/unhead/src/stream/server.ts. The original createBootstrapScript function utilized standard template literals to construct the payload.

// Vulnerable implementation example
export function createBootstrapScript(streamKey: string = DEFAULT_STREAM_KEY): string {
  return `<script>window.${streamKey}={_q:[],push(e){this._q.push(e)}}</script>`
}

The remediation, introduced in commit 64b5ac0aa30cc256ea6677ce3dc4f132f81b2ff6, implements strict input validation. The fix introduces a regular expression, VALID_STREAM_KEY_RE, which restricts the streamKey to standard ASCII JavaScript identifiers.

// Patched implementation with validation
const VALID_STREAM_KEY_RE = /^[$_a-z][$\w]*$/i
 
function assertValidStreamKey(streamKey: string): void {
  if (typeof streamKey !== 'string' || !VALID_STREAM_KEY_RE.test(streamKey)) {
    throw new Error(
      `[unhead] Invalid streamKey: must be a valid JavaScript identifier...`
    )
  }
}

The developers injected the assertValidStreamKey validation routine at three distinct lifecycle junctions. The system now validates the key upon entry in createStreamableHead, upon retrieval via getStreamKey, and immediately before code generation in createBootstrapScript. This layered defense strategy prevents malicious payloads from advancing to the rendering stage.

Exploitation

Exploitation requires the attacker to influence the streamKey variable passed to the server-side rendering logic. This precondition is met if an application routes unvalidated request parameters, such as a user-controlled subdomain or URL query string, directly into the unhead configuration object.

An attacker constructs a payload that properly terminates the intended JavaScript statement before initiating an arbitrary function call. A standard proof-of-concept payload utilizes a semicolon to separate expressions, followed by the malicious code and a trailing comment indicator.

Payload structure: __unhead__;alert(1)//

When the SSR engine processes this input, it generates the following HTML output:

<script>window.__unhead__;alert(1)//={_q:[],push(e){this._q.push(e)}}</script>

The browser's JavaScript engine evaluates the first expression, window.__unhead__;, which functions as a valid property access. It subsequently executes the injected function call alert(1). The trailing // converts the remainder of the original bootstrapping template into a comment, circumventing syntax errors that would otherwise halt script execution.

Impact Assessment

Successful exploitation results in Reflected Cross-Site Scripting. Because the injected script executes within the context of the vulnerable application's origin, the attacker inherits the permission scope of the victim's browser session.

The execution allows an attacker to access sensitive DOM elements, extract authentication tokens stored in localStorage or sessionStorage, and hijack active user sessions. Furthermore, the attacker can silently issue unauthorized HTTP requests on behalf of the authenticated user to restricted internal application programming interfaces.

The vulnerability primarily affects end users accessing the compromised uniform resource locator. Administrative users interacting with the malicious link face higher exposure, as session compromise in elevated contexts facilitates broader administrative control over the application infrastructure.

Remediation

The primary remediation strategy requires upgrading the unhead dependency to a version encompassing commit 64b5ac0aa30cc256ea6677ce3dc4f132f81b2ff6. The patch natively rejects any dynamically generated streamKey that contains non-alphanumeric or special characters outside the bounds of the VALID_STREAM_KEY_RE regular expression.

If an immediate dependency upgrade is administratively unfeasible, security engineers must implement input sanitization upstream of the unhead configuration instantiation. All request-derived data mapped to the streamKey parameter must undergo strict validation enforcing an allow-list of known-good identifiers.

Network defense teams can deploy web application firewall rules configured to monitor for anomalous identifier patterns. Specifically, rules targeting the presence of semicolons, parentheses, or comment structures within parameters destined for SSR state hydration endpoints will effectively interrupt exploitation attempts.

Official Patches

unjsCommit 64b5ac0 resolving the streamKey interpolation vulnerability

Fix Analysis (1)

Technical Appendix

CVSS Score
8.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

Affected Systems

unhead@unhead/ssr

Affected Versions Detail

Product
Affected Versions
Fixed Version
unhead
unjs
All versions lacking commit 64b5ac0Version containing commit 64b5ac0
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork
CVSS Score8.1
Exploit StatusProof of Concept
ImpactHigh
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Known Exploits & Detection

Research AnalysisProof of concept payload utilizing inline script comment truncation to achieve execution.

Vulnerability Timeline

Fix commit pushed to repository
2026-04-10

References & Sources

  • [1]GitHub Security Advisory: GHSA-X7MM-9VVV-64W8
  • [2]Fix Commit in unhead repository
  • [3]unhead Project Repository

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•CVE-2026-63462
7.5

CVE-2026-63462: Unauthenticated Stack Overflow Denial of Service in Unleash Server

An unauthenticated remote denial of service vulnerability exists in the Unleash feature management platform. By submitting a crafted JSON payload containing deeply nested structures to an OpenAPI-validated endpoint, an attacker can trigger uncontrolled recursion within the error formatting module. This leads to a call-stack exhaustion (RangeError: Maximum call stack size exceeded) inside the Node.js runtime, causing the service to crash immediately without recovery.

Alon Barad
Alon Barad
11 views•6 min read
•1 day ago•CVE-2026-63004
5.5

CVE-2026-63004: Server-Side Request Forgery in Unleash Addon and Integration Subsystem

CVE-2026-63004 is a server-side request forgery (SSRF) vulnerability in the Unleash feature management platform. Authenticated administrators with CREATE_ADDON or UPDATE_ADDON privileges can exploit this vulnerability to initiate requests to loopback addresses, private networks, and cloud metadata endpoints, potentially leading to information disclosure and credential extraction.

Amit Schendel
Amit Schendel
8 views•8 min read
•1 day ago•CVE-2026-63466
4.1

CVE-2026-63466: Process-Wide Security Degradation via Global Module Mutation in Unleash

Prior to version 8.0.3, Unleash's Markdown event formatter directly mutated the global template-escaping function of the shared mustache Node.js module, resulting in a process-wide security degradation where HTML/Markdown escaping was permanently disabled for the application lifetime.

Alon Barad
Alon Barad
3 views•6 min read
•2 days ago•CVE-2026-76904
9.8

CVE-2026-76904: Unauthenticated SQL Injection in GeoTools PostGIS DataStore Component

A critical SQL injection vulnerability exists in the GeoTools open-source Java library. This vulnerability is situated within the post-processing phase of OGC Filter conversion inside the PostGIS DataStore module. Specifically, the `jsonArrayContains` function does not validate or sanitize its arguments before constructing PostgreSQL SQL/JSON path evaluation queries. An unauthenticated remote attacker can exploit this weakness by submitting crafted filters via standard OGC services like WFS or WMS to execute arbitrary SQL commands on the underlying database system.

Alon Barad
Alon Barad
13 views•5 min read
•2 days ago•CVE-2026-61824
8.2

CVE-2026-61824: High-Severity Cross-Site Scripting (XSS) via Unsanitized Site Extractors in Defuddle

CVE-2026-61824 is a high-severity Cross-Site Scripting (XSS) vulnerability in kepano/defuddle before version 0.19.1. Custom site extractors for platforms such as X/Twitter, Substack, and YouTube constructed HTML representations via template string interpolation without output escaping. This allowed malicious pages to bypass standard parser sanitization routines and execute arbitrary JavaScript.

Amit Schendel
Amit Schendel
6 views•7 min read
•2 days ago•CVE-2026-63421
7.5

CVE-2026-63421: Query Limit Bypass via Negative Integer Input in KeystoneJS core resolvers

A high-severity vulnerability exists in KeystoneJS, a popular Node.js CMS and GraphQL framework, where the query resolution engine fails to validate signed negative integers within the pagination subsystem. Unauthenticated remote attackers can leverage this flaw to bypass the 'graphql.maxTake' safety boundary. By sending large negative values in the 'take' query parameter, the underlying Prisma ORM interprets the value as an instruction to fetch rows from the end of the collection, allowing malicious actors to bypass pagination limits, trigger database resource exhaustion, and execute application-level Denial of Service (DoS) attacks.

Alon Barad
Alon Barad
8 views•6 min read