FlashSyn: Flash Loan Attack Synthesis via Counter Example Driven Approximation
Zhiyang Chen, Sidi Mohamed Beillahi, Fan Long
Abstract
In decentralized finance (DeFi), lenders can offer flash loans to borrowers, i.e., loans that are only valid within a blockchain transaction and must be repaid with fees by the end of that transaction. Unlike normal loans, flash loans allow borrowers to borrow large assets without upfront collaterals deposits. Malicious adversaries use flash loans to gather large assets to exploit vulnerable DeFi protocols. In this paper, we introduce a new framework for automated synthesis of adversarial transactions that exploit DeFi protocols using flash loans. To bypass the complexity of a DeFi protocol, we propose a new technique to approximate the DeFi protocol functional behaviors using numerical methods (polynomial linear regression and nearest-neighbor interpolation). We then construct an optimization query using the approximated functions of the DeFi protocol to find an adversarial attack constituted of a sequence of functions invocations with optimal parameters that gives the maximum profit. To improve the accuracy of the approximation, we propose a novel counterexample driven approximation refinement technique. We implement our framework in a tool named FlashSyn. We evaluate FlashSyn on 16 DeFi protocols that were victims to flash loan attacks and 2 DeFi protocols from Damn Vulnerable DeFi challenges. FlashSyn automatically synthesizes an adversarial attack for 16 of the 18 benchmarks. Among the 16 successful cases, FlashSyn identifies attack vectors yielding higher profits than those employed by historical hackers in 3 cases, and also discovers multiple distinct attack vectors in 10 cases, demonstrating its effectiveness in finding possible flash loan attacks.
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.
12 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- DeFort: Automatic Detection and Analysis of Price Manipulation Attacks in DeFi Applications cites ZEUS: Analyzing Safety of Smart Contracts
- DeFort: Automatic Detection and Analysis of Price Manipulation Attacks in DeFi Applications cites Making Smart Contracts Smarter
- DeFort: Automatic Detection and Analysis of Price Manipulation Attacks in DeFi Applications cites Securify: Practical Security Analysis of Smart Contracts
- ZEUS: Analyzing Safety of Smart Contracts cites Making Smart Contracts Smarter
- Detecting Various DeFi Price Manipulations with LLM Reasoning cites DeFort: Automatic Detection and Analysis of Price Manipulation Attacks in DeFi Applications
- Detecting Various DeFi Price Manipulations with LLM Reasoning cites Demystifying Invariant Effectiveness for Securing Smart Contracts
- sFuzz: an efficient adaptive fuzzer for solidity smart contracts cites ZEUS: Analyzing Safety of Smart Contracts
- sFuzz: an efficient adaptive fuzzer for solidity smart contracts cites Making Smart Contracts Smarter
- Safeguarding DeFi Smart Contracts against Oracle Deviations cites ZEUS: Analyzing Safety of Smart Contracts
- Safeguarding DeFi Smart Contracts against Oracle Deviations cites Making Smart Contracts Smarter
- Safeguarding DeFi Smart Contracts against Oracle Deviations cites sFuzz: an efficient adaptive fuzzer for solidity smart contracts
- Safeguarding DeFi Smart Contracts against Oracle Deviations cites SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses
- Safeguarding DeFi Smart Contracts against Oracle Deviations cites Securify: Practical Security Analysis of Smart Contracts
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi Protocols cites Making Smart Contracts Smarter
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi Protocols cites sFuzz: an efficient adaptive fuzzer for solidity smart contracts
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi Protocols cites SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi Protocols cites Securify: Practical Security Analysis of Smart Contracts
- SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses cites ZEUS: Analyzing Safety of Smart Contracts
- 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
- SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses cites Securify: Practical Security Analysis of Smart Contracts
- Demystifying Invariant Effectiveness for Securing Smart Contracts cites Making Smart Contracts Smarter
- Demystifying Invariant Effectiveness for Securing Smart Contracts cites sFuzz: an efficient adaptive fuzzer for solidity smart contracts
- Demystifying Invariant Effectiveness for Securing Smart Contracts cites Safeguarding DeFi Smart Contracts against Oracle Deviations
- Demystifying Invariant Effectiveness for Securing Smart Contracts cites SMARTIAN: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses
- Securify: Practical Security Analysis of Smart Contracts cites ZEUS: Analyzing Safety of Smart Contracts
- Securify: Practical Security Analysis of Smart Contracts cites Making Smart Contracts Smarter
Cited by top-tier papers12
- Demystifying Invariant Effectiveness for Securing Smart ContractsZhiyang Chen, Ye Liu, Sidi Mohamed Beillahi, Yi Li et al.FSE 2024 · 15 citations
- Safeguarding DeFi Smart Contracts against Oracle DeviationsXun Deng, Sidi Mohamed Beillahi, Cyrus Minwalla, Han Du et al.ICSE 2024 · 12 citations
- DeFort: Automatic Detection and Analysis of Price Manipulation Attacks in DeFi ApplicationsMaoyi Xie, Ming Hu, Ziqiao Kong, Cen Zhang et al.ISSTA 2024 · 9 citations
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi ProtocolsHongbo Wen, Hanzhi Liu, Jiaxin Song, Yanju Chen et al.CCS 2024 · 6 citations
- Detecting Various DeFi Price Manipulations with LLM ReasoningJuantao Zhong, Daoyuan Wu, Ye Liu, Maoyi Xie et al.ASE 2025 · 3 citations
Builds on12
- Making Smart Contracts SmarterLoi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena et al.CCS 2016 · 2,306 citations
- Securify: Practical Security Analysis of Smart ContractsPetar Tsankov, Andrei Marian Dan, Dana Drachsler-Cohen, Arthur Gervais et al.CCS 2018 · 1,108 citations
- ZEUS: Analyzing Safety of Smart ContractsSukrit Kalra, Seep Goel, Mohan Dhawan, Subodh SharmaNDSS 2018 · 595 citations
- sFuzz: an efficient adaptive fuzzer for solidity smart contractsTai D. Nguyen, Long H. Pham, Jun Sun, Yun Lin et al.ICSE 2020 · 260 citations
- 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
Related papers
- The Blockchain Imitation GameKaihua Qin, Stefanos Chaliasos, Liyi Zhou, Benjamin Livshits et al.USENIX Security 2023
- On the Just-In-Time Discovery of Profit-Generating Transactions in DeFi ProtocolsLiyi Zhou, Kaihua Qin, Antoine Cully, Benjamin Livshits et al.S&P 2021 · 148 citations
- HOUSTON: Real-Time Anomaly Detection of Attacks against Ethereum DeFi ProtocolsDongyu Meng, Fabio Gritti, Robert McLaughlin, Nicola Ruaro et al.NDSS 2026 · 2 citations
- Summary-Based Symbolic Evaluation for Smart ContractsYu Feng, Emina Torlak, Rastislav BodíkASE 2020 · 15 citations
- FairChecker: Detecting Fund-Stealing Bugs in DeFi Protocols via Fairness ValidationYi Sun, Zhuo Zhang, Xiangyu ZhangICSE 2025
