Neo4j Bolt Transaction Metadata Log Injection (CVE-2026-1337)
by JoakimBulow · 2026-07-05
- Severity
- Low
- CVE
- CVE-2026-1337
- Category
- network
- Affected product
- Neo4j graph database (Bolt protocol, query.log)
- Affected versions
- Not specified in source (demonstrated with neo4j-python driver 6.0.3)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Tags
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-02 |
| Author / Researcher | JoakimBulow |
| CVE / Advisory | CVE-2026-1337 |
| Category | network |
| Severity | Low |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | neo4j, log-injection, bolt-protocol, log-forgery, graph-database, authenticated, ansi-injection |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Neo4j graph database (Bolt protocol, query.log) |
| Versions Affected | Not specified in source (demonstrated with neo4j-python driver 6.0.3) |
| Language / Platform | Python (neo4j Bolt driver) against a Neo4j server |
| Authentication Required | Yes |
| Network Access Required | Yes |
Summary
Neo4j writes the transaction metadata field supplied over the Bolt protocol directly into query.log without escaping control characters such as newlines. An authenticated user can therefore embed a crafted metadata value containing full fake log lines, which Neo4j then appends verbatim to the log file. The PoC opens one transaction that runs a real, harmless query, followed by a second transaction whose metadata contains newline-separated text formatted to look like two additional “Query started”/completion log entries for queries that never actually ran. The result is a query.log that appears to show extra queries executed by different users and IP addresses, none of which are genuine. This only occurs when Neo4j’s query logging is configured in plain-text format rather than JSON.
Vulnerability Details
Root Cause
Neo4j does not sanitize or escape control characters (in particular \n) in the Bolt transaction metadata before writing it to the plain-text query.log, allowing an attacker-controlled string to be interpreted as multiple independent log lines.
Attack Vector
- Attacker authenticates to the Neo4j Bolt endpoint (e.g.
bolt://host:7687) with valid credentials. - Attacker runs one legitimate query for contrast/cover.
- Attacker opens a second transaction whose
metadatadict contains a string that closes the current log field and injects fully formed fake “Query started” and completion log lines, including forged client IPs and usernames. - Neo4j appends the metadata value to
query.logunescaped, so the forged lines are indistinguishable from real entries except for minor formatting artifacts.
Impact
An authenticated attacker can forge or pollute Neo4j’s query audit log, undermining its use for monitoring, incident response, and forensics; the same lack of escaping could also be leveraged to inject XSS payloads into web-based log viewers or ANSI escape sequences into terminal-based log viewers.
Environment / Lab Setup
Target: Neo4j server with Bolt enabled (default port 7687), query logging in plain-text (non-JSON) format
Attacker: Python 3 with the `neo4j` driver package (pip install neo4j)
Proof of Concept
PoC Script
See
log_injection_poc.pyin this folder.
| |
The script logs in over Bolt, executes one real query for contrast, then opens a transaction with a metadata payload containing two fully-formed forged log entries (fake queries FakeQuery1/FakeQuery2 from spoofed IPs/users) which appear in query.log alongside the genuine entries.
Detection & Indicators of Compromise
Signs of compromise:
- Duplicate or orphaned “Query started” entries in
query.logwith no matching completion line (or vice versa). - Log entries referencing client IPs or usernames that don’t correspond to known infrastructure or accounts.
- Malformed trailing characters (stray quotes/braces) in otherwise normal-looking log lines.
Remediation
| Action | Detail |
|---|---|
| Primary fix | No vendor patch confirmed as of 2026-07-05 — monitor for advisory |
| Interim mitigation | Configure Neo4j query logging to JSON format (which escapes control characters), and restrict which accounts may open Bolt transactions with arbitrary metadata. |
References
Notes
Mirrored from https://github.com/JoakimBulow/CVE-2026-1337 on 2026-07-05.
| |