Описание
Flowise: Cypher Injection in GraphCypherQAChain
Summary
The GraphCypherQAChain node forwards user-provided input directly into the Cypher query execution pipeline without proper sanitization. An attacker can inject arbitrary Cypher commands that are executed on the underlying Neo4j database, enabling data exfiltration, modification, or deletion.
Vulnerability Details
| Field | Value |
|---|---|
| Affected File | packages/components/nodes/chains/GraphCypherQAChain/GraphCypherQAChain.ts |
| Affected Lines | 193-219 (run method) |
Prerequisites
To exploit this vulnerability, the following conditions must be met:
- Neo4j Database: A Neo4j instance must be connected to the Flowise server
- Vulnerable Chatflow Configuration:
- A chatflow containing the Graph Cypher QA Chain node
- Connected to a Chat Model (e.g., ChatOpenAI)
- Connected to a Neo4j Graph node with valid credentials
- API Access: Access to the chatflow's prediction endpoint (
/api/v1/prediction/{flowId})
Root Cause
In GraphCypherQAChain.ts, the run method passes user input directly to the chain without sanitization:
Impact
An attacker with access to a vulnerable chatflow can:
- Data Exfiltration: Read all data from the Neo4j database including sensitive fields
- Data Modification: Create, update, or delete nodes and relationships
- Data Destruction: Execute
DETACH DELETEto wipe entire database - Schema Discovery: Enumerate database structure, labels, and properties
Proof of Concept
poc.py
Test Environment Setup
1. Start Neo4j with Docker:
2. Create test data (in Neo4j Browser at http://localhost:7474):
3. Configure Flowise chatflow (see screenshot)
Exploitation Steps
Evidence
Cypher injection reaching Neo4j directly:
The error message comes from Neo4j, proving the injected Cypher is executed directly.
Data destruction confirmed:
Empty result indicates all nodes were deleted.
Sensitive data exfiltration:
Пакеты
flowise
<= 3.0.13
3.1.0
flowise-components
<= 3.0.13
3.1.0
Связанные уязвимости
Flowise is a drag & drop user interface to build a customized large language model flow. Prior to 3.1.0, the GraphCypherQAChain node forwards user-provided input directly into the Cypher query execution pipeline without proper sanitization. An attacker can inject arbitrary Cypher commands that are executed on the underlying Neo4j database, enabling data exfiltration, modification, or deletion. This vulnerability is fixed in 3.1.0.