Last updated

EvoGraph — Attack Chain Evolution

Interactive walkthrough: Inside RedAmon Agent

EvoGraph (Evolutive Attack Chain Graph) is RedAmon's persistent, evolutionary graph that tracks everything the AI agent does during exploitation sessions. While the Attack Surface Graph captures what exists on the target, EvoGraph captures what the agent did about it — every tool execution, every discovery, every failure, every strategic decision — across the entire attack lifecycle.


What is EvoGraph?

Every time you chat with the AI agent, EvoGraph builds a structured record of the session in Neo4j. This is not a flat log — it's a graph where steps link to findings, findings link to CVEs, failures record lessons learned, and decisions capture strategic turns. Everything is connected, queryable, and persistent across sessions.

The key insight: each new session starts with what the project's recent sessions learned. The agent knows what was tried before, what worked, and what failed — so it builds on prior work rather than starting from scratch (see Cross-Session Learning for which sessions it reads).

EvoGraph Overview


How Attack Chains Are Built

Each chat conversation with the AI agent creates an AttackChain — the root node that represents the session. As the agent works:

  1. You send a message — the agent creates an AttackChain node linked to the target (IP, domain, CVE)
  2. The agent uses a tool — each tool execution creates a ChainStep node, linked sequentially via NEXT_STEP
  3. Something is discovered — a ChainFinding node branches off the step (credential found, vulnerability confirmed, exploit succeeded)
  4. Something fails — a ChainFailure node records what went wrong and what lesson was learned
  5. A phase transition happens — a ChainDecision node records the strategic turn (informational → exploitation, user approved/rejected)
  6. The session ends — the AttackChain is updated with the final outcome, step counts, and phases reached

Attack Chain Building


The Five Node Types

NodeWhat It CapturesCreated When
AttackChainThe session itself — objective, target, status, outcomeYou start a new conversation with the agent
ChainStepA single tool execution — what tool, what arguments, what resultEach time the agent uses a tool (metasploit_console, query_graph, kali_shell, etc.)
ChainFindingImportant intelligence — vulnerabilities found, credentials discovered, exploit successesThe agent discovers something significant during a step
ChainDecisionA decision point — phase transitions, strategy changesYou approve or reject a phase transition
ChainFailureA failed attempt — what was tried, why it failed, what lesson was learnedA tool execution fails or an exploit doesn't work

Finding Types

Findings are classified by type and severity (critical / high / medium / low / info):

TypeExample
vulnerability_confirmed"CVE-2021-41773 confirmed exploitable on target"
credential_found"root:toor discovered via SSH brute force"
exploit_success"Meterpreter session 1 opened on 192.168.1.1:443"
access_gained"SSH shell established as admin user"
exploit_module_found"exploit/multi/http/apache_normalize_path_rce matches target"
service_identified"Internal MySQL discovered on port 3306"
defense_detected"WAF detected, blocking payloads"

How the Graphs Connect

EvoGraph and the recon graph are connected through bridge relationships — typed connections that link attack chain activity to the infrastructure it targets:

What HappensBridge CreatedExample
Agent targets an IPCHAIN_TARGETS / STEP_TARGETED → IPAttackChain → 192.168.1.1
Agent exploits a CVESTEP_EXPLOITED → CVEChainStep → CVE-2021-41773
Finding relates to an IPFOUND_ON → IP / SubdomainChainFinding → target.example.com
Finding relates to a CVEFINDING_RELATES_CVE → CVEChainFinding → CVE-2021-41773
Credential found for a serviceCREDENTIAL_FOR → Service / PortChainFinding → SSH on port 22
Finding proves a scanner's findingCONFIRMS → that findingChainFinding → the nuclei finding it exploited
Finding becomes a board findingEVIDENCES → the agent's own VulnerabilityChainFinding → "SQL injection in id" on the board

This means you can:

  • Click on any IP in the graph and see all attack chains that targeted it
  • View which CVEs have been successfully exploited across all sessions
  • See the full history of attempts against any part of your attack surface
  • Trace from a credential finding back to the exact step and tool that discovered it

When a ChainFinding becomes a Vulnerability

A ChainFinding belongs to its session: one node per sighting, deleted with the chat. When it names a weakness to fix on a host your recon already has, the agent also writes it as a Vulnerability of its own (source: "agent"), and the sighting points at it with EVIDENCES. That node is one per weakness, host, port, route, method and parameter: every later sighting, in any session, adds another EVIDENCES edge to the same node. It hangs off the recon node it was found on, so the Priority Board, the reports and the mute rules read it like any scanner's finding, and it outlives the chat. Which findings qualify is in the AI Agent Guide.

A finding that proves a vulnerability the scanners already reported does not become a second one: it proves that finding with CONFIRMS.


Cross-Session Learning

This is the most powerful feature of EvoGraph. When you start a new agent session, the agent automatically loads summaries of the five most recent finished sessions of the same project, newest first:

  • Objectives — what was attempted in prior sessions
  • Key findings — critical and high-severity discoveries (credentials, exploit successes, confirmed vulnerabilities)
  • Failure lessons — what was tried and why it failed ("rockyou-top1000 wordlist insufficient for SSH", "port 80 filtered, use 443 instead")
  • Outcomes — the step counts, the phases reached and how each session ended

This context is injected into the agent's system prompt, under Prior Attack Chain History, before the first reasoning step, so the agent starts with accumulated intelligence rather than a blank slate. It needs no tool call and no model call: the agent reads it from the graph.

  • Which sessions count. A session is finished once the agent has written its final answer in it (its AttackChain is completed; aborted counts too). A chat you stopped, or one still waiting for an approval, has not finished and is not read. The chat you are in is never read.
  • When it is read. Once, when the chat starts. Later messages in the same chat, and a reopened older chat, keep the summary they started with; a session that finishes in another chat meanwhile shows up in the next new chat. If the graph does not answer within 15 seconds, the chat starts with "No prior sessions." and goes on.
  • Whose sessions. Every session of the project, whoever ran it, so a collaborator's new chat on a shared project reads the project's sessions, never those of their own projects.
  • Untrusted data. The summaries were written while the agent read the target's output, so the prompt fences them like tool output: the agent treats them as data, never as instructions.
  • Fireteam members do not receive the summary; the agent that deploys them does.

Example: If Session A discovered that port 80 is filtered and SSH brute force with a small wordlist failed, Session B will:

  • Skip port 80 and try port 443 directly
  • Use a larger wordlist for SSH
  • Build on any credentials or access already discovered

Cross-Session Evolution


Dual Memory Architecture

EvoGraph uses a dual-recording pattern for maximum reliability:

LayerPurposeSpeedPersistence
In-memory lists (AgentState)Fast working memory for the current session's LLM contextInstantSession only
Neo4j graph (EvoGraph)Long-term persistent memory for cross-session queriesAsync (fire-and-forget)Permanent

Both are populated at the same moment — when the agent analyzes a tool's output. The in-memory lists are used by format_chain_context() to build the structured prompt that the LLM sees every iteration. The Neo4j graph is used by query_prior_chains() to load cross-session context at the start of new sessions.

This means:

  • The agent's reasoning is never blocked by a slow or unavailable graph database
  • The graph writes are idempotent (MERGE operations) so retries are safe
  • Cross-session learning works even if the current session's in-memory data is cleared

Querying Attack Chains

You can ask the AI agent about attack chain history through the chat interface:

  • "What attack chains have been run against this project?"
  • "What findings were discovered in previous sessions?"
  • "What exploits have succeeded on 10.0.0.5?"
  • "What approaches failed against the SSH service?"
  • "Show me all credentials found across all sessions"

The agent translates these into Cypher queries against the EvoGraph in Neo4j and returns structured summaries.


Semantic Chain Context

Instead of showing the LLM a flat chronological list of every tool execution, EvoGraph structures the session context into semantic sections with a three-tier step display:

  1. Findings -- what has been discovered, deduplicated by title and sorted by severity (critical first). Each finding shows evidence, CVEs, related IPs, and confidence when available.
  2. Failed Attempts -- what went wrong and what lesson was learned (truncated to 300 chars)
  3. Decisions -- strategic turns (phase transitions, strategy changes)
  4. Earlier Steps (summary tier) -- up to 50 older iterations shown as compact one-liners (tool name + truncated analysis), preventing total amnesia on long sessions
  5. Recent Steps -- last 20 iterations in full detail with thought, args, analysis, and raw output for the last step

The LLM sees the most important information first -- key discoveries and lessons learned -- rather than having to scan through dozens of identical-looking step entries. Duplicate findings are automatically merged (keeping the earliest occurrence, upgrading severity/confidence from later duplicates). Steps degrade gracefully with age: full detail for recent, one-liners for older, omitted (with count) for the oldest.


Technical Details

For full implementation details, see:


Next Steps

  • AI Agent Guide — learn how to use the agent that builds these chains
  • Attack Surface Graph — understand the recon graph that EvoGraph bridges to
  • Red Zone — explore the graph visualization
  • Anatomy of a Think Step — how the agent writes to the chain: output_analysis.chain_findings per step, and how the Attack Chain Progress history is fed back into every prompt