Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai ExploitChainAgent discover chains

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Exploit_Chaining
Last Updated 2026-10-23 12:00 GMT

Overview

Concrete agent that discovers exploit chains from engagement findings by analyzing how individual vulnerabilities compose into multi-step attack paths, using LLM reasoning or template-based discovery.

Description

The ExploitChainAgent class analyzes all findings from an engagement and identifies exploit chains — sequences of vulnerabilities where each step enables or amplances the next. Only critical, high, and medium severity findings can seed or extend a chain (low and info are excluded as they don't represent meaningful exploit primitives).

When an LLM is configured, the agent reasons about how findings compose into chains. Without an LLM, it uses template-based chain discovery with predefined vulnerability combination patterns.

Usage

Import this when you need to:

  • Discover exploit chains from engagement findings
  • Identify how individual vulnerabilities compose into attack paths

Code Reference

Source Location

  • Repository: pentest-ai
  • File: agents/exploit_chain/chain_agent.py

Signature

class ExploitChainAgent(BaseAgent):
    agent_type = "exploit_chain"
    ENTRY_MIN_SEVERITY: frozenset[str] = frozenset({"critical", "high", "medium"})

    def __init__(self, db: Any, llm: LLMClient | None = None, scope: Any = None):

    async def discover_chains(self, engagement_id: str) -> list[dict[str, Any]]:
        """Analyze findings and return exploit chains."""

Import

from agents.exploit_chain.chain_agent import ExploitChainAgent

I/O Contract

Inputs

Name Type Required Description
engagement_id str Yes The active engagement whose findings to chain

Outputs

Name Type Description
returns list[dict[str, Any]] Each chain dict: id, name, description, severity, impact, steps

Usage Examples

from agents.exploit_chain.chain_agent import ExploitChainAgent

agent = ExploitChainAgent(db, llm=my_llm, scope=scope)
chains = await agent.discover_chains("eng-123")
for chain in chains:
    print(f"Chain: {chain['name']} (severity: {chain['severity']})")
    for step in chain.get("steps", []):
        print(f"  - {step.get('action', '')}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment