Lune

FSE2024Top-tier venue

Demystifying Invariant Effectiveness for Securing Smart Contracts

Zhiyang Chen, Ye Liu, Sidi Mohamed Beillahi, Yi Li, Fan Long

Abstract

Smart contract transactions associated with security attacks often exhibit distinct behavioral patterns compared with historical benign transactions before the attacking events. While many runtime monitoring and guarding mechanisms have been proposed to validate invariants and stop anomalous transactions on the fly, the empirical effectiveness of the invariants used remains largely unexplored. In this paper, we studied 23 prevalent invariants of 8 categories, which are either deployed in high-profile protocols or endorsed by leading auditing firms and security experts. Using these well-established invariants as templates, we developed a tool Trace2Inv which dynamically generates new invariants customized for a given contract based on its historical transaction data. We evaluated Trace2Inv on 42 smart contracts that fell victim to 27 distinct exploits on the Ethereum blockchain. Our findings reveal that the most effective invariant guard alone can successfully block 18 of the 27 identified exploits with minimal gas overhead. Our analysis also shows that most of the invariants remain effective even when the experienced attackers attempt to bypass them. Additionally, we studied the possibility of combining multiple invariant guards, resulting in blocking up to 23 of the 27 benchmark exploits and achieving false positive rates as low as 0.28%. Trace2Inv significantly outperforms state-of-the-art works on smart contract invariant mining and transaction attack detection in accuracy. Trace2Inv also surprisingly found two previously unreported exploit transactions.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

7 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Automated Attack Synthesis for Constant Product Market Makers cites SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses
  • Precise Static Identification of Ethereum Storage Variables cites Ethainter: a smart contract security analyzer for composite vulnerabilities
  • Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks cites Making Smart Contracts Smarter
  • Ethainter: a smart contract security analyzer for composite vulnerabilities cites Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks
  • Ethainter: a smart contract security analyzer for composite vulnerabilities cites Making Smart Contracts Smarter
  • HOUSTON: Real-Time Anomaly Detection of Attacks against Ethereum DeFi Protocols cites Ethainter: a smart contract security analyzer for composite vulnerabilities
  • HOUSTON: Real-Time Anomaly Detection of Attacks against Ethereum DeFi Protocols cites Making Smart Contracts Smarter
  • sFuzz: an efficient adaptive fuzzer for solidity smart contracts cites Making Smart Contracts Smarter
  • SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses cites Making Smart Contracts Smarter
  • SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses cites sFuzz: an efficient adaptive fuzzer for solidity smart contracts
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers7

  1. Detecting Various DeFi Price Manipulations with LLM ReasoningJuantao Zhong, Daoyuan Wu, Ye Liu, Maoyi Xie et al.ASE 2025 · 3 citations
  2. Precise Static Identification of Ethereum Storage VariablesSifis Lagouvardos, Yannis Bollanos, Michael Debono, Neville Grech et al.ICSE 2026 · 2 citations
  3. HOUSTON: Real-Time Anomaly Detection of Attacks against Ethereum DeFi ProtocolsDongyu Meng, Fabio Gritti, Robert McLaughlin, Nicola Ruaro et al.NDSS 2026 · 2 citations
  4. Automated Attack Synthesis for Constant Product Market MakersSujin Han, Jinseo Kim, Sung-Ju Lee, Insu YunISSTA 2025
  5. Democratizing the Cryptocurrency Ecosystem by Just-In-Time Transformation of Mining ProgramsWei Liu, Zhenhua Li, Feng Qian, Feiyu Jin et al.ASE 2025

Builds on16

  1. Making Smart Contracts SmarterLoi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena et al.CCS 2016 · 2,306 citations
  2. Sereum: Protecting Existing Smart Contracts Against Re-Entrancy AttacksMichael Rodler, Wenting Li, Ghassan O. Karame, Lucas DaviNDSS 2019 · 298 citations
  3. sFuzz: an efficient adaptive fuzzer for solidity smart contractsTai D. Nguyen, Long H. Pham, Jun Sun, Yun Lin et al.ICSE 2020 · 260 citations
  4. SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow AnalysesJaeseung Choi, Doyeon Kim, Soomin Kim, Gustavo Grieco et al.ASE 2021 · 164 citations
  5. Ethainter: a smart contract security analyzer for composite vulnerabilitiesLexi Brent, Neville Grech, Sifis Lagouvardos, Bernhard Scholz et al.PLDI 2020 · 163 citations

Related papers

  1. VERISMART: A Highly Precise Safety Verifier for Ethereum Smart ContractsSunbeom So, Myungho Lee, Jisu Park, Heejo Lee et al.S&P 2020 · 133 citations
  2. eTainter: detecting gas-related vulnerabilities in smart contractsAsem Ghaleb, Julia Rubin, Karthik PattabiramanISSTA 2022 · 57 citations
  3. Automated Inference on Financial Security of Ethereum Smart ContractsWansen Wang, Wenchao Huang, Zhaoyi Meng, Yan Xiong et al.USENIX Security 2023
  4. Enforcing Control Flow Integrity on DeFi Smart ContractsZhiyang Chen, Sidi Mohamed Beillahi, Pasha Barahimi, Cyrus Minwalla et al.ICSE 2026
  5. Uncover the Premeditated Attacks: Detecting Exploitable Reentrancy Vulnerabilities by Identifying Attacker ContractsShuo Yang, Jiachi Chen, Mingyuan Huang, Zibin Zheng et al.ICSE 2024 · 24 citations
Dusk over the sea between two cliffs drawn in fine vertical lines