Reinforcement Learning-Guided Symbolic Execution for Efficient and Exploitable Smart Contract Analysis

Zhaoxuan Li, Ziming Zhao, Siqi Lu, Rui Zhang, Wenhao Li, Xiaofei Yue, Fan Terry ZhangNeurIPS 2026

TL;DR

Hunting for security bugs in smart contracts is like navigating an exponentially expanding maze: traditional tools run out of time and memory long before reaching hidden traps. RSymX acts as a compass for symbolic execution, using reinforcement learning to dynamically weigh fast code exploration against high-severity bug hunting. The result? It finds exploitable flaws—complete with the exact transaction sequences to prove them—up to 10x faster than existing tools.

What Problem Does This Paper Address?

Smart contracts manage tens of billions of dollars on blockchains like Ethereum, making any coding flaw an open invitation for multi-million-dollar heists. While static pattern-matchers and machine learning tools can flag suspicious code, they struggle to generate actual exploit sequences—the step-by-step transactions needed to prove a bug is real and reproducible.

Symbolic execution solves this by treating inputs as mathematical symbols and exploring execution paths using constraint solvers (like Z3) to find exact inputs that trigger flaws. However, real-world contracts suffer from state space explosion. Loops, cross-contract interactions, fallback functions, and attacks requiring multiple sequential transactions cause the number of possible paths to skyrocket into the hundreds of thousands.

Monthly Ethereum contract deployments and the heavy-tailed distribution of execution paths causing state explosion.

Existing tools exhaust their time and memory budgets wandering through benign code. Prior guided approaches either optimize purely for code coverage (wasting time on safe, complex branches) or vulnerability patterns (getting stuck in local optima and missing deep, multi-step exploits). We need a budget-aware guide that balances both.

Methods

The authors build RSymX on top of an existing symbolic execution engine (SymX), leaving the core execution semantics intact while adding an intelligent scheduling brain. Instead of exploring program branches blindly via standard Depth-First Search (DFS), RSymX uses a Delayed Double Deep Q-Network (3DQN) agent to rank and prioritize which symbolic states to explore next.

What makes this novel is how the agent perceives and values the execution maze:

  • Compact 20D State Features: Rather than feeding raw, heavy instruction sequences into a massive neural network, RSymX extracts a lightweight 20-dimensional vector for each state. This captures coverage progress (new instructions in true/false branches), execution cost (constraint size, call-stack depth, runtime), and transaction history (visit counts, transaction step).
  • Hybrid Reward Function: After paths are explored, states are scored bottom-up using a mixed reward:
  • Time-normalized coverage: New instructions covered divided by execution time, favoring cheap, novel paths over slow solver bottlenecks.
  • Severity-weighted bugs: Vulnerabilities weighted by impact (e.g., High severity like Reentrancy = 1.0; Informational = 0.2).
Figure 3: An example of assigning rewards to states explored by SymX.

Using a lightweight three-layer MLP, the 3DQN agent estimates these future rewards online and updates its policy iteratively as it encounters new contracts.

Datasets

The authors evaluate RSymX across five datasets (no brand-new standalone benchmarks are introduced, though Dataset 1 merges two existing ones):

  • Dataset 1: Combines SB-Curated and Mini-contracts—158 source-code contracts with 1,131 fine-grained, line-labeled vulnerabilities.
  • Dataset 2: 579 compiled EVM bytecodes with 86 file-level issues (holding >4M Ether in total).
  • Dataset 3: 13,413 wild source-code contracts (300 of these—without ground-truth labels—are used to warm-start the RL policy).
  • Dataset 4: 183,710 wild bytecodes.
  • Dataset 5: 27 real-world historical attack contracts (e.g., The DAO, FOMO3D, SmartMesh).

Key Insights and Ideas

  • Features and rewards beat heavy models: Swapping the simple 3-layer MLP for heavier architectures like Bi-LSTM, GRU, or XGBoost yielded minuscule F1 gains (~0.08%) while ballooning memory and runtime. In budget-constrained symbolic execution, domain-smart features and hybrid rewards do the heavy lifting.
  • Greedy gets you far, RL gets you deeper: An ablation showed that a non-learned greedy scheduler using the authors' hybrid heuristic achieved 95.69% F1 (up from 93.98% for DFS), while adding RL pushed it to 96.06%. The hybrid reward design accounts for most of the leap, while RL's delayed credit assignment provides the final edge on deep, multi-transaction bugs.
  • Two transactions is the sweet spot: Allowing the analyzer to chain 2 sequential transactions ($TX=2$) with a loop bound of 2 ($R=2$) jumped F1 scores from ~77% to 96.06%. Pushing to $TX=3$ doubled runtime for almost zero new discoveries.

Key Results

  • Superior Accuracy: On Dataset 1, RSymX achieved a 92.39% Overlap Score and 96.06% F1, outperforming 13 baselines across static analysis (Slither: 91.93% F1), fuzzing (RLF: 92.09% F1), and symbolic execution (MythrilQL: 86.52% F1).
  • Bytecode Dominance: On Dataset 2, RSymX hit 99.21% accuracy and 84.87% F1—beating symbolic competitors like Park-Mythril and MythrilQL by 10–20% F1 while cutting average runtime to 34.4s.
  • Massive Speedups: Compared to unguided SymX (which needed a 3,200-path budget), RSymX found more bugs within just a 400-path budget, accelerating state exploration by 2x–4x on average (cutting Dataset 1 average time from 68.4s to 30.7s) and up to 10x on specific vulnerability types. Even tightening the budget to 200 paths kept precision above 93%.
  • Real-World Exploits: Successfully flagged bugs in historical heists (like integer overflows in SmartMesh and BEC) that tools like Oyente, Manticore, and Slither missed.

Limitations and Future Work

  • No free lunch on safe contracts: While RSymX rapidly zeroes in on bugs in defective contracts, proving a safe contract is bug-free still requires broad, expensive exploration.
  • Hard budget cutoffs: Bugs hiding deeper than the path limit ($n_{\text{paths}}$), loop bound, or solver timeout will still be missed.
  • Future directions: The authors plan to port RSymX's modular scheduler into other analyzers and tackle deep-path bottlenecks using loop summarization, adaptive SMT solver timeouts, and ABI-aware call-buffer construction.

Summary updated

Abstract

Currently, frequent security incidents of Ethereum contracts have caused billions of dollars in losses. There is a pressing need to identify defective contract code and generate exploit call sequences to reproduce attacks and ensure detection accuracy. Nevertheless, the state-of-the-art (SOTA) detection methods based on symbolic execution and fuzzy testing cannot achieve the desired performance due to the state explosion problem caused by contract characteristics such as cross-contract calls and loop branches, especially in large wild contracts. To tackle this problem, we propose RSymX, an assembly strategy-guided symbolic execution for contracts that leverages reinforcement learning to dynamically balance code coverage and vulnerability discovery. Extensive experiments on open-sourced datasets demonstrate that RSymX achieves an overlap score of 92.39% and identifies many vulnerable wild instances that SOTAs misreport. Especially, its dynamic strategies improve the efficiency of state exploration by 2x~4x, and in some cases up to 10x, offering guidance for future symbolic-execution-based analyzers. The code and data are available in https://github.com/Secbrain/RSymX.
BibTeX
@inproceedings{li2026reinforcement,
  author = {Zhaoxuan Li and Ziming Zhao and Siqi Lu and Rui Zhang and Wenhao Li and Xiaofei Yue and Fan Terry Zhang},
  title = {{Reinforcement Learning-Guided Symbolic Execution for Efficient and Exploitable Smart Contract Analysis}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=0NgpgjG8bV},
}
Figure