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…

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: Fri May 29 2026 (05/29/2026, 13:53:10 UTC)
Source: CVE Database V5
Vendor/Project: mermaid-js
Product: mermaid

Description

CVE-2026-41159 is a medium severity vulnerability in the mermaid-js mermaid JavaScript tool that allows CSS injection outside of Mermaid diagrams via certain configuration options. This occurs due to improper handling of CSS scoping in stylis, enabling attackers to apply styles globally on the page, potentially causing page defacement and DOM attribute exfiltration. The issue affects versions prior to 10. 9. 6 and versions from 11. 0. 0-alpha. 1 up to but not including 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

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 05/29/2026, 15:03:58 UTC

Technical Analysis

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

Potential Impact

An attacker can inject CSS that affects the entire page outside the Mermaid diagram, potentially defacing the page or exfiltrating DOM attributes. This could impact the integrity and confidentiality of the web page content where Mermaid is used. The CVSS 4.0 score is 5.3 (medium severity), indicating a moderate risk with network attack vector, low complexity, no privileges required, and requiring user interaction.

Mitigation Recommendations

This vulnerability is fixed in mermaid versions 10.9.6 and 11.15.0. Users should upgrade to these or later versions to remediate the issue. Patch status is not explicitly stated in the vendor advisory content provided, but the description confirms the fix is included in these versions. No additional mitigation steps are indicated.

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: 5/29/2026, 2:48:45 PM

Last enriched: 5/29/2026, 3:03:58 PM

Last updated: 5/29/2026, 3:53:41 PM

Views: 4

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