Open source · MCP security

The leak is a path.
Close it.

LethalPath maps your AI agent’s tools as a graph, finds the routes from untrusted input to public output, and computes a minimum cut — the exact permissions to revoke.

Apache-2.0Runs locallyFalkorDB 6.0.2

lethalpath scan · fs-git FalkorDB 6.0.2
1 · A STRANGER 2 · YOUR AGENT 3 · YOUR DATA public issue github read agent context filesystem write private files git push public repo
Route closed. The files stay private.
0 / 7

One unedited run. A public issue taints the agent context, and a private folder leaves through git.push. Revoking git.push closes the route. See the exact queries.

The problem

Three permissions you would approve. One path you would not.

No tool misbehaves. The bug is in the arrangement: one agent, one context, and three abilities that add up to exfiltration.

read issue read files publish each one, you would approve

Fine alone

Read a public issue. Read a private folder. Publish. Every grant is reasonable on its own.

issue agent notes public one sentence is the instruction the folder is the payload

Dangerous together

A stranger’s sentence rides into the agent’s context. Your files leave with it.

revoke publish 3 of 4 tasks keep working

The minimum cut

Revoke one grant. The route closes; the other declared work keeps running.

Replayed against published incidents from GitHub MCP, Supabase, WhatsApp and Postmark. See the evidence.

It also happens with no attacker: in a controlled study, depending on the model, 11.5–41.3% of agent runs passed credentials across MCP servers when the task allowed redacting them (MCPHunt). Meta’s Agents Rule of Two and OWASP LLM06 recommend the same remedy: don’t give one agent all three abilities.

How it works

From config to a verified cut.

Three deterministic steps. There is no model in the runtime; the graph decides, and the CLI prints the receipt.

Read the config

Point scan at an MCP config. LethalPath labels every tool by what it reads and writes, redacts secrets before anything reaches the graph, and names tools it cannot classify.

Find the path

One Cypher traversal anchors on the shared context and returns the routes from untrusted input to a public sink, with every tool on the path named.

Cut and verify

algo.maxFlow computes the flow. LethalPath walks the residual graph, compares both canonical cuts, then re-runs the traversal with the revoked grants excluded.

one run · fs-git

$ node packages/cli/dist/index.js scan

config fs-git · public issue → private folder → public repo

graph scan_fs-git · 11 nodes · 9 edges · ready

LEAK PATHS

1 4 hops project folder → filesystem.read → context → git.push → public repo

$ node packages/cli/dist/index.js fix

max-flow 2

cut write side · git.push → public repo

revoke git.push

verified 0 of 1 routes remain

tasks 3 of 4 keep working

output copied from docs/live-evidence/

Evidence

Every number has a file behind it.

Forty seeded configs, one public config, and the committed transcripts. Read the evidence.

40/40 seeded configs: every planted route found detection.json
40/40 fix cases: cut matches; route cases verified closed fix-quality.json
8/8 clean configs answered with zero routes detection.json
567 routes on a public config, closed by nine revocations docs/live-evidence/

The 40 cases are synthetic and generated by us; the 567-route config is built from the official MCP server READMEs. What this proves is that the engine is consistent with its spec. Read the limits.

Demo

The whole run, in three minutes.

Scan finds the route. Fix computes the minimum cut, revokes it, and re-runs the query. Then a real 567-route config, the runtime guard, and the evidence. 3:20 · captions on.

lethalpath demo · scan → cut → guard → evidence 3:20
One committed run, replayed end to end. Every number in the video is printed by a command in this repository. Made by Bhanu Nagpure.

The fix

It doesn’t stop at the risk. It computes the permissions to remove.

algo.maxFlow returns flows, not a cut. LethalPath walks the residual graph, compares both canonical cuts, and picks the one that costs fewer grants and keeps more declared tasks.

MATCH (p:Resource {sensitivity:'private'})
WHERE p.visibility IS NULL OR p.visibility <> 'public'
WITH collect(p) AS src
MATCH (s:Resource {visibility:'public'})
WHERE s.sensitivity IS NULL OR s.sensitivity <> 'private'
WITH src, collect(s) AS dst
CALL algo.maxFlow({
  sourceNodes: src,
  targetNodes: dst,
  relationshipTypes: ['FLOWS'],
  capacityProperty: 'capacity'
})
YIELD maxFlow, edges, edgeFlows
RETURN maxFlow, edges, edgeFlows
fs-git · fix committed run
graphscan_fs-git · 11 nodes · 9 edges
leak paths1
max flow2
cutwrite side · git.push → public repo
revokegit.push
verified0 of 1 routes remain
tasks3 of 4 keep working

The second query re-runs the traversal without the revoked grant. Zero is the receipt. See the exact queries.

Built on FalkorDB

The leak is a reachability question, so it runs on a graph.

The leak is a reachability question: can an untrusted input reach a public sink through this agent’s context? A vector index can rank tools; it cannot answer that. The fix is a flow problem on the same graph.

  • Path query. One anchored traversal, bounded at five hops per segment, with the tools named on the path.
  • Fix query. CALL algo.maxFlow on one capacity relationship type, then a residual cut in code.
  • Read-only boundary. Every read uses GRAPH.RO_QUERY, with a 3 s timeout, a write-keyword guard and a LIMIT cap.
  • One graph per scan. scan_<name> isolates every config on one instance.
cut public issue trust: untrusted github.read reads untrusted private folder sensitivity: private filesystem.read reads private agent context shared by every tool git.push writes public public repo visibility: public FLOWS FLOWS FLOWS FLOWS FLOWS
capacity = 1 + declared tasks · structural HOSTS edges omitted

Install

Run it locally.

The repo is the distribution. Clone it, start a pinned FalkorDB, build once, then scan.

  • Docker for FalkorDB 6.0.2
  • Node 20 or newer
  • pnpm 9
  • No account, no telemetry, no config uploaded
terminal
# clone and start FalkorDB 6.0.2
git clone https://github.com/bhanu-dev82/lethalpath
cd lethalpath
docker compose up -d
pnpm install && pnpm build

# find the routes, then compute the cut
node packages/cli/dist/index.js scan
node packages/cli/dist/index.js fix

Limits

Know the edges.

  • Labels are inferred from tool names, not server code. Unmatched tools are named, never silently trusted.
  • Five hops per segment. The traversal is bounded around the context. Longer routes are outside the model.
  • The guard is a demo. Real MCP stdio, simulated tool results. No real GitHub, filesystem or git server sits behind it yet.

Read the full threat model and limits →