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·31 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

•23 minutes ago•CVE-2026-105749
6.5

CVE-2026-105749: Unbounded Table Attributes in Docling Backends Leads to Resource Exhaustion

An uncontrolled resource consumption vulnerability exists in the Docling document conversion library. Maliciously structured HTML, JATS, ODS, or BoxNote inputs containing table cells with excessively large 'rowspan' or 'colspan' attribute values trigger algorithmic complexity conditions. This allows unauthenticated remote attackers to initiate resource exhaustion states, crashing or hanging the target document processing pipeline while bypassing configured timeouts.

Amit Schendel
Amit Schendel
1 views•6 min read
•about 1 hour ago•CVE-2026-105748
4.3

CVE-2026-105748: Local File Inclusion and Arbitrary File Disclosure in Docling Document Parser

A Local File Inclusion (LFI) and Arbitrary File Disclosure vulnerability exists in Docling and Docling Slim versions >= 2.16.0 up to 2.131.0. When parsing serialized DoclingDocument structures using the JSON input format, the backend fails to restrict image URI schemes, allowing remote attackers to retrieve local files and verify path existence on the host system during embedded document export.

Amit Schendel
Amit Schendel
5 views•5 min read
•about 2 hours ago•CVE-2026-105744
7.5

CVE-2026-105744: Arbitrary File Read and Remote Code Execution in Docling Tectonic Engine

Docling, a tool for parsing and processing diverse document formats, is vulnerable to arbitrary file read, arbitrary file write, and potential remote code execution (RCE) in versions 2.94.0 through 2.131.0. The vulnerability occurs when applications configure Docling to use the Tectonic engine for rendering TikZ diagrams into images. Because the compilation did not restrict hazardous TeX primitives or sandbox the environment, an attacker can supply crafted documents containing malicious TikZ definitions to access or modify local files and execute arbitrary commands under the privileges of the processing application.

Amit Schendel
Amit Schendel
6 views•7 min read
•about 3 hours ago•CVE-2026-105743
4.0

CVE-2026-105743: Server-Side Request Forgery Guard Bypass in Docling Document Conversion Engine

An SSRF guard bypass vulnerability in the Docling document conversion engine allows unauthenticated attackers to bypass internal IP access controls. The vulnerability exists due to a DNS rebinding Time-of-Check Time-of-Use (TOCTOU) condition, URL authority parsing inconsistencies, and unvalidated network requests triggered during headless browser page rendering.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 4 hours ago•CVE-2026-105742
3.7

CVE-2026-105742: Sensitive Custom Header Leakage in Docling Image Resource Loader

A technical analysis of CVE-2026-105742 (GHSA-p3fw-7699-7926), a sensitive information disclosure vulnerability in the Docling document processing library. Vulnerable versions of Docling indiscriminately forward custom HTTP headers, such as authentication tokens, to arbitrary third-party origins and during cross-origin redirects while fetching remote image assets from untrusted HTML and EPUB documents.

Alon Barad
Alon Barad
6 views•6 min read
•about 5 hours ago•CVE-2026-106121
4.9

CVE-2026-106121: Denial of Service via Infinite Loop in RabbitMQ Java Client JSON Parser

CVE-2026-106121 is a Denial of Service (DoS) vulnerability in the RabbitMQ Java Client library (amqp-client) affecting versions prior to 5.37.0. The vulnerability resides in the legacy, custom JSON-RPC parsing class com.rabbitmq.tools.json.JSONReader. When parsing malformed or truncated payloads ending within a quoted string or single-line comment, the parser's scanner enters an infinite loop. This occurs because the loop lacks an exit condition for the end-of-input sentinel character returned by the iterator, leading to either CPU exhaustion or a JVM crash from an OutOfMemoryError.

Amit Schendel
Amit Schendel
8 views•6 min read