CVE-2026-21866
Received Received - Intake
Stored XSS in Dify Mermaid Diagrams Allows Code Execution

Publication date: 2026-03-03

Last updated on: 2026-03-05

Assigner: GitHub, Inc.

Description
Dify is an open-source LLM app development platform. Prior to 1.11.2, Dify is vulnerable to a stored XSS issue when rendering Mermaid diagrams within chats. This occurs because Dify’s default Mermaid configuration uses securityLevel: loose, which allows potentially unsafe content to execute. This vulnerability is fixed in 1.11.2.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-03
Last Modified
2026-03-05
Generated
2026-06-16
AI Q&A
2026-03-04
EPSS Evaluated
2026-06-14
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
dify dify to 1.11.2 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-79 The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Attack-Flow Graph
AI Quick Actions
Instant insights powered by AI
Executive Summary

This vulnerability affects Dify, an open-source LLM app development platform, in versions prior to 1.11.2. It is a stored Cross-Site Scripting (XSS) issue that occurs when rendering Mermaid diagrams within chats. The root cause is that Dify's default Mermaid configuration uses a security level set to 'loose', which permits potentially unsafe content to execute scripts. This can allow malicious code to be stored and later executed in the context of the application.

Impact Analysis

The stored XSS vulnerability can allow attackers to inject malicious scripts into Mermaid diagrams that are rendered within chats. When other users view these diagrams, the malicious scripts can execute in their browsers, potentially leading to unauthorized actions such as stealing session tokens, performing actions on behalf of the user, or delivering malware. This can compromise user data and the integrity of the application.

Compliance Impact

I don't know

Detection Guidance

I don't know

Mitigation Strategies

To mitigate this vulnerability, upgrade Dify to version 1.11.2 or later, where the stored XSS issue related to Mermaid diagrams is fixed by changing the default Mermaid configuration from securityLevel: loose to a more secure setting.

Chat Assistant
Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-21866. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70
EPSS Chart