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-41159: CWE-94: Improper Control of Generation of Code ('Code Injection') in mermaid-js mermaid

0
Medium
VulnerabilityCVE-2026-41159cvecve-2026-41159cwe-94
Published: 05/29/2026 (05/29/2026, 13:53:10 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. Prior to 10.9.6 and 11.15.0, Mermaid's default configuration allows injecting CSS that applies outside of the Mermaid diagram via the fontFamily, themeCSS, and altFontFamily configuration options. The injected CSS exploits stylis's & (scope reference) handling. :not(&) escapes the #mermaid-xxx automatic scoping, applying styles to all page elements. Global at-rules (@font-face, @keyframes, @counter-style) are also injectable as stylis hoists them to top level. This allows page defacement and DOM attribute exfiltration via CSS :has() selectors. This vulnerability is fixed in 10.9.6 and 11.15.0.

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

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: 07/01/2026, 21:22:00 UTC

Technical Analysis

Mermaid-js mermaid versions before 10.9.6 and 11.15.0 have a vulnerability where the default configuration permits injection of CSS that escapes the intended Mermaid diagram scope. This is due to stylis's handling of the '&' scope reference, specifically the use of ':not(&)', which bypasses the automatic scoping of styles to the Mermaid container. Additionally, global CSS at-rules like @font-face, @keyframes, and @counter-style can be injected because stylis hoists them to the top level. Exploitation can result in page defacement and exfiltration of DOM attributes via CSS :has() selectors. The issue is classified as CWE-94 (Improper Control of Generation of Code).

Potential Impact

The vulnerability allows an attacker to inject CSS that affects the entire webpage, not just the Mermaid diagram, potentially leading to visual defacement and unauthorized exfiltration of DOM attributes. This can undermine the integrity and confidentiality of the affected web pages. The CVSS 4.0 score is 5.3 (medium), reflecting network attack vector, low complexity, no privileges required, user interaction needed, and limited impact on confidentiality and integrity.

Mitigation Recommendations

This vulnerability is fixed in mermaid versions 10.9.6 and 11.15.0. Users should upgrade to at least version 10.9.6 or later to remediate this issue. No other mitigation or temporary workaround is indicated in the available data.

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-17T16:34:45.524Z
Cvss Version
4.0
State
PUBLISHED
Remediation Level
null

Threat ID: 6a19a74de29bf47b50f00d47

Added to database: 05/29/2026, 14:48:45 UTC

Last enriched: 07/01/2026, 21:22:00 UTC

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

Views: 87

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