CVE-2025-58747: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in langgenius dify
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.
AI Analysis
Technical Summary
CVE-2025-58747 is a cross-site scripting vulnerability classified under CWE-79, affecting the langgenius dify platform, an LLM application development environment. The vulnerability exists in the OAuth flow implementation of the MCP OAuth component in dify versions up to 1.9.1. Specifically, the authorization_url parameter, which is expected to be a URL for OAuth authorization, is directly passed to the JavaScript function window.open without any validation or sanitization. This allows an attacker who controls a remote MCP OAuth server to craft a malicious authorization_url containing a JavaScript URI scheme (e.g., javascript:alert(1)). When a user connects to this attacker-controlled MCP server, the malicious script executes in the context of the dify application, enabling arbitrary JavaScript execution. This can lead to session hijacking, data theft, or other client-side attacks depending on the application's context and privileges. The vulnerability requires user interaction (the user must connect to the malicious MCP server) but does not require authentication or elevated privileges. The CVSS 4.0 base score is 2.0, reflecting low severity due to the need for user interaction and limited scope of impact. No patches or fixes are currently linked, and no known exploits have been reported in the wild. The vulnerability highlights the importance of input validation and sanitization in OAuth flows, especially when dealing with external or third-party servers.
Potential Impact
For European organizations, the impact of this vulnerability is primarily on the confidentiality and integrity of user sessions within the dify platform. If exploited, attackers could execute arbitrary JavaScript, potentially stealing sensitive information, manipulating user interactions, or performing actions on behalf of the user within the application context. However, the requirement for user interaction and connection to a malicious MCP server limits the attack surface. Organizations using dify in environments where users might connect to untrusted or external MCP servers are at higher risk. The vulnerability could undermine trust in AI application development platforms and disrupt workflows if exploited. Given the growing adoption of AI and LLM development platforms in Europe, especially in countries investing heavily in AI research and development, this vulnerability could pose a reputational and operational risk. However, the low CVSS score and absence of known exploits suggest the immediate risk is limited but should not be ignored.
Mitigation Recommendations
1. Avoid connecting to untrusted or unknown MCP OAuth servers within the dify platform until a patch is available. 2. Implement network-level controls to restrict connections to only trusted MCP servers. 3. Monitor user activity for unusual OAuth connection attempts or unexpected redirects. 4. Encourage users to report suspicious authorization prompts or unexpected behavior during OAuth flows. 5. Once available, promptly apply security patches or updates from langgenius addressing this vulnerability. 6. Consider implementing additional client-side input validation or sanitization in custom deployments or forks of dify. 7. Educate developers and users about the risks of connecting to untrusted third-party OAuth providers. 8. Employ Content Security Policy (CSP) headers to restrict script execution sources in the dify application environment, mitigating the impact of potential XSS attacks.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden
CVE-2025-58747: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in langgenius dify
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.
AI-Powered Analysis
Technical Analysis
CVE-2025-58747 is a cross-site scripting vulnerability classified under CWE-79, affecting the langgenius dify platform, an LLM application development environment. The vulnerability exists in the OAuth flow implementation of the MCP OAuth component in dify versions up to 1.9.1. Specifically, the authorization_url parameter, which is expected to be a URL for OAuth authorization, is directly passed to the JavaScript function window.open without any validation or sanitization. This allows an attacker who controls a remote MCP OAuth server to craft a malicious authorization_url containing a JavaScript URI scheme (e.g., javascript:alert(1)). When a user connects to this attacker-controlled MCP server, the malicious script executes in the context of the dify application, enabling arbitrary JavaScript execution. This can lead to session hijacking, data theft, or other client-side attacks depending on the application's context and privileges. The vulnerability requires user interaction (the user must connect to the malicious MCP server) but does not require authentication or elevated privileges. The CVSS 4.0 base score is 2.0, reflecting low severity due to the need for user interaction and limited scope of impact. No patches or fixes are currently linked, and no known exploits have been reported in the wild. The vulnerability highlights the importance of input validation and sanitization in OAuth flows, especially when dealing with external or third-party servers.
Potential Impact
For European organizations, the impact of this vulnerability is primarily on the confidentiality and integrity of user sessions within the dify platform. If exploited, attackers could execute arbitrary JavaScript, potentially stealing sensitive information, manipulating user interactions, or performing actions on behalf of the user within the application context. However, the requirement for user interaction and connection to a malicious MCP server limits the attack surface. Organizations using dify in environments where users might connect to untrusted or external MCP servers are at higher risk. The vulnerability could undermine trust in AI application development platforms and disrupt workflows if exploited. Given the growing adoption of AI and LLM development platforms in Europe, especially in countries investing heavily in AI research and development, this vulnerability could pose a reputational and operational risk. However, the low CVSS score and absence of known exploits suggest the immediate risk is limited but should not be ignored.
Mitigation Recommendations
1. Avoid connecting to untrusted or unknown MCP OAuth servers within the dify platform until a patch is available. 2. Implement network-level controls to restrict connections to only trusted MCP servers. 3. Monitor user activity for unusual OAuth connection attempts or unexpected redirects. 4. Encourage users to report suspicious authorization prompts or unexpected behavior during OAuth flows. 5. Once available, promptly apply security patches or updates from langgenius addressing this vulnerability. 6. Consider implementing additional client-side input validation or sanitization in custom deployments or forks of dify. 7. Educate developers and users about the risks of connecting to untrusted third-party OAuth providers. 8. Employ Content Security Policy (CSP) headers to restrict script execution sources in the dify application environment, mitigating the impact of potential XSS attacks.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-09-04T19:18:09.498Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 68f268709c34d0947f2fc04e
Added to database: 10/17/2025, 4:01:52 PM
Last enriched: 10/17/2025, 4:16:57 PM
Last updated: 10/19/2025, 12:50:25 PM
Views: 15
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-11940: Uncontrolled Search Path in LibreWolf
HighCVE-2025-11939: Path Traversal in ChurchCRM
MediumCVE-2025-11938: Deserialization in ChurchCRM
MediumCVE-2025-62672: CWE-770 Allocation of Resources Without Limits or Throttling in boyns rplay
MediumCVE-2025-47410: CWE-352 Cross-Site Request Forgery (CSRF) in Apache Software Foundation Apache Geode
UnknownActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.