CVE-2025-27135
📋 TL;DR
CVE-2025-27135 is a critical SQL injection vulnerability in RAGFlow's ExeSQL component that allows attackers to execute arbitrary SQL commands on the database. This affects all deployments running RAGFlow version 0.15.1 or earlier. The vulnerability occurs because user input is directly passed to database queries without proper sanitization.
💻 Affected Systems
- RAGFlow
📦 What is this software?
Ragflow by Infiniflow
⚠️ Risk & Real-World Impact
Worst Case
Complete database compromise including data theft, data destruction, privilege escalation, and potential remote code execution if database functions allow it.
Likely Case
Unauthorized data access, data manipulation, and potential extraction of sensitive information from the database.
If Mitigated
Limited impact with proper input validation and database permission restrictions, though SQL injection attempts may still cause service disruption.
🎯 Exploit Status
SQL injection vulnerabilities are well-understood with many automated tools available. The advisory includes technical details that facilitate exploitation.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Not available
Vendor Advisory: https://github.com/infiniflow/ragflow/security/advisories/GHSA-3gqj-66qm-25jq
Restart Required: Yes
Instructions:
1. Monitor the RAGFlow GitHub repository for security updates. 2. When a patched version is released, update to the latest version. 3. Restart the RAGFlow service after updating.
🔧 Temporary Workarounds
Disable ExeSQL Component
allTemporarily disable or remove the vulnerable ExeSQL component from RAGFlow deployments.
# Remove or rename the vulnerable file
mv /path/to/ragflow/agent/component/exesql.py /path/to/ragflow/agent/component/exesql.py.disabled
Implement WAF Rules
allDeploy web application firewall rules to block SQL injection patterns targeting the ExeSQL endpoint.
# Example ModSecurity rule
SecRule ARGS "@detectSQLi" "id:1001,phase:2,deny,status:403,msg:'SQL Injection Attempt'"
🧯 If You Can't Patch
- Implement strict input validation and parameterized queries for all SQL operations
- Apply database-level controls: use least privilege accounts, enable query logging, and implement network segmentation
🔍 How to Verify
Check if Vulnerable:
Check if RAGFlow version is 0.15.1 or earlier and if the ExeSQL component exists in the installation.
Check Version:
Check RAGFlow documentation or configuration files for version information, or run: python -c "import ragflow; print(ragflow.__version__)" if available
Verify Fix Applied:
Verify that parameterized queries are implemented and user input is properly sanitized before database execution.
📡 Detection & Monitoring
Log Indicators:
- Unusual SQL queries in database logs
- Multiple failed login attempts via ExeSQL endpoint
- SQL syntax errors in application logs
Network Indicators:
- HTTP requests containing SQL keywords (SELECT, UNION, DROP, etc.) to ExeSQL endpoints
- Unusual database connection patterns
SIEM Query:
source="*ragflow*" AND ("exesql" OR "sql injection" OR "union select" OR "1=1")
🔗 References
- https://github.com/infiniflow/ragflow/blob/v0.15.1/agent/component/exesql.py
- https://github.com/infiniflow/ragflow/security/advisories/GHSA-3gqj-66qm-25jq
- https://swizzky.notion.site/ragflow-exesql-150ca6df7c03806989cefde915cf8e42?pvs=4
- https://swizzky.notion.site/ragflow-exesql-150ca6df7c03806989cefde915cf8e42