Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…
EPSS 0.4%top 67%

CVE-2026-41149: CWE-94: Improper Control of Generation of Code ('Code Injection') in mermaid-js mermaid

0
Medium
VulnerabilityCVE-2026-41149cvecve-2026-41149cwe-94
Published: 05/22/2026 (05/22/2026, 22:34:36 UTC)
Source: CVE Database V5
Vendor/Project: mermaid-js
Product: mermaid

Description

Mermaid is a JavaScript tool that uses Markdown-inspired text to create and modify diagrams and charts. Versions 10.9.5 and earlier, as well as 11.0.0-alpha.1 through 11.14.0, are vulnerable to HTML injection under the default configuration. Specifically, the classDef directive in Mermaid state diagrams permits DOM injection that escapes the SVG context. However, <script> tags are stripped, which prevents cross-site scripting (XSS). This issue has been fixed in versions 10.9.6 and 11.15.0. If developers are unable to immediately upgrade, they can work around this issue by setting "securityLevel": "sandbox", which prevents the issue by rendering the mermaid diagram in a sandboxed <iframe>.

CVSS v4.0

Score 5.3medium

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vuln. Confidentiality
None
Vuln. Integrity
Low
Vuln. Availability
None
Subsq. Confidentiality
Low
Subsq. Integrity
Low
Subsq. Availability
Low
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L

Affected software

mermaid-js/mermaid
pkg:npm/mermaid-js/mermaid
Affected versions
<10.9.6>=11.0.0 <11.15.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 05/22/2026, 22:59:46 UTC

Technical Analysis

CVE-2026-41149 is an improper control of code generation vulnerability (CWE-94) in the mermaid-js mermaid tool. The vulnerability arises from the classDef directive in state diagrams allowing DOM injection that escapes the SVG context, leading to HTML injection. Although <script> tags are removed, preventing direct cross-site scripting, the injection could still affect the DOM. Affected versions include all versions up to 10.9.5 and from 11.0.0-alpha.1 up to but not including 11.15.0. The vulnerability has been addressed in versions 10.9.6 and 11.15.0. Developers unable to upgrade immediately can mitigate the issue by enabling the "securityLevel": "sandbox" setting, which confines rendering to a sandboxed iframe.

Potential Impact

The vulnerability allows HTML injection through the classDef directive, which can lead to DOM manipulation outside the SVG context. While direct script injection is prevented by stripping <script> tags, the injection could still affect the integrity of the rendered content. The CVSS 4.0 score is 5.3 (medium severity), indicating a moderate risk with network attack vector, no privileges required, and user interaction needed.

Mitigation Recommendations

A fix is available in mermaid versions 10.9.6 and 11.15.0. Users should upgrade to these or later versions to remediate the vulnerability. If immediate upgrading is not feasible, setting the configuration option "securityLevel" to "sandbox" provides a temporary workaround by rendering diagrams in a sandboxed iframe, preventing the injection issue.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-04-17T12:59:15.739Z
Cvss Version
4.0
State
PUBLISHED
Remediation Level
null

Threat ID: 6a10dcbfe1370fbb485f73b4

Added to database: 05/22/2026, 22:46:23 UTC

Last enriched: 05/22/2026, 22:59:46 UTC

Last updated: 07/31/2026, 19:22:58 UTC

Views: 108

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses