svm-exploit-gym: an RL environment for Solana exploits
A verifiable RL environment where agents exploit vulnerable Solana programs, scored by execution.
Problem
An agent learning to find exploits needs a reward it can't fake, so the reward here is not a model's judgment. In svm-exploit-gym the reward is 1 only when the attacker's transactions, executed in LiteSVM, satisfy the task's success predicate, such as the attacker's balance rising or funds being drained.
How it works
- 182 verified tasks across 3 programs (vault, escrow, staking) and 8 bug classes, plus secure controls, in train, test and held-out splits.
- A Rust harness on LiteSVM builds fresh state per episode, compiles JSON actions into real instructions, enforces an attacker-only signer boundary and scores a typed success predicate.
- A marker-based generator turns secure Anchor programs with @bug blocks into buggy variants plus task specs.
- A verifier suite checks solvability, runs a differential test against the secure twin, runs anti-reward-hacking checks and a no-leak check.
- A text interface for LLM agents and a Gymnasium interface with action masks for RL.
Results
- A Claude (Sonnet) agent solved 116/140 bug tasks (83%), verified by execution.
- No false positives on secure controls: an attack on a secure control can't satisfy its predicate.
- Warm-starting MaskablePPO with Claude's solved attacks raised test success from ~4% to ~59% (mean of 3 seeds); neither arm transferred to the held-out bug class.
- Red-teaming found four ways to score without the intended exploit, each fixed with a regression test.