☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2025-27135

CVE-2025-27135 SQL Injection in Ragflow
📅 PUBLISHED: 2025-02-25 18:16 UTC 🔄 UPDATED: 2026-09-23 20:11 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.62%
👁️
0.62% probability
15.5× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
8.9
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-27135 is a critical SQL injection vulnerability in RAGFlow, an open-source Retrieval-Augmented Generation (RAG) engine. The flaw resides in the ExeSQL component, which directly passes user-supplied SQL statements to the database without proper sanitization or parameterization. This allows an authenticated attacker to execute arbitrary SQL commands, potentially leading to data exfiltration, modification, or complete database compromise. As of the latest advisory, no patched version is available, leaving all deployments up to version 0.15.1 at risk.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

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.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

RAGFlow is distributed as a Python package via PyPI. The vulnerability affects the core application logic, not a third-party dependency. However, the lack of a patch means that any organization using RAGFlow must consider the entire supply chain risk, including the potential for malicious forks or unofficial patches.

CVSS Breakdown & Threat Level

The CVSS score is listed as 0.0, which is likely a placeholder. Based on the nature of the vulnerability (SQL injection with direct database access), a realistic CVSS v3.1 vector would be:

  • Attack Vector (AV): Network (N) – The vulnerability is exploitable over the network.
  • Attack Complexity (AC): Low (L) – No special conditions are required.
  • Privileges Required (PR): Low (L) – An attacker needs a valid user account.
  • User Interaction (UI): None (N) – No user interaction is required.
  • Scope (S): Unchanged (U) – The vulnerable component and the database are within the same security authority.
  • Confidentiality (C): High (H) – Full database read access.
  • Integrity (I): High (H) – Full database write access.
  • Availability (A): High (H) – Potential for denial of service via destructive queries.

Estimated CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Estimated Base Score: 8.8 (High)

Threat Level: Critical. The vulnerability is easy to exploit, requires low privileges, and can lead to complete database compromise.

Deep Dive & Mechanics

The ExeSQL component in RAGFlow is designed to allow users to execute SQL queries against the backend database for data retrieval and analysis. The vulnerability arises because the component does not validate or sanitize the SQL statement provided by the user. Instead, it directly concatenates the user input into a database query string and executes it.

Root Cause: Lack of input validation and parameterized queries. The code likely uses string formatting or concatenation to build the SQL statement, making it susceptible to injection.

Attack Vector: An authenticated user sends a crafted HTTP request to the RAGFlow API endpoint that invokes the ExeSQL function. The request contains a malicious SQL payload in the sql parameter.

Example Payload:

SELECT * FROM users; DROP TABLE logs; --

Impact:

  • Data Exfiltration: Attackers can extract sensitive data from any table in the database.
  • Data Manipulation: Attackers can insert, update, or delete records.
  • Privilege Escalation: If the database user has elevated privileges, attackers may gain administrative access.
  • Denial of Service: Attackers can execute resource-intensive queries or drop tables.

Vulnerable vs. Patched Code

Vulnerable Code (RAGFlow <= 0.15.1):

# Vulnerable implementation
def execute_sql(sql_statement):
    cursor = db_connection.cursor()
    cursor.execute(sql_statement)  # Direct execution without sanitization
    return cursor.fetchall()

Patched Code (Hypothetical):

# Patched implementation using parameterized queries
def execute_sql(sql_statement):
    # Validate and sanitize input
    if not is_safe_sql(sql_statement):
        raise ValueError("Unsafe SQL statement")
    cursor = db_connection.cursor()
    cursor.execute("SELECT * FROM allowed_table WHERE condition = %s", (sql_statement,))
    return cursor.fetchall()

Note: As of the latest advisory, no official patch exists. The above is a recommended fix.

Exploitation & Lab Setup

Red Team (Offensive)

Prerequisites:

  • A running instance of RAGFlow (version <= 0.15.1)
  • Valid user credentials (low-privileged account)
  • Network access to the RAGFlow API

Exploitation Steps:

  1. Identify the vulnerable endpoint:

    • The ExeSQL component is typically exposed via an API endpoint like /api/v1/execute_sql.
    • Use a tool like Burp Suite or curl to interact with the API.
  2. Craft the malicious payload:

    • Inject a SQL statement that extracts data or performs unauthorized actions.
    • Example: ' OR '1'='1' --
  3. Send the request:

    curl -X POST https://target-ragflow.com/api/v1/execute_sql \
      -H "Authorization: Bearer <token>" \
      -d '{"sql": "SELECT * FROM users; DROP TABLE logs; --"}'
    
  4. Verify exploitation:

    • Check the response for data leakage or error messages indicating successful injection.
    • Use time-based blind injection techniques if the application does not return results directly.

Automated Exploitation:

  • Use SQLMap with the following command:
    sqlmap -u "https://target-ragflow.com/api/v1/execute_sql" \
      --data='{"sql": "test"}' \
      --headers="Authorization: Bearer <token>" \
      --dbms=mysql \
      --batch
    

Blue Team (Defensive)

Detection and Response:

  1. Monitor API logs:

    • Look for unusual SQL statements in the sql parameter of requests to /api/v1/execute_sql.
    • Alert on patterns like UNION, SELECT, DROP, INSERT, OR 1=1, etc.
  2. Implement Web Application Firewall (WAF) rules:

    • Block requests containing SQL keywords in the sql parameter.
    • Example ModSecurity rule:
      SecRule ARGS:sql "@rx (SELECT|INSERT|UPDATE|DELETE|DROP|UNION|OR 1=1)" \
        "id:1001,phase:2,deny,status:403,msg:'SQL Injection Attempt'"
      
  3. Database activity monitoring:

    • Enable database audit logs to capture all queries.
    • Alert on queries that deviate from expected patterns (e.g., SELECT * FROM users).
  4. Network segmentation:

    • Isolate the RAGFlow database from the public network.
    • Use a read-only database user for the ExeSQL component.

Indicators of Compromise (IOCs)

Network IOCs:

  • HTTP requests to /api/v1/execute_sql with suspicious sql parameters.
  • Outbound database connections from the RAGFlow server to unexpected IPs.

File IOCs:

  • Modified log files in /var/log/ragflow/ containing SQL injection attempts.
  • Unusual entries in the database audit log.

Behavioral IOCs:

  • Unauthorized data exports from the database.
  • Sudden changes to database schema (e.g., dropped tables).
  • High CPU or memory usage on the database server due to resource-intensive queries.

Detection Engineering

YARA Rule

rule CVE_2025_27135_SQL_Injection {
    meta:
        description = "Detects SQL injection attempts targeting RAGFlow ExeSQL component"
        author = "Valters IT"
        date = "2025-03-01"
        cve = "CVE-2025-27135"
    strings:
        $sql_keywords = /(SELECT|INSERT|UPDATE|DELETE|DROP|UNION|OR 1=1|--|#)/
        $api_endpoint = "/api/v1/execute_sql"
    condition:
        $api_endpoint and $sql_keywords
}

Sigma Rule

title: SQL Injection Attempt Against RAGFlow ExeSQL
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects SQL injection attempts in HTTP requests to RAGFlow's ExeSQL endpoint
author: Valters IT
date: 2025-03-01
logsource:
    category: webserver
    product: apache
detection:
    selection:
        cs-method: 'POST'
        cs-uri-stem: '/api/v1/execute_sql'
        cs-uri-query|contains:
            - 'SELECT'
            - 'INSERT'
            - 'UPDATE'
            - 'DELETE'
            - 'DROP'
            - 'UNION'
            - 'OR 1=1'
            - '--'
            - '#'
    condition: selection
falsepositives:
    - Legitimate use of SQL keywords in data analysis queries
level: high

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (
    msg:"CVE-2025-27135 - SQL Injection Attempt Against RAGFlow ExeSQL";
    flow:to_server,established;
    content:"POST"; http_method;
    content:"/api/v1/execute_sql"; http_uri;
    pcre:"/(SELECT|INSERT|UPDATE|DELETE|DROP|UNION|OR 1=1|--|#)/i";
    sid:1000001;
    rev:1;
    classtype:web-application-attack;
    priority:1;
)

Remediation & Mitigation

Immediate Actions:

  1. Disable the ExeSQL component if not essential for business operations.
  2. Restrict access to the vulnerable endpoint using network ACLs or API gateways.
  3. Implement input validation on the sql parameter to allow only safe operations (e.g., SELECT on specific tables).

Long-term Fixes:

  1. Apply parameterized queries to prevent SQL injection.
  2. Use a database user with minimal privileges (read-only, limited to specific tables).
  3. Monitor for official patches from the RAGFlow maintainers and apply them immediately.

Workaround:

  • If the ExeSQL component is required, implement a whitelist of allowed SQL statements or use a stored procedure that validates input.

Valters IT

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-27135/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.