You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
laipz8200
published
GHSA-qpv6-75c2-75h4Mar 3, 2026
Package
No package listed
Affected versions
1.10.1
Patched versions
1.11.2
Description
Summary
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.
Details
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.
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’.
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.
Learn more on MITRE.
Summary
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.
Details
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.
PoC
Create a ChatBot in the Dify app.
Include the following payload in the chat input field:
After sending the message, click the generated element and observe that the pop up element is executed.
Impact
This can result in an attacker creating a malicious chat, which, when shared, will compromise a victim's session.