All vulnerabilities

Servers and applications

CVE-2026-21866

Dify - Stored XSS in chat

Severity
Medium 5.7
Published
3 Mar 2026
Last changed
3 Mar 2026
Added to UpHeron
3 Nov 2026
Exploit chance
0.3% in the next 30 daysHigher than 16% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
Cross-site scripting (CWE-79)
Attack
Over the network · Needs a user account · Needs someone to click or open something
Attacker can
Read data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N
Also known as
GHSA-qpv6-75c2-75h4
Sources
Project advisories (GitHub)

Description

We have identified a vulnerability that can result in stored XSS in chat conversations. This can result in an attacker creating a malicious chat, which, when shared, will compromise a victim's session.

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.

web/app/components/base/mermaid/index.tsx

In Mermaid Gantt diagrams, you can attach click events to tasks, directing them either to a JavaScript callback or to an external link. This feature is available only when securityLevel is set to ‘loose’ and it is disabled when securityLevel is set to ‘strict’.

This configuration allows users to embed JavaScript-based payloads into chatbot conversations by using the javascript protocol.

This can result in an attacker creating a malicious chat, which, when shared, will compromise a victim's session.

From langgenius/dify's security advisory.

Affected software

SoftwareAffected versions
DifyServers and applications · github:langgenius/dify
  • Version 1.10.1

About Dify

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

From its GitHub repository.
GitHub stars
161,177GitHub, 15 Nov 2026
Forks
25,501GitHub, 15 Nov 2026
Latest release
1.19.0GitHub, 15 Nov 2026
Released
4 Nov 2026GitHub
First published on GitHub
12 Apr 2023GitHub

References