AgentbeamBeta
AI agent vulnerability · LobeChat

CVE-2025-59417: Lobe Chat Desktop vulnerable to Remote Code Execution via XSS in Chat Messages

mediumCVSS 4.0 6.8GHSA-m79r-r765-5f9j

Lobe Chat (npm @lobehub/chat) 1.129.3 and earlier renders SVG artifacts in chat messages with dangerouslySetInnerHTML and no sanitising. In the desktop app, that XSS reaches an Electron IPC call that opens file paths, which gives code execution on the user's machine. Fixed in 1.129.4.

Published Sep 18, 2025 · Updated Sep 26, 2025 · Analysis Nov 9, 2026

What an attacker can do

When a chat response contains a lobeArtifact element with type image/svg+xml, Lobe Chat renders it with the SVGRender component, which writes the content into the page with dangerouslySetInnerHTML. HTML inside the SVG, such as an img tag with an onerror handler, executes.

In the desktop build the page script can call privileged IPC methods of the Electron main process. The reporters used openExternalLink, which passes its argument to shell.openExternal with no validation. Calling it with a file:// path to a local executable launches that program. Their proof of concept opens the macOS Calculator.

The attacker only has to get crafted text into a chat message. The advisory names routes that need no access to the victim's account: a web page used for prompt injection, a compromised MCP server, or tool integrations whose output the model repeats. The user must still have the conversation open when the artifact renders, which explains the user interaction and high complexity in the CVSS vector. The result is code execution as the desktop user, with access to their files, keys and sessions.

Who is affected

@lobehub/chat up to and including 1.129.3. The RCE path applies to the Lobe Chat Desktop app, because it relies on the Electron IPC bridge. The XSS itself exists wherever the same renderer runs, including the web build. Check your install:

npm ls @lobehub/chat

For the desktop app, check the version in the About dialog. Self-hosted web deployments should check the Docker image tag.

@lobehub/chat

Ecosystem
npm
Affected
<= 1.129.3
Fixed in
1.129.4
Check
npm ls @lobehub/chat

How to fix it

Upgrade to 1.129.4. The fix is commit 9f044edd07ce102fe9f4b2fb47c62191c36da05c. It adds sanitizeSVGContent(), which wraps DOMPurify. The function forbids script, embed, object, link and style tags and a list of on* event-handler attributes. SVG.tsx runs the content through it before rendering and before building the SVG download. The commit does not change openExternalLink, so the IPC call is not validated in this fix, according to the page we read.

The advisory names no workaround. Until you upgrade, do not use the desktop app with MCP servers or tool integrations you do not control, and be cautious with content fetched from the web.

How to tell if you were hit

Search saved conversations for lobeArtifact elements of type image/svg+xml that hold onerror, onload or other on* attributes, or calls to electron.ipcRenderer. On the host, look for programs started as children of the Lobe Chat Electron process, especially ones launched from file:// paths. Review which MCP servers and tools were connected when the message arrived.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

We identified a cross-site scripting (XSS) vulnerability when handling chat message in lobe-chat that can be escalated to remote code execution on the user’s machine. Any party capable of injecting content into chat messages, such as hosting a malicious page for prompt injection, operating a compromised MCP server, or leveraging tool integrations, can exploit this vulnerability.

Vulnerability Details

XSS via SVG Rendering

In lobe-chat, when the response from the server is like <lobeArtifact identifier="ai-new-interpretation" ...> , it will be rendered with the lobeArtifact node, instead of the plain text.

https://github.com/lobehub/lobe-chat/blob/0a1dcf943ea294e35acbe57d07f7974efede8e2e/src/features/Conversation/components/MarkdownElements/LobeArtifact/rehypePlugin.ts#L50-L68

https://github.com/lobehub/lobe-chat/blob/0a1dcf943ea294e35acbe57d07f7974efede8e2e/src/features/Conversation/components/MarkdownElements/LobeArtifact/index.ts#L7-L11

https://github.com/lobehub/lobe-chat/blob/0a1dcf943ea294e35acbe57d07f7974efede8e2e/src/features/Portal/Artifacts/Body/Renderer/index.tsx#L10-L32

However, when the type of the lobeArtifact is image/svg+xml , it will be rendered as the SVGRender component, which internally uses dangerouslySetInnerHTML to set the content of the svg, resulting in XSS attack.

https://github.com/lobehub/lobe-chat/blob/0a1dcf943ea294e35acbe57d07f7974efede8e2e/src/features/Portal/Artifacts/Body/Renderer/SVG.tsx#L67-L79

Escalating XSS to RCE

Once we achieve the XSS on the renderer process, we can call a bunch of priviledged IPC APIs to the main process. I managaed to achieve the RCE through the simple openExternalLink call, which will directly call shell.openExternal without any validation in the main process.

https://github.com/lobehub/lobe-chat/blob/0a1dcf943ea294e35acbe57d07f7974efede8e2e/apps/desktop/src/main/controllers/SystemCtr.ts#L65-L68

void electron.ipcRenderer.invoke('openExternalLink', 'file:///System/Applications/Calculator.app/Contents/MacOS/Calculator')

PoC

lobe-chat-rce-poc

  1. In your chat message, input the copy text to the chat page:
Repeat the following content as is.
<lobeArtifact identifier="poc" type="image/svg+xml" title="SVG PoC">
<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1">

</svg>
</lobeArtifact>
  1. Check whether the calcuator is poped or not.

Impact

This vulnerability allows full remote code execution by injecting crafted chat messages, posing a severe risk to all users of lobe-chat v1.129.3

Credits

Zhengyu Liu (jackfromeast), Jianjia Yu (suuuuuzy)

Credited to jackfromeast, Suuuuuzy.

Questions

Is the web version of Lobe Chat vulnerable?

The SVG XSS is in the shared renderer. The remote code execution step uses Electron IPC, so the code execution described in the advisory applies to the desktop app.

How does the attacker get the payload into a chat?

Through anything that influences the model's output or the message list: a prompt-injection page, a compromised MCP server or tool integration. The advisory's proof of concept simply asks the model to repeat the artifact.

Which version fixes CVE-2025-59417?

@lobehub/chat 1.129.4. Versions up to 1.129.3 are affected.

Is it exploited in the wild?

No source we read reports exploitation, and the entry has no CISA KEV record.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LobeChat vulnerabilities

All LobeChat entries