CVE-2025-58747 Dify MCP OAuth Flow Vulnerable to XSS
Attackers can execute arbitrary JavaScript in the Dify application context by tricking users into connecting to a malicious MCP server.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- None listed
What is CVE-2025-58747?
CVE-2025-58747 is a low-severity cross-site scripting vulnerability in langgenius dify, published on 17 Oct 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
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.
Weakness: CWE-79
Which versions are affected by CVE-2025-58747?
It affects 1 product.
Products include Langgenius Dify.
How do I fix CVE-2025-58747?
No fix has been published for CVE-2025-58747 yet. Limit exposure of the affected software until one is available.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2025-58747 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-58747 exists.
Other vulnerabilities in langgenius dify
Sources
Also known as GHSA-9jch-j9qf-vqfw.