Detection of Loop-Induced Arithmetic Vulnerability in Solidity Via Invariant-Guided Symbolic Execution
Abstract
Arithmetic vulnerabilities, such as integer overflow and underflow, are among the Top 10 OWASP Solidity vulnerability list, resulting in losses amounting to billions of dollars in the past. Although existing approaches perform well on programs with simple structures, they often fail when arithmetic operations are embedded within complex constructs or unbounded loops controlling the operations directly or indirectly. To address this challenge, we propose an invariant-guided symbolic execution framework that automatically generates and validates loop invariants, transforms loops into invariant-preserving loop-free abstractions, and converts programs into Dynamic Single Assignment form for precise path-sensitive analysis. Symbolic execution then generates verification conditions enriched with arithmetic and bitwise vulnerability encodings, which are solved using the Z3 SMT solver. Evaluated on 869 smart contracts comprising over 24,000 functions and 365,000 lines of code, the framework achieved up to 95.61% precision and 93.33% recall, outperforming Oyente, Mythril, Osiris, and Solc-Verify. Compared with the strongest loop-unrolling baseline, invariant-guided reasoning improved recall from 76.2% to 86.7% while reducing timeout cases from 46 to 8, demonstrating an effective and scalable solution for detecting loop-induced arithmetic vulnerabilities in Solidity smart contracts.