Lobe Chat, Stored XSS to RCE (Critical)

Listen to this Post

The vulnerability stems from unsanitized user input being passed directly to the Mermaid diagram rendering component. When a chat artifact of type ‘application/lobe.artifacts.mermaid’ is processed, the raw `content` variable is inserted into the `` component. The Mermaid library interprets HTML labels within node definitions (like ["<img...>"]) and writes them directly into the Document Object Model (DOM) without sanitization. This allows an attacker to inject a malicious HTML tag, such as an `` with an `onerror` attribute containing JavaScript. In the Lobe Chat Desktop application, the renderer process is granted access to a powerful IPC bridge named `electronAPI` via contextBridge.exposeInMainWorld. This bridge exposes functions like `invoke` that can call main process handlers. A handler named `runCommand` in the `ShellCommandCtr` controller uses `child_process.spawn` to execute system commands. The injected JavaScript in the Mermaid diagram can call window.electronAPI.invoke('runCommand', {command: 'calc.exe'}), thereby escalating the stored Cross-Site Scripting (XSS) into full Remote Code Execution (RCE) on the victim’s host machine.
Platform: Lobe Chat Desktop
Version: Not specified
Vulnerability: Stored XSS->RCE
Severity: Critical
date: Not specified

Prediction: To be determined

What Undercode Say:

<lobeArtifact type="application/lobe.artifacts.mermaid">
```mermaid
graph TD;
A["<img src=x onerror='window.electronAPI.invoke(String.fromCharCode(114,117,110,67,111,109,109,97,110,100),{command:String.fromCharCode(99,97,108,99,46,101,120,101)})'>"];

[bash]
How Exploit:
Craft artifact with malicious Mermaid HTML label. Inject JavaScript calling electronAPI.invoke('runCommand'). Execute arbitrary system commands.
Protection from this CVE
Sanitize Mermaid content input. Restrict `contextBridge` exposure. Validate IPC channel commands.
Impact:
Full system compromise. Arbitrary command execution.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top