Dify
CVE-2025-58747
LOW
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker deploys malicious remote MCP server
-
DeliveryVictim connects to server in Dify
-
ExploitServer returns javascript: authorization_url
-
Executionwindow.open executes the URI
-
ImpactArbitrary JavaScript runs in Dify context
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the victim to actively connect, from within Dify, to a remote MCP server the attacker controls, and that server must return a javascript: URI in the OAuth authorization_url field; the unvalidated value is then handed to window.open. The flaw is in web/hooks/use-oauth.ts (openOAuthPopup) reached from the MCP detail connect flow in web/app/components/tools/mcp/detail/content.tsx. Limiting factors: active user interaction is mandatory (UI:A) - no drive-by path; the connect action is gated behind isCurrentWorkspaceManager in the source, so the victim must be a privileged workspace manager; and the attacker must get that victim to add/connect their malicious MCP server. Affects Dify through 1.9.1 per the description (note the version discrepancy with the advisory); updating to the fixed release is the remediation the vendor provides. |
| Impact | This is a low-severity, low-priority issue despite being a genuine XSS, and the signals are internally consistent. The vendor CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:A) scores only 2.0 because the vulnerable-system impacts are all None (VC:N/VI:N/VA:N) and only subsequent-system confidentiality and integrity are rated Low (SC:L/SI:L); exploitation is gated by required active user interaction (UI:A) - the victim must initiate a connection to an attacker-controlled remote MCP server. The vuln.today Decision label is 'monitor', there is no CISA KEV listing and no EPSS score in the input, so there is no evidence of active exploitation - consistent with a low real-world priority. One signal to weigh: the input lists PR:N (no attacker privileges on Dify), but the fixed source (content.tsx guarded by isCurrentWorkspaceManager) indicates the victim who connects the MCP server must be a privileged workspace manager; this limits who can be targeted even though it does not change the attacker's own privilege requirement. A public PoC reference exists but is not verified as working exploit code. Net: a real but narrowly-conditioned client-side XSS, correctly rated low - not a high-CVSS-but-low-risk mismatch, simply a low-impact bug. |
| Exploit ScenarioDerived | An attacker stands up a malicious remote MCP server that returns a JavaScript URI (e.g. javascript:alert(1)) in the OAuth authorization_url field. When a Dify user is induced to connect to that server, Dify passes the URL straight to window.open via openOAuthPopup, executing the attacker's JavaScript in the Dify application context. A public PoC reference (a gist MCP server) is linked in the GHSA advisory but is not verified as working exploit code; exploitation requires network reach (AV:N) and active victim interaction (UI:A), with low attack complexity (AC:L). |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 10, 2026
Cross-site scripting in Dify's MCP OAuth flow (versions through 1.9.1) lets an attacker-controlled remote MCP server return a JavaScript URI in the authorization_url field, which Dify passes to window.open without validation and which then executes in the context of the Dify application. The victim must be a workspace manager who actively adds and connects to the malicious remote MCP server, so exploitation requires both attacker-supplied infrastructure and deliberate user action; this is a low-severity, low-priority issue despite being a genuine XSS, and the signals are internally consistent. A public PoC reference exists (a Gist containing a malicious MCP server script used in the advisory demonstration); it is not verified as working exploit code, and there is no CISA KEV listing indicating active exploitation.
RemediationAI
Apply the upstream fix or a release that contains it: commit bfda4ce7e6f39d43a4420e97e23a18edcfe3e3d3 (https://github.com/langgenius/dify/commit/bfda4ce7e6f39d43a4420e97e23a18edcfe3e3d3) introduces web/utils/urlValidation.ts and rejects any authorization_url that is not http: or https: before window.open is called; the vendor advisory (https://github.com/langgenius/dify/security/advisories/GHSA-9jch-j9qf-vqfw) lists 1.8.0 as the fixed release, which conflicts with the CVE description's 'through 1.9.1' range, so confirm the deployed build actually includes the validation module. If upgrading is not immediately possible, the practical compensating control is to have workspace managers avoid adding or connecting to remote MCP servers they do not fully trust, since the malicious value originates entirely from that server's OAuth response and the connect action is gated behind isCurrentWorkspaceManager; the trade-off is loss of remote MCP functionality for those users. Note that updating to the fixed release is the remediation the vendor provides, and the fix has a side effect worth planning for: any legitimate MCP server that returns a non-HTTP(S) authorization_url will now be rejected with an error rather than opening a popup.
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Dify's remote MCP (Model Context Protocol) integration implements an OAuth handshake in the browser: the backend returns an authorization_url supplied by the remote MCP server, and the frontend opens it in a popup. The vulnerable path is web/hooks/use-oauth.ts (openOAuthPopup), reached from the MCP detail connect flow in web/app/components/tools/mcp/detail/content.tsx, where res.authorization_url is passed straight to window.open. Because the scheme is never checked, a value such as javascript:alert(1) is treated as a navigable URI and executes script in the Dify origin - a CWE-79 cross-site scripting issue rooted in missing scheme allow-listing on an externally supplied redirect target, consistent with the CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N assessment (scope change, low confidentiality/integrity, no availability impact, user interaction required). The upstream fix commit bfda4ce7e6f39d43a4420e97e23a18edcfe3e3d3 adds a new web/utils/urlValidation.ts module whose validateRedirectUrl() parses the URL with the WHATWG URL API and throws unless the protocol is http: or https:, and calls it at the top of openOAuthPopup. The CPE string cpe:2.3:a:langgenius:dify:*:*:*:*:*:node.js:*:* reflects that the affected component ships with the Node.js-based Dify web application; the trigger for the script execution is the popup navigation described above, not any server-side parsing flaw.
Know when Dify gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:P
Reflected/DOM-style XSS triggered over the network with low complexity but requiring victim interaction (UI:R); JavaScript runs in the Dify app context distinct from the MCP server (S:C) with limited confidentiality and integrity impact.
Primary rating from Vendor (github).
CVSS VectorVendor: github
DescriptionCVE.org
Dify is an LLM application development platform. In Dify versions through 1.9.1, the MCP OAuth component is vulnerable to cross-site scripting when a victim connects to an attacker-controlled remote MCP server. The vulnerability exists in the OAuth flow implementation where the authorization_url provided by a remote MCP server is directly passed to window.open without validation or sanitization. An attacker can craft a malicious MCP server that returns a JavaScript URI (such as javascript:alert(1)) in the authorization_url field, which is then executed when the victim attempts to connect to the MCP server. This allows the attacker to execute arbitrary JavaScript in the context of the Dify application.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
Affected Products (CPE)CVE.org
Dify 1.9.1 permits unauthenticated remote GET requests to the /console/api/system-features console endpoint, letting ano
Hard-coded default PostgreSQL credentials shipped in the docker-compose.yaml of langgenius Dify through version 1.5.1 al
Path traversal in Dify versions 0 through 1.14.1 allows authenticated tenants to escape their authorized tenant path and
Cross-tenant authorization bypass in LangGenius Dify versions through 1.14.1 lets any logged-in editor reroute another t
A vulnerability in langgenius/dify v0.10.1 allows an attacker to take over any account, including administrator accounts
SQL injection in Dify's MyScale vector store backend (versions before 1.16.0-rc1) lets authenticated attackers execute a
Plaintext exposure of third-party service API keys in Dify prior to version 1.11.0 allows any authenticated non-administ
Cross-tenant document disclosure in Dify 1.14.1 and prior allows any authenticated user to read up to 3,000 characters o
langgenius/dify version v0.10.1 contains a vulnerability where there are no limits applied to the number of code guess a
In langgenius/dify v0.10.1, the `/forgot-password/resets` endpoint does not verify the password reset code, allowing an
Dify is an open-source LLM app development platform. Rated high severity (CVSS 7.6), this vulnerability is remotely expl
A stored cross-site scripting (XSS) vulnerability exists in langgenius/dify version latest, specifically in the chat log
NVD
CVE.org
EPSS
GitHub
VulDB
Exploit-DB