TL;DR
KASS (Knowledge-Augmented Attack Synthesis and Simulation) is a novel multi-agent framework that bridges the gap between smart contract vulnerability detection and exploit verification. By combining retrieval-augmented planning, formal code constraints, and a hierarchical dual-loop refinement process, KASS automatically generates executable Foundry proof-of-concept (PoC) exploits. It achieves a remarkable 94.23% success rate on benchmark contracts, outperforming existing automated exploit generation tools and general AI coding baselines.
What Problem Does This Paper Address?
In the Decentralized Finance (DeFi) ecosystem, smart contract vulnerabilities carry massive financial risks. While traditional static analyzers and newer LLM-based auditors are excellent at flagging potential bugs, they typically stop at textual reporting.
This creates a severe "detection-to-execution gap." Studies show that roughly 75% of contracts flagged as vulnerable are actually unexploitable in practice—representing false positives or low-impact issues. Distinguishing a theoretical flaw from a devastating, multi-contract exploit requires a functional, reproducible Proof-of-Concept (PoC). However, existing Automated Exploit Generation (AEG) tools struggle to reconstruct complex protocol states, handle multi-contract interactions, or generate test harnesses that actually execute the vulnerable path.
Methods
KASS tackles this challenge by organizing the exploit generation process into a loop-engineered, multi-agent workflow consisting of three specialized agents:
- Planner Agent: Acts as a retrieval-augmented reasoning engine. Given a vulnerable contract and its metadata, it queries an external real-world audit knowledge base (Solodit) to find analogous historical exploits. It then synthesizes a highly structured, machine-parseable Attack Plan (in JSON format) detailing the preconditions, function call sequences, and success oracles.
- PoC-Generator Agent: Translates the abstract Attack Plan into executable Solidity code. To prevent the LLM from hallucinating invalid code, it enforces strict syntactic constraints, ensuring compiler version compatibility, code minimalism, and explicit oracle embedding (using Foundry assertions).
- Foundry-Tester Agent: Executes the generated PoC using the Foundry testing suite (
forge test -vvvv).
A core novelty of KASS is its hierarchical dual-loop refinement process:
- Inner Loop (Code-Level Repair): If the test fails due to compilation or runtime errors, the Tester Agent analyzes the execution traces and iteratively refines the attack contract code.
- Outer Loop (Strategy-Level Replanning): If the inner loop exhausts its budget because the underlying attack strategy is flawed, the failure is escalated back to the Planner Agent to generate a completely revised attack plan.
Datasets
The authors evaluated KASS using two distinct datasets:
- SmartBugs-Curated: A widely recognized academic benchmark. The authors selected 104 deterministic contracts across four major vulnerability categories: Reentrancy (31), Arithmetic (15), Unchecked Low-Level Calls (52), and Denial of Service (6).
- Real-World CVE Dataset: To test generalization, the authors manually curated 11 recent real-world smart contract vulnerabilities with official CVE tags and available source code, representing diverse and complex production environments.
Key Insights and Ideas
- The Power of Structured Intermediate Artifacts: Instead of relying on a single end-to-end prompt, separating the workflow into an abstract plan (JSON) and a syntax-constrained translation step prevents "task drift" and significantly improves code viability.
- Pruning Search Space via Execution Feedback: The inner loop functions similarly to Counterexample-Guided Inductive Synthesis (CEGIS). Each failed execution trace provides a concrete reason for failure, allowing the LLM to systematically prune invalid code patterns from its search space.
- Navigating RLHF Safety Blocks: Standard commercial LLMs often refuse to generate exploits due to safety alignment (RLHF). KASS bypasses this by initializing agents with specific "safety-navigation skills" that frame the task strictly within an authorized, professional security-auditor context.
- Semantic False Positive Filtering: KASS doesn't just find exploits; it can definitively prove when a bug is not exploitable. For example, it successfully identified a static analysis false positive where a reentrancy path was blocked by the EVM's 2,300 gas limit on
transfer()calls.
Key Results
KASS demonstrated state-of-the-art performance across both benchmarks and real-world scenarios:
- Benchmark Superiority: Using GPT-5.1 as a backbone, KASS achieved an overall success rate of 94.23% on the SmartBugs-Curated dataset. This significantly outperforms the reported results of prior tools like REX (50.00%) and a reproduced baseline of Anthropic's Claude Code (20.19%).
- Real-World Validation: KASS successfully generated valid, executable exploits for 9 out of 11 real-world CVE-tagged contracts, demonstrating its ability to handle complex, production-grade code.
- Ablation Insights: Removing the inner loop caused success rates to plummet (e.g., dropping GPT-5.1 from 94.23% to 22.4%), proving that iterative code-level refinement based on real execution traces is absolutely vital.
Limitations and Future Work
Despite its strength, KASS has a clear boundary when it comes to subtle state-dependent temporal constraints. In one failure case (the WALLET contract), the exploit required manipulating the block timestamp across multiple distinct transactions (vm.warp). Because the Planner Agent generated an atomic, single-transaction attack flow, the temporal guard failed.
Additionally, the framework is currently optimized for machine-auditable vulnerabilities (like reentrancy or overflows). The authors note that expanding KASS to handle complex, machine-unauditable economic attacks—such as price oracle manipulation—remains an open direction for future work.
Summary updated