CVE-2026-86062
LightRAG: Stored Cross-Site Scripting (XSS) in the LightRAG WebUI chat/answer renderer via ingested content
LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.5.5, lightrag_webui/src/components/retrieval/ChatMessage.tsx renders answer and thinking content with react-markdown, rehypeRaw, and skipHtml=false without an HTML sanitizer. An attacker who can add a document can store raw HTML that is returned through the query path and rendered as active content by MessageMarkdown. A user who later retrieves the content can execute attacker-controlled JavaScript through elements such as an iframe srcdoc; the additional Mermaid securityLevel: loose rendering path also injects generated SVG through innerHTML. The script runs in the LightRAG WebUI origin and can read the API token in localStorage and perform API actions as the victim. This issue is fixed in version 1.5.5.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
6.1
LightRAG: Stored Cross-Site Scripting (XSS) in the LightRAG WebUI chat/answer renderer via ingested content
LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.5.5, lightrag_webui/src/components/retrieval/ChatMessage.tsx renders answer and thinking content with react-markdown, rehypeRaw, and skipHtml=false without an HTML sanitizer. An attacker who can add a document can store raw HTML that is returned through the query path and rendered as active content by MessageMarkdown. A user who later retrieves the content can execute attacker-controlled JavaScript through elements such as an iframe srcdoc; the additional Mermaid securityLevel: loose rendering path also injects generated SVG through innerHTML. The script runs in the LightRAG WebUI origin and can read the API token in localStorage and perform API actions as the victim. This issue is fixed in version 1.5.5.
- Record
CVE-2026-86062- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2026-84550
6.1
LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.5.5, lightrag_webui/src/components/retrieval/ChatMessage.tsx renders answer and thinking content with react-markdown, rehypeRaw, and skipHtml=false without an HTML sanitizer. An attacker who can add a document can store raw HTML that is returned through the query path and rendered as active content by MessageMarkdown. A user who later retrieves the content can execute attacker-controlled JavaScript through elements such as an iframe srcdoc; the additional Mermaid securityLevel: loose rendering path also injects generated SVG through innerHTML. The script runs in the LightRAG WebUI origin and can read the API token in localStorage and perform API actions as the victim. This issue is fixed in version 1.5.5.
- Record
EUVD-2026-84550- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-xpjq-3w4w-w5wr
6.1
lightrag-hku: Stored Cross-Site Scripting (XSS) in the LightRAG WebUI chat/answer renderer via ingested content
Summary
The LightRAG WebUI renders assistant/answer chat content as raw HTML — react-markdown is
configured with rehypePlugins={[rehypeRaw]} and skipHtml={false} and no HTML sanitizer
(rehype-sanitize), element allow-list, or custom urlTransform. Because answer content is derived
from user-ingested documents, an attacker who can add a single document can store an HTML/JavaScript
payload that executes in the browser of any user who later retrieves it (typically an administrator),
leading to auth-token theft from localStorage and full API takeover. No authentication is required in
the default configuration.
Details
Sink — lightrag_webui/src/components/retrieval/ChatMessage.tsx:
- Main answer (
MessageMarkdown, lines ~348-351) and thinking content (lines ~252-272) render withrehypePlugins={[rehypeRaw, …]}andskipHtml={false}. Thecomponentsmap (lines ~111-156) only restyles safe formatting tags (p,h1–h4,ul,ol,li,code); there is norehype-sanitize, noallowedElements/disallowedElements, and no customurlTransform. - Second sink: mermaid is initialized with
securityLevel: 'loose'(line ~433) and the rendered SVG is injected viacontainer.innerHTML = svg(line ~483) +bindFunctions(container).'loose'disables mermaid's output sanitization, so a```mermaidblock in answer content (HTML label /clickdirective) is an additional script-execution path. - Hardening (not code execution): KaTeX is set with
trust: true(lines ~261/~359).\href{javascript:…}is blocked by React 19, but\includegraphics{URL}renders a live remote<img src>(arbitrary external resource load from the victim's browser). Recommendtrust: false.
Source → sink:
POST /documents/text or POST /documents/upload stores the document → POST /query returns it
(verbatim when only_need_context=true, lightrag/api/routers/query_routes.py:27; otherwise echoed by
the LLM) → the response is streamed into assistantMessage.content
(lightrag_webui/src/features/RetrievalView.tsx:340) → rendered by the sink above.
react-markdown's built-in defenses do NOT cover this: it sanitizes href/src URLs (so javascript:
links are blocked) and React ignores string event handlers (so <img onerror> is dropped), but raw
elements such as <iframe srcdoc="…"> and <svg><script> are rendered unchanged and execute.
PoC
Benign, local-only. Tested at commit f3378a3 (v1.5.5) with react@19, [email protected],
[email protected].
Fastest check (code review, ~10s): in ChatMessage.tsx, the <ReactMarkdown> that renders answers
uses rehypePlugins={[rehypeRaw, …]} with skipHtml={false} and no rehype-sanitize / allow-list.
Per react-markdown's own documentation, rehype-raw on untrusted input without rehype-sanitize
allows HTML injection — that is the vulnerability.
Runnable proof (~2 min) — reproduces the exact renderer config and shows it execute in a browser:
mkdir xss-check && cd xss-check
npm init -y
npm install react@19 react-dom@19 react-markdown@10 rehype-raw@7
# save the script below as poc.mjs, then:
node poc.mjs
# open the generated poc.html in any browser (or headless):
# msedge --headless=new --dump-dom "file:///ABS/PATH/poc.html"
poc.mjs:
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
import { writeFileSync } from 'fs';
// Stands in for an assistant answer built from an ingested document.
const answer =
`<iframe srcdoc="<script>` +
`var h=parent.document.createElement('h1');h.style.color='red';` +
`h.textContent='XSS EXECUTED on '+(parent.document.domain||'this page');` +
`parent.document.body.appendChild(h);parent.document.title='XSS-EXECUTED';` +
`<\/script>"></iframe>`;
// EXACT options from ChatMessage.tsx (rehypeRaw + skipHtml:false, no sanitizer):…
- Record
GHSA-xpjq-3w4w-w5wr- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
NVD
6.1
LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.5.5, lightrag_webui/src/components/retrieval/ChatMessage.tsx renders answer and thinking content with react-markdown, rehypeRaw, and skipHtml=false without an HTML sanitizer. An attacker who can add a document can store raw HTML that is returned through the query path and rendered as active content by MessageMarkdown. A user who later retrieves the content can execute attacker-controlled JavaScript through elements such as an iframe srcdoc; the additional Mermaid securityLevel: loose rendering path also injects generated SVG through innerHTML. The script runs in the LightRAG WebUI origin and can read the API token in localStorage and perform API actions as the victim. This issue is fixed in version 1.5.5.
- Record
CVE-2026-86062- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
6.1
LightRAG: Stored Cross-Site Scripting (XSS) in the LightRAG WebUI chat/answer renderer via ingested content
LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.5.5, lightrag_webui/src/components/retrieval/ChatMessage.tsx renders answer and thinking content with react-markdown, rehypeRaw, and skipHtml=false without an HTML sanitizer. An attacker who can add a document can store raw HTML that is returned through the query path and rendered as active content by MessageMarkdown. A user who later retrieves the content can execute attacker-controlled JavaScript through elements such as an iframe srcdoc; the additional Mermaid securityLevel: loose rendering path also injects generated SVG through innerHTML. The script runs in the LightRAG WebUI origin and can read the API token in localStorage and perform API actions as the victim. This issue is fixed in version 1.5.5.
- Record
CVE-2026-86062- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVGHSA-xpjq-3w4w-w5wr
6.1
lightrag-hku: Stored Cross-Site Scripting (XSS) in the LightRAG WebUI chat/answer renderer via ingested content
Summary
The LightRAG WebUI renders assistant/answer chat content as raw HTML — react-markdown is
configured with rehypePlugins={[rehypeRaw]} and skipHtml={false} and no HTML sanitizer
(rehype-sanitize), element allow-list, or custom urlTransform. Because answer content is derived
from user-ingested documents, an attacker who can add a single document can store an HTML/JavaScript
payload that executes in the browser of any user who later retrieves it (typically an administrator),
leading to auth-token theft from localStorage and full API takeover. No authentication is required in
the default configuration.
Details
Sink — lightrag_webui/src/components/retrieval/ChatMessage.tsx:
- Main answer (
MessageMarkdown, lines ~348-351) and thinking content (lines ~252-272) render withrehypePlugins={[rehypeRaw, …]}andskipHtml={false}. Thecomponentsmap (lines ~111-156) only restyles safe formatting tags (p,h1–h4,ul,ol,li,code); there is norehype-sanitize, noallowedElements/disallowedElements, and no customurlTransform. - Second sink: mermaid is initialized with
securityLevel: 'loose'(line ~433) and the rendered SVG is injected viacontainer.innerHTML = svg(line ~483) +bindFunctions(container).'loose'disables mermaid's output sanitization, so a```mermaidblock in answer content (HTML label /clickdirective) is an additional script-execution path. - Hardening (not code execution): KaTeX is set with
trust: true(lines ~261/~359).\href{javascript:…}is blocked by React 19, but\includegraphics{URL}renders a live remote<img src>(arbitrary external resource load from the victim's browser). Recommendtrust: false.
Source → sink:
POST /documents/text or POST /documents/upload stores the document → POST /query returns it
(verbatim when only_need_context=true, lightrag/api/routers/query_routes.py:27; otherwise echoed by
the LLM) → the response is streamed into assistantMessage.content
(lightrag_webui/src/features/RetrievalView.tsx:340) → rendered by the sink above.
react-markdown's built-in defenses do NOT cover this: it sanitizes href/src URLs (so javascript:
links are blocked) and React ignores string event handlers (so <img onerror> is dropped), but raw
elements such as <iframe srcdoc="…"> and <svg><script> are rendered unchanged and execute.
PoC
Benign, local-only. Tested at commit f3378a3 (v1.5.5) with react@19, [email protected],
[email protected].
Fastest check (code review, ~10s): in ChatMessage.tsx, the <ReactMarkdown> that renders answers
uses rehypePlugins={[rehypeRaw, …]} with skipHtml={false} and no rehype-sanitize / allow-list.
Per react-markdown's own documentation, rehype-raw on untrusted input without rehype-sanitize
allows HTML injection — that is the vulnerability.
Runnable proof (~2 min) — reproduces the exact renderer config and shows it execute in a browser:
mkdir xss-check && cd xss-check
npm init -y
npm install react@19 react-dom@19 react-markdown@10 rehype-raw@7
# save the script below as poc.mjs, then:
node poc.mjs
# open the generated poc.html in any browser (or headless):
# msedge --headless=new --dump-dom "file:///ABS/PATH/poc.html"
poc.mjs:
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
import { writeFileSync } from 'fs';
// Stands in for an assistant answer built from an ingested document.
const answer =
`<iframe srcdoc="<script>` +
`var h=parent.document.createElement('h1');h.style.color='red';` +
`h.textContent='XSS EXECUTED on '+(parent.document.domain||'this page');` +
`parent.document.body.appendChild(h);parent.document.title='XSS-EXECUTED';` +
`<\/script>"></iframe>`;
// EXACT options from ChatMessage.tsx (rehypeRaw + skipHtml:false, no sanitizer):…
- Record
GHSA-xpjq-3w4w-w5wr- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVPYSEC-2026-4065
6.1
lightrag-hku: Stored Cross-Site Scripting (XSS) in the LightRAG WebUI chat/answer renderer via ingested content
Summary
The LightRAG WebUI renders assistant/answer chat content as raw HTML — react-markdown is
configured with rehypePlugins={[rehypeRaw]} and skipHtml={false} and no HTML sanitizer
(rehype-sanitize), element allow-list, or custom urlTransform. Because answer content is derived
from user-ingested documents, an attacker who can add a single document can store an HTML/JavaScript
payload that executes in the browser of any user who later retrieves it (typically an administrator),
leading to auth-token theft from localStorage and full API takeover. No authentication is required in
the default configuration.
Details
Sink — lightrag_webui/src/components/retrieval/ChatMessage.tsx:
- Main answer (
MessageMarkdown, lines ~348-351) and thinking content (lines ~252-272) render withrehypePlugins={[rehypeRaw, …]}andskipHtml={false}. Thecomponentsmap (lines ~111-156) only restyles safe formatting tags (p,h1–h4,ul,ol,li,code); there is norehype-sanitize, noallowedElements/disallowedElements, and no customurlTransform. - Second sink: mermaid is initialized with
securityLevel: 'loose'(line ~433) and the rendered SVG is injected viacontainer.innerHTML = svg(line ~483) +bindFunctions(container).'loose'disables mermaid's output sanitization, so a```mermaidblock in answer content (HTML label /clickdirective) is an additional script-execution path. - Hardening (not code execution): KaTeX is set with
trust: true(lines ~261/~359).\href{javascript:…}is blocked by React 19, but\includegraphics{URL}renders a live remote<img src>(arbitrary external resource load from the victim's browser). Recommendtrust: false.
Source → sink:
POST /documents/text or POST /documents/upload stores the document → POST /query returns it
(verbatim when only_need_context=true, lightrag/api/routers/query_routes.py:27; otherwise echoed by
the LLM) → the response is streamed into assistantMessage.content
(lightrag_webui/src/features/RetrievalView.tsx:340) → rendered by the sink above.
react-markdown's built-in defenses do NOT cover this: it sanitizes href/src URLs (so javascript:
links are blocked) and React ignores string event handlers (so <img onerror> is dropped), but raw
elements such as <iframe srcdoc="…"> and <svg><script> are rendered unchanged and execute.
PoC
Benign, local-only. Tested at commit f3378a3 (v1.5.5) with react@19, [email protected],
[email protected].
Fastest check (code review, ~10s): in ChatMessage.tsx, the <ReactMarkdown> that renders answers
uses rehypePlugins={[rehypeRaw, …]} with skipHtml={false} and no rehype-sanitize / allow-list.
Per react-markdown's own documentation, rehype-raw on untrusted input without rehype-sanitize
allows HTML injection — that is the vulnerability.
Runnable proof (~2 min) — reproduces the exact renderer config and shows it execute in a browser:
mkdir xss-check && cd xss-check
npm init -y
npm install react@19 react-dom@19 react-markdown@10 rehype-raw@7
# save the script below as poc.mjs, then:
node poc.mjs
# open the generated poc.html in any browser (or headless):
# msedge --headless=new --dump-dom "file:///ABS/PATH/poc.html"
poc.mjs:
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
import { writeFileSync } from 'fs';
// Stands in for an assistant answer built from an ingested document.
const answer =
`<iframe srcdoc="<script>` +
`var h=parent.document.createElement('h1');h.style.color='red';` +
`h.textContent='XSS EXECUTED on '+(parent.document.domain||'this page');` +
`parent.document.body.appendChild(h);parent.document.title='XSS-EXECUTED';` +
`<\/script>"></iframe>`;
// EXACT options from ChatMessage.tsx (rehypeRaw + skipHtml:false, no sanitizer):…
- Record
PYSEC-2026-4065- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
lightrag-hkuPyPI |
through 1.5.4 | 1.5.5 |
lightrag-hkuPyPI |
before 1.5.5, plus listed versions 0.0.20.0.30.0.40.0.50.0.6 Show 45 moreShow less0.0.70.0.80.0.91.0.01.0.11.0.31.0.51.0.61.0.81.0.91.1.01.1.11.1.21.1.31.1.41.1.51.1.61.1.71.2.11.2.21.2.31.2.51.2.61.3.01.3.11.3.21.3.31.3.41.3.51.3.61.3.71.3.81.3.91.4.01.4.11.4.101.4.111.4.11rc21.4.121.4.12rc11.4.131.4.13rc11.4.141.4.151.4.16 |
1.5.5 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-86062 is a medium vulnerability (CVSS 6.1) in Hkuds Lightrag, published September 22, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.34%, the 27th percentile. Fixed in lightrag-hku 1.5.5.
References
github.com/HKUDS/LightRAG/security/advisories/GHSA-xpjq-3w4w-w5wr
github.com/HKUDS/LightRAG/pull/3437
github.com/HKUDS/LightRAG/commit/8bf032a5200f293b482dd945d436e25cd08bd953
github.com/HKUDS/LightRAG/releases/tag/v1.5.5
nvd.nist.gov/vuln/detail/CVE-2026-86062
github.com/advisories/GHSA-xpjq-3w4w-w5wr
github.com/CVEProject/cvelistV5/tree/main/cves/2026/86xxx/CVE-2026-86062.json
github.com/HKUDS/LightRAG
pypi.org/project/lightrag-hku
Left out here: 39 versions and the rest of 3 source descriptions. The JSON record has them.