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-21866: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in langgenius dify

0
Medium
VulnerabilityCVE-2026-21866cvecve-2026-21866cwe-79
Published: Tue Mar 03 2026 (03/03/2026, 21:42:25 UTC)
Source: CVE Database V5
Vendor/Project: langgenius
Product: dify

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.

AI-Powered Analysis

AILast updated: 03/03/2026, 22:17:45 UTC

Technical Analysis

CVE-2026-21866 is a stored cross-site scripting (XSS) vulnerability identified in the langgenius Dify platform, an open-source tool for developing large language model (LLM) applications. The vulnerability exists in versions prior to 1.11.2 and is specifically related to the rendering of Mermaid diagrams within chat interfaces. Mermaid is a popular diagramming and charting tool that allows users to create visualizations from text definitions. Dify’s default Mermaid configuration uses securityLevel: loose, which does not sufficiently sanitize or neutralize potentially malicious input embedded in Mermaid diagrams. This improper neutralization of input (classified under CWE-79) allows attackers to inject malicious JavaScript code that is stored and later executed in the browsers of users viewing the affected chat content. The vulnerability does not require authentication to exploit but does require user interaction to trigger the malicious script execution. The CVSS 4.0 vector indicates network attack vector, low attack complexity, no privileges required, and user interaction needed, with limited scope and impact confined to confidentiality, integrity, and availability at a low level. The vulnerability was reserved in early January 2026 and published in March 2026, with no known exploits reported in the wild. The fix implemented in version 1.11.2 involves changing the Mermaid configuration to a more restrictive security level that prevents unsafe content execution, thereby mitigating the risk of stored XSS attacks within chat diagrams.

Potential Impact

The primary impact of this vulnerability is the potential for attackers to execute arbitrary JavaScript code in the browsers of users interacting with maliciously crafted Mermaid diagrams in Dify chat sessions. This can lead to session hijacking, theft of sensitive information such as authentication tokens or personal data, unauthorized actions performed on behalf of the user, and the potential spread of malware or further attacks within the affected environment. Since Dify is an LLM app development platform, compromised user sessions could also lead to manipulation or leakage of proprietary AI models, training data, or intellectual property. The stored nature of the XSS means the malicious payload persists and affects multiple users, increasing the attack surface. Although the CVSS score is medium, the impact on confidentiality and integrity can be significant in environments where sensitive AI development and collaboration occur. Organizations relying on Dify for LLM app development, especially those with multiple users sharing chat content, face increased risk of data breaches and operational disruption if the vulnerability is exploited.

Mitigation Recommendations

To mitigate this vulnerability, organizations should immediately upgrade all Dify installations to version 1.11.2 or later, where the Mermaid configuration uses a more secure securityLevel setting that prevents unsafe script execution. In addition, administrators should review and sanitize any existing Mermaid diagrams in chat histories to remove potentially malicious content. Implementing Content Security Policy (CSP) headers that restrict script execution sources can provide an additional layer of defense against XSS attacks. User education on the risks of interacting with untrusted chat content and diagrams is also important. For environments where immediate upgrade is not feasible, disabling Mermaid diagram rendering or restricting chat functionality to trusted users can reduce exposure. Regular security audits and monitoring for unusual chat activity or script execution attempts should be conducted to detect potential exploitation attempts early.

Need more detailed analysis?Upgrade to Pro Console

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-01-05T16:44:16.368Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69a75aa5d1a09e29cb7e098d

Added to database: 3/3/2026, 10:03:17 PM

Last enriched: 3/3/2026, 10:17:45 PM

Last updated: 3/4/2026, 8:12:27 AM

Views: 9

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 in Console -> Billing 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