Summary
An unsafe option parsing flaw in 5ire's ECharts Markdown plugin allows arbitrary JavaScript execution within the renderer context whenever untrusted ECharts code blocks are processed.
In environments where privileged APIs (such as Electron's electron.mcp) are exposed, this JavaScript execution can escalate to full remote code execution on the host system for any user able to submit or influence ECharts code blocks.
Affected context
The vulnerability arises when 5ire is configured to render Markdown content that includes ECharts code blocks, and the ECharts Markdown plugin parses options from this content in an unsafe manner.
It becomes particularly dangerous in desktop environments using Electron or similar frameworks where the renderer has access to privileged APIs (for example, through electron.mcp or other bridge mechanisms).
Any scenario where untrusted or user-supplied Markdown—including ECharts snippets—can be rendered inside 5ire may be affected, especially if the renderer is not strictly sandboxed.
Exploit preconditions
- Attack surface: Markdown/ECharts rendering pipeline within the 5ire desktop application.
- Required access: Ability to submit, edit, or otherwise influence ECharts code blocks in Markdown content rendered by 5ire (e.g., chat messages, notes, shared documents, or synced files).
- Trigger point: Rendering of a malicious ECharts code block by the vulnerable ECharts Markdown plugin, which unsafely parses and evaluates options.
- Why exploitation is possible: The option parsing logic treats attacker-controlled ECharts options as executable JavaScript or passes them into dynamically evaluated constructs, enabling arbitrary code execution in the renderer context. In Electron-like environments with exposed privileged APIs, this JavaScript can interact with the host to achieve full RCE.
Why this happens
The core issue is an unsafe interpretation of user-controlled configuration data as executable code, aligning with CWE-94: Improper Control of Generation of Code ('Code Injection').
Within the ECharts Markdown plugin, options extracted from code blocks are not constrained to a data-only representation; instead, they are processed in a way that allows JavaScript expressions or functions to be evaluated in the renderer environment.
This pattern effectively merges data (chart options) and code (execution context) without enforcing a strict separation or sanitization layer, enabling attackers to inject arbitrary JavaScript wherever they can provide ECharts configuration content.
Potential impact
- Execution of arbitrary JavaScript within the renderer context of the 5ire desktop application.
- Remote Code Execution on the host system when privileged Electron APIs (such as
electron.mcp) or similar bridges are accessible from the renderer. - Full compromise of the affected user's workstation, including reading and modifying local files where the application has access.
- Theft of authentication tokens, session cookies, or API keys accessible to the application.
- Lateral movement by using the compromised host to attack other systems or services reachable from that environment.
General mitigation guidance
Effective mitigation focuses on separating untrusted data from executable code and minimizing renderer privileges:
- Treat ECharts options strictly as data structures (e.g., JSON-only), avoiding support for embedded JavaScript functions, expressions, or dynamic evaluation in user-supplied content.
- Introduce a robust validation layer for all chart options parsed from Markdown, rejecting or stripping constructs that could cause code execution or reference dynamic global objects.
- Apply a strict sandbox model for renderer processes, ensuring they have no direct access to host-level APIs and can only interact through carefully designed, permission-checked IPC channels.
- Reduce the exposure of powerful APIs (such as
electron.mcpand similar bridges) to the renderer; where they must exist, gate them behind explicit permission checks and origin/context validation. - Adopt a "safe-by-default" Markdown and plugin configuration that disables rich scripting features in rendered content unless explicitly needed and vetted.
How teams detect issues like this
Detection can rely on both code-centric analysis and runtime monitoring:
- Static analysis and code review:
- Search for dynamic code execution patterns in Markdown plugins and rendering logic (e.g.,
eval,new Function,vmusage, or dynamicrequire/importbased on user data). - Flag any pathways where ECharts options or Markdown content can flow into executable contexts or privileged IPC calls.
- Enforce secure coding guidelines around Electron preload scripts and bridge APIs, reviewing for unnecessary exposure to the renderer.
- Policy and configuration checks:
- Validate that renderer processes are sandboxed and that
nodeIntegration, remote modules, or equivalent high-risk features are disabled unless absolutely necessary. - Maintain a rule set in automated code review tools (SAST, linters) to detect unsafe plugin patterns across Markdown and visualization components.
- Runtime and behavioral monitoring:
- Instrument the application to log and alert on unexpected invocations of privileged APIs from renderer contexts, particularly those originating from content rendering flows.
- Use application-level security monitoring to detect anomalies such as unexpected file access, command execution, or network calls initiated during Markdown/ECharts rendering.

