Pojun: How Dual-Graph State Machines Solve the AI Pentest Hallucination Problem
Hook
In real deployments, Pojun burned 2.7 billion tokens across 12 penetration tests—and still required human verification for only 20% of findings. That's the inverse of typical AI security scanners, where 80% of 'critical' alerts evaporate under scrutiny.
Context
Autonomous penetration testing tools have a credibility problem. Traditional LLM-based security scanners produce findings like 'Possible SQL injection detected' based on version string matches or single HTTP responses, forcing human analysts to manually verify the majority of alerts. When GPT-4 tells you a target is vulnerable to CVE-2023-12345 because it saw 'Apache 2.4.49' in a Server header, you still need to confirm the vulnerability actually exists, extract proof, and document the exploitation chain before including it in a client deliverable.
Pojun emerged from Baidu's internal attack-defense competitions where report quality determined winners—judges rejected findings without mechanically reproducible proof, and stopping at vulnerability discovery (L2 authentication bypass) instead of pushing to data exfiltration (L4 financial impact) lost points. The core problem wasn't LLM capability but architecture: existing autonomous pentest tools treated each scan as an isolated conversation, had no shared memory across tasks, and lacked enforcement mechanisms to prevent agents from declaring 'goal achieved' when they'd merely found a login page. Pojun's dual-graph state machine with hardcoded evidence gates and automatic continuation chains emerged as a solution to make AI pentesting produce reports that survive audit scrutiny without 80% manual rework.
Technical Insight
Pojun implements two independent graph databases that communicate through anchor points. The asset graph stores global infrastructure truth—IP addresses, domains, services, technology fingerprints, credentials—that persists across all tasks and projects. The exploration graph contains per-task intent chains: 'find login panel' spawns 'test SQL injection' which spawns 'exfiltrate user table' which spawns 'crack admin hash.' Every 800 milliseconds, a planner agent receives the delta of both graphs since the last invocation, analyzes what changed, and pushes 0-4 new intents into a frontier queue. Workers claim intents via compare-and-swap, execute real tools (sqlmap, nuclei, ffuf), and write findings back to both graphs—which triggers the next planner round.
The separation is deliberate. Asset nodes have identity defined by connection strings (IP+port+protocol) and accumulate attributes from multiple tasks: if Task A discovers nginx 1.18 on 192.168.1.10:443 and Task B later finds a valid credential for the same host, both facts attach to the same asset node. Exploration nodes have identity defined by intent semantics and parent chains: 'test authentication bypass on login.php' in Task A is completely separate from the identically-worded intent in Task B, even if both target the same asset. Anchor edges stitch them: an exploration node 'exploit SQLi in /api/users' points to asset node '192.168.1.10:443' as its target, and when that exploration succeeds, it writes a 'credential_harvested' fact back to the asset.
Here's how the planner prompt enforces continuation chains:
# Injected into every planner invocation, not editable via UI
CONTINUATION_POLICY = """
When a finding is confirmed as high or critical severity:
1. SQL injection → spawn data exfil intent + credential harvest intent
2. File upload → spawn webshell capability probe intent
3. Auth bypass → spawn privilege escalation intent + lateral movement intent
4. RCE → spawn reverse shell listener + post-exploit recon intent
Do NOT mark task complete until continuation chain reaches:
- L4 impact (data exfil, financial loss, PII exposure) OR
- Confirmed dead-end (patched, WAF blocked, no further access) OR
- Timeout threshold reached
Version-match findings (CVE-2023-xxxxx possible on Apache 2.4.x)
without execution proof are NOT valid terminal states.
"""
This policy lives in code, not in user-editable system prompts, so jailbreak attempts like 'ignore previous instructions' cannot disable it. When a worker completes the 'test SQL injection' intent and writes a finding with severity='critical' and proof containing actual database query results, the graph write triggers an edge-add event. The next planner round sees this new high-severity node and the hardcoded policy forces it to spawn child intents for data exfiltration and credential harvesting—the task cannot reach 'goal_met' state until those chains complete or timeout.
Evidence gating happens at write time through multi-key deduplication. Every finding must include:
type Finding struct {
AssetID string // Which asset graph node
Severity string // critical/high/medium/low/info
ProofType string // http_response/command_output/traffic_diff
ProofDigest string // SHA256 of captured traffic or output
TrafficRefs []string // Pointers to MITM proxy archives
Reproducible bool // Can we re-trigger this?
}
func (f *Finding) Validate() error {
if f.Severity == "critical" || f.Severity == "high" {
if f.ProofType == "version_match" {
return errors.New("high/critical findings require execution proof")
}
if len(f.TrafficRefs) == 0 {
return errors.New("must bind to captured HTTP traffic")
}
}
// Asset must exist in asset graph and be task-owned
if !g.AssetGraph.IsAnchoredTo(f.AssetID, currentTaskID) {
return errors.New("finding references out-of-scope asset")
}
return nil
}
If a worker tries to write 'Critical: SQL injection possible based on error message,' the Validate() guard rejects it for having ProofType='version_match' and zero traffic refs. The LLM must instead capture the actual SQL query, the database response, and bind the finding to the SHA256 digest of the proxy-intercepted HTTP request. Every HTTP/S request flows through an integrated MITM proxy (automatic cert signing for HTTPS) that archives request/response pairs into immutable storage. Findings without traffic bindings cannot reach the database.
Vulnerability intelligence runs as a time-stream subscription separate from the graph engine. Every 30 minutes, aggregators poll NVD incremental feeds, CISA KEV catalog, and GitHub for CVE PoC repos. New entries with CVSS≥9.0 trigger reverse fingerprint matching: 'Apache Tomcat 9.0.62' in the asset graph gets matched against 'CVE-2024-xxxx affects Tomcat 9.0.60–9.0.64' and injects a hint into active tasks targeting that asset. This differs from static CVE databases by pushing recent critical disclosures into ongoing work rather than requiring manual lookups.
The three-channel LLM routing is naive but functional:
channels := []LLMChannel{
{Provider: "deepseek", Model: "deepseek-chat", RPM: 60},
{Provider: "openai", Model: "gpt-4o-mini", RPM: 500},
{Provider: "claude", Model: "claude-3-5-haiku", RPM: 50},
}
currentIndex := 0
func InvokeLLM(prompt string) (string, error) {
for attempts := 0; attempts < 3; attempts++ {
ch := channels[currentIndex % len(channels)]
resp, err := ch.Call(prompt)
if err == nil { return resp, nil }
currentIndex++ // Round-robin on failure
}
return "", errors.New("all channels exhausted")
}
No cost optimization, no semantic routing (cheap model for recon, expensive for exploitation), no batching. Every worker and planner invocation is a separate synchronous API call. The 93% prompt cache hit rate comes from repeating identical system prompts and graph schemas across invocations—Claude and GPT-4 both cache prompt prefixes, so only the graph delta JSON changes per round. Still, if you configure three expensive models, you'll burn tokens rapidly despite caching.
Gotcha
The C2 subsystem is essentially a logging shell, not a command execution framework. Pojun can route reverse connections through SSH relays and capture output, but actually running post-exploitation commands requires external tools like Metasploit, Cobalt Strike, or even basic netcat. The platform provides connection listeners and traffic logging, but no built-in command dispatch, no payload generation, no privilege escalation modules. If your engagements depend heavily on post-exploitation (lateral movement, persistence, credential dumping), you'll still need a full-featured C2 alongside Pojun.
Deployment friction is real. The privileged helper daemon (pojun-hostd) that auto-installs tools only works on Linux. macOS users cannot use the one-click installation and must manually brew install 22 different scanners (nuclei, sqlmap, ffuf, httpx, subfinder, etc.). Windows deployments require Docker with all tools pre-baked into the image, adding gigabytes to the container and complicating tool version updates. The tool ecosystem is also heavily web-focused—if you primarily test thick clients, mobile apps, or compiled binaries, most of the 66 integrated tools provide little value.
Secrets management is rudimentary. Session cookies and auth tokens live in a per-task credential jar stored in PostgreSQL as plaintext. LLM API keys go into config.json in cleartext. Findings containing harvested credentials are stored unencrypted in the database. There's no integration with HashiCorp Vault, no key rotation, no encryption at rest. For commercial engagements where you're handling client credentials or PII, you'll need to layer your own secrets management and ensure the PostgreSQL instance has disk encryption enabled.
Verdict
Use if: You run recurring penetration tests against similar target profiles (web apps, APIs, SaaS platforms) where deliverable report quality and audit trails matter more than iteration speed. The dual-graph architecture with evidence gates genuinely solves the false-positive problem that plagues LLM-based scanners, and the automatic continuation chains push beyond surface-level findings to actual impact demonstration. If you've ever spent days manually verifying an AI scanner's output or had clients reject reports for lacking reproducible proof, Pojun's traffic snapshot binding and hardcoded severity gates will save material time. Also choose this when target scope spans multiple similar applications where cross-task asset reuse provides compounding value—the global asset graph deduplicates reconnaissance work across engagements.
Skip if: Your work is primarily internal network pivoting and post-exploitation (the SSH relay C2 is barebones), you need Windows-native deployment without Docker (not supported), you run macOS and lack tolerance for manually installing 22 Homebrew packages, you primarily test thick clients or compiled binaries where the web-focused tool ecosystem provides little value, or you need semantic LLM routing and cost optimization (the three-channel round-robin is unsophisticated). Also skip if your threat model includes adversaries with database access—the plaintext credential storage and lack of secrets management make this unsuitable for high-security environments without additional hardening.