LuaN1aoAgent: Graph-Native Autonomous Pentesting with Enforced Evidence Provenance
Hook
Most AI pentesting tools will confidently report vulnerabilities that don't exist because they confuse what GPT-4 thinks should be vulnerable with what actually is. LuaN1aoAgent solves this with enforced evidence chains that require artifact proof for every security claim.
Context
The promise of autonomous AI-powered penetration testing has produced a graveyard of demos: chatbots that run nmap and call it 'reconnaissance,' ReAct loops that hallucinate SQL injection in static sites, and plan-execute frameworks that lose track of their own discoveries after three tools calls. The core failure mode is always the same—large language models are phenomenal at reasoning about what vulnerabilities might exist based on their training data, but terrible at distinguishing between 'Apache 2.4.49 had CVE-2021-41773' and 'this specific Apache instance is actually vulnerable to that CVE.'
LuaN1aoAgent v2 attacks this problem with architectural constraints rather than prompt engineering. Built by a security researcher who clearly got frustrated with existing tools losing state and inventing findings, it implements a three-agent system where a Planner manages a persistent task dependency graph, Executors run tools in isolated Docker containers with transparent MITM gateways, and an Observer converts raw observations into a causal reasoning graph that enforces evidence provenance. You cannot write a confirmed Vulnerability node without artifact references to the HTTP responses, command outputs, or exploit results that prove it exists. The system trades simplicity for auditability—every decision flows through schema-validated terminating tools, every network request gets captured to content-addressed storage, and every graph mutation lands in a replayable JSONL event stream.
Technical Insight
The architecture revolves around three isolated agent roles running in separate Pi SDK sessions with no shared message history. The Planner operates on compressed graph views and issues structured commands that modify a persistent dependency graph:
// Planner issues graph mutations, not linear task lists
interface PlannerCommand {
create_tasks?: Array<{
id: string;
type: 'recon' | 'exploit' | 'post-exploit';
description: string;
tools: string[];
}>;
patch_task?: {
task_id: string;
updates: Partial<Task>;
};
set_dependencies?: Array<{
task_id: string;
depends_on: string[];
}>;
}
// Executors receive bounded TaskEnvelopes
interface TaskEnvelope {
task_id: string;
workspace_path: string; // Persistent across checkpoints
tools: ToolDefinition[];
context: {
target_info: string;
relevant_artifacts: ArtifactReference[]; // By hash
previous_findings: GraphNodeReference[];
};
}
The critical insight is that the Planner doesn't regenerate a full task list on every iteration—it patches affected nodes when new evidence arrives, and the runtime immediately admits newly-ready tasks without waiting for parallel execution waves to complete. This dynamic reconciliation beats batch-based replanning when you discover mid-scan that port 8080 runs an admin panel, and suddenly fifteen new exploitation tasks become relevant.
Executors run in isolated Docker containers with a transparent MITM Gateway that captures arbitrary TCP traffic while only transforming HTTP/HTTPS. The Gateway runs in a separate network namespace with a TUN device:
// Gateway architecture: TUN capture + protocol-aware relay
class TransparentGateway {
private tunDevice: TunInterface;
private protocolHandlers: Map<number, ProtocolHandler>;
async handlePacket(packet: IPPacket): Promise<void> {
if (packet.protocol === TCP && this.isHTTP(packet.payload)) {
// HTTP/HTTPS: decompress, log, re-encrypt
const req = await this.httpHandler.parse(packet);
await this.artifacts.store(req.hash, req.raw);
await this.relay(this.httpHandler.rewrite(req));
} else {
// Everything else: relay unchanged, capture raw bytes
await this.artifacts.store(packet.hash, packet.raw);
await this.relay(packet);
}
}
}
This is architecturally superior to HTTP-only proxies because agents can use raw exploit tooling (netcat reverse shells, binary protocol exploits, SMB relay attacks) without proxy-awareness, while still getting HTTP request/response pairs parsed and stored as structured artifacts. The Gateway needs NET_ADMIN and SETUID/SETGID capabilities for network namespace manipulation and iptables rules, but the Executor container itself runs with zero capabilities—all privileged operations happen in the isolated Gateway process.
The Observer operates in two modes that decouple latency-sensitive control from expensive reasoning. The synchronous Supervisor inspects recent tool calls and decides continue/checkpoint/return-to-planner based on simple heuristics (too many errors, runaway loops, task completion). The asynchronous Projector converts normalized execution events into causal graph deltas:
// Projector converts observations to evidence chains
interface GraphDelta {
add_nodes?: Array<{
type: 'Evidence' | 'Hypothesis' | 'Vulnerability' | 'Exploit';
id: string;
properties: Record<string, unknown>;
artifact_refs: string[]; // Required for Vulnerability/Exploit
}>;
add_edges?: Array<{
from: string;
to: string;
relation: 'supports' | 'refutes' | 'exploits' | 'remediates';
}>;
}
// Evidence provenance is enforced at write time
function validateGraphDelta(delta: GraphDelta): ValidationResult {
for (const node of delta.add_nodes ?? []) {
if (['Vulnerability', 'Exploit'].includes(node.type)) {
if (!node.artifact_refs?.length) {
return { valid: false, error: 'Vulnerability/Exploit nodes require artifact references' };
}
// Verify artifacts actually exist in storage
for (const ref of node.artifact_refs) {
if (!artifactStore.has(ref)) {
return { valid: false, error: `Missing artifact ${ref}` };
}
}
}
}
return { valid: true };
}
This schema validation prevents the hallucination failure mode—you cannot claim an XSS vulnerability exists without referencing the captured HTTP response that demonstrates it. The Projector runs full LLM inference passes to build Hypothesis→Vulnerability chains from raw observations, but it does so asynchronously without blocking the Executor's tool loop. If the Projector decides a port scan suggests a vulnerable Jenkins instance, it writes a Hypothesis node. If subsequent artifact analysis confirms CVE-2024-23897, it upgrades to a Vulnerability node with artifact references. If an exploit succeeds, it writes an Exploit node linking to the reverse shell output.
All state persists in a SQLite event ledger with JSONL mirrors (execution.jsonl, graph-deltas.jsonl, artifacts/). This audit trail makes the system debuggable in ways that typical agent frameworks aren't—when the Planner makes a bizarre decision, you can replay the exact graph view it saw, the artifacts it referenced, and the delta that triggered replanning. The per-task workspace survives checkpoint/resume cycles, so compiled exploits and extracted credentials don't vanish when the Planner decides to checkpoint after completing a recon wave.
Gotcha
The experimental Node.js 25+ requirement for built-in node:sqlite is a deployment killer. Production security infrastructure runs on LTS runtimes, not experimental builds that break compatibility with existing toolchains. You'll need dedicated research hosts that accept the risk of experimental features changing behavior between patch versions. The Docker-preferred sandbox mode's network namespace requirements fail in restrictive cloud environments—Fargate, Cloud Run, and locked-down Kubernetes policies won't grant NET_ADMIN capabilities to application containers, forcing fallback to weaker Bubblewrap or macOS Seatbelt isolation that can't do transparent MITM capture.
The bigger issue is unvalidated autonomous capabilities. Despite 1,481 stars and prominent AGPL licensing, there's no published evaluation harness, no reproducible benchmarks, and no peer review of the graph reasoning effectiveness. The project links to a 'top-ranked intelligent pentest' badge from a Chinese hackathon with no public results or methodology. Graph-based reasoning with the asynchronous Projector adds substantial token overhead—converting every observation into Evidence→Hypothesis chains means multiple full inference passes per task—but there's no cost analysis versus baseline ReAct agents. The architectural elegance of enforced provenance is compelling, but without benchmarks showing it actually prevents hallucinations better than simpler approaches, you're adopting research infrastructure on faith. The Pi SDK lock-in compounds this risk: migrating to different agent frameworks would require rewriting the entire runtime, not just swapping imports.
Verdict
Use if you're building reproducible security research workflows where autonomous pentesting results need forensic-grade audit trails, and you can run bleeding-edge Node.js on isolated Docker hosts with permissive capability policies. The three-agent architecture with causal reasoning graphs and artifact-backed provenance represents genuinely novel engineering that's worth studying even if you never deploy it. The transparent Gateway and per-task isolation solve real problems that typical 'AI pentesting' subprocess wrappers ignore. Skip if you need production-ready automation (experimental runtime, unvalidated benchmarks), cloud deployment (network namespace requirements break most platforms), or integration with existing agent frameworks (Pi SDK makes this a standalone runtime). This is research infrastructure that happens to do pentesting, not a hardened tool that happens to use LLMs—treat it as a reference architecture for evidence-first autonomous security tools, not a drop-in replacement for human pentesters.