CVE-2025-63386 Overview
A Cross-Origin Resource Sharing (CORS) misconfiguration vulnerability has been identified in Dify v1.9.1, an open-source LLM application development platform by Langgenius. The vulnerability exists in the /console/api/setup endpoint, which implements an insecure CORS policy that reflects any Origin header while simultaneously enabling Access-Control-Allow-Credentials: true. This configuration permits arbitrary external domains to make authenticated requests to the vulnerable endpoint, potentially exposing sensitive data and enabling unauthorized actions.
It is worth noting that the vendor disputes this finding, stating that the endpoint configuration is intentional to support bootstrap functionality. However, security researchers maintain that this permissive CORS policy introduces significant risk in production environments.
Critical Impact
Arbitrary external domains can make authenticated cross-origin requests, potentially leading to credential theft, session hijacking, and unauthorized access to sensitive Dify console functionality.
Affected Products
- Langgenius Dify v1.9.1
- Dify installations with default CORS configurations
- Self-hosted Dify deployments exposing the /console/api/setup endpoint
Discovery Timeline
- 2025-12-18 - CVE-2025-63386 published to NVD
- 2026-02-11 - Last updated in NVD database
Technical Details for CVE-2025-63386
Vulnerability Analysis
This CORS misconfiguration vulnerability (CWE-346: Origin Validation Error) occurs when the Dify application fails to properly validate the Origin header in cross-origin requests. The /console/api/setup endpoint reflects any Origin header value back in the Access-Control-Allow-Origin response header while simultaneously setting Access-Control-Allow-Credentials: true. This dangerous combination allows malicious websites to bypass the browser's same-origin policy and make authenticated requests on behalf of legitimate users.
When a user who is authenticated to a Dify instance visits a malicious website, that website can silently make requests to the Dify API with the user's credentials attached. The browser will include session cookies, authentication tokens, and other credentials because the CORS policy explicitly permits this behavior. This can lead to unauthorized data exfiltration, configuration changes, or other malicious actions depending on the privileges of the authenticated user.
Root Cause
The root cause of this vulnerability lies in the implementation of a wildcard-like CORS policy that reflects any incoming Origin header value. The endpoint configuration dynamically mirrors the Origin header from incoming requests in the Access-Control-Allow-Origin response without validating whether the origin is trusted. Combined with the Access-Control-Allow-Credentials: true directive, this creates a permissive policy that effectively nullifies the security benefits of the same-origin policy for authenticated requests. While the vendor indicates this was intentional for bootstrap support, the security implications of such a permissive configuration warrant careful consideration in production deployments.
Attack Vector
An attacker exploits this vulnerability by hosting a malicious website that makes cross-origin requests to a target Dify instance. The attack proceeds as follows:
- The attacker identifies a target Dify installation with the vulnerable CORS configuration
- The attacker creates a malicious webpage containing JavaScript that makes requests to the Dify /console/api/setup endpoint
- When a victim who is authenticated to the target Dify instance visits the attacker's webpage, the malicious JavaScript executes
- The browser sends the cross-origin request with the victim's credentials because the CORS policy permits it
- The attacker's JavaScript can read the response data due to the permissive CORS headers, enabling data theft or further exploitation
The attack leverages the browser's built-in credential handling - the victim does not need to take any explicit action beyond visiting the attacker-controlled page while having an active session with the Dify application.
Detection Methods for CVE-2025-63386
Indicators of Compromise
- Unexpected cross-origin requests to the /console/api/setup endpoint from unknown or suspicious domains
- Access logs showing requests with Origin headers from domains not associated with legitimate Dify usage
- Unusual patterns of API requests originating from user sessions that correlate with visits to external websites
- Response headers containing Access-Control-Allow-Origin values matching arbitrary external domains
Detection Strategies
- Monitor HTTP access logs for requests to /console/api/setup with unusual or unexpected Origin headers
- Implement web application firewall (WAF) rules to alert on cross-origin requests from untrusted domains
- Review application configurations for overly permissive CORS policies that reflect Origin headers
- Deploy browser security extensions or Content Security Policy (CSP) headers to restrict cross-origin request capabilities
Monitoring Recommendations
- Establish a baseline of legitimate Origin headers for your Dify deployment and alert on deviations
- Configure SIEM rules to correlate cross-origin requests with user session activity to detect potential CSRF-like attacks
- Implement real-time monitoring of CORS-related response headers in application traffic
- Review authentication logs for session anomalies that may indicate credential theft via CORS exploitation
How to Mitigate CVE-2025-63386
Immediate Actions Required
- Audit your Dify deployment's CORS configuration and restrict the Access-Control-Allow-Origin header to explicitly trusted domains
- Implement an allowlist approach for Origin validation rather than reflecting arbitrary Origin headers
- Consider disabling Access-Control-Allow-Credentials unless absolutely required for legitimate cross-origin authenticated requests
- Apply network-level restrictions to limit access to the /console/api/setup endpoint from trusted networks only
- Review the GitHub Pull Request #32224 for potential configuration changes
Patch Information
As of the last NVD update, the vendor (Langgenius) disputes this vulnerability, indicating the endpoint configuration is intentional for bootstrap support. Organizations should review the Dify GitHub Discussions for the latest vendor guidance and potential configuration updates. Technical details and analysis are available in the referenced GitHub Gist Code Snippet and GitHub Gist Code Analysis.
Workarounds
- Deploy a reverse proxy (such as nginx or Apache) in front of Dify to override CORS headers with a restrictive policy
- Implement network segmentation to restrict access to the Dify console API to trusted internal networks only
- Use a web application firewall (WAF) to block cross-origin requests from untrusted domains
- Configure additional authentication mechanisms that are not vulnerable to cross-origin credential inclusion
# Example nginx configuration to enforce restrictive CORS policy
# Add to your nginx server block for the Dify application
location /console/api/setup {
# Only allow specific trusted origins
set $cors_origin "";
if ($http_origin ~* "^https://(trusted-domain\.com|app\.trusted\.org)$") {
set $cors_origin $http_origin;
}
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Authorization' always;
# Handle preflight requests
if ($request_method = 'OPTIONS') {
return 204;
}
proxy_pass http://dify_backend;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


