Understanding and Discovering Attacks on Ethereum Decentralized Applications
Total Page:16
File Type:pdf, Size:1020Kb
Evil Under the Sun: Understanding and Discovering Attacks on Ethereum Decentralized Applications Liya Su1,2,3 ∗,† Xinyue Shen1,4∗,† Xiangyu Du1,2,3,∗ Xiaojing Liao1, XiaoFeng Wang1, Luyi Xing1, Baoxu Liu2,3 1Indiana University Bloomington, 2Institute of Information Engineering, Chinese Academy of Sciences, 3University of Chinese Academy of Sciences, 4Alibaba Group {liyasu, shen12, duxian}@iu.edu, {xliao, xw7, luyixing}@indiana.edu, [email protected] Abstract the DAO attack that caused a loss over 50 million USD [39] in 2016, resulting in the hard-fork in Ethereum. Also found in The popularity of Ethereum decentralized applications our study is that miscreants took 14K Ethers from the victim (Dapps) also brings in new security risks: it has been re- Dapps with most financial losses (i.e., Fomo3D, Section 4.5). ported that these Dapps have been under various kinds of attacks from cybercriminals to gain profit. To the best of With this significant threat, the community’s understanding our knowledge, little has been done so far to understand this about the new type of cybercrimes is still very limited: to new cybercrime, in terms of its scope, criminal footprints the best of our knowledge, no extensive forensic analysis and attack operational intents, not to mention any efforts to on Dapp attacks has ever been reported, nor has any cyber investigate these attack incidents automatically on a large threat intelligence (CTI) been collected from them to find out scale. In this paper, we performed the first measurement study the perpetrator’s strategy, capability and infrastructure, not to on real-world Dapp attack instances to recover critical threat mention to utilize the knowledge to mitigate the threat. intelligence (e.g., kill chain and attack patterns). Utilizing Understanding attacks on Dapps. In this paper, we present such threat intelligence, we proposed the first technique DE- the first study that analyzes and measures real-world at- FIER to automatically investigate attack incidents on a large tacks on Ethereum Dapps based upon the forensic evidence scale. Running DEFIER on 2.3 million transactions from 104 recorded on the blockchain, which brings new insights to this Ethereum on-chain Dapps, we were able to identify 476,342 emerging cybercrime. Our research leverages the informa- exploit transactions on 85 target Dapps, which related to 75 tion logged by the Ethereum blockchain, an open, immutable 0-day victim Dapps and 17K previously-unknown attacker ledger recording the entire history of interactions between EOAs. To the best of our knowledge, it is the largest Ethereum Dapps and their users through their Ethereum user accounts on-chain Dapp attack incidents dataset ever reported. (i.e., Externally Owned Accounts or EOA, see Section 2). Such interactions are performed through transactions, which are logged in the data packages chained by Ethereum. Should 1 Introduction a Dapp be exploited, all forensic evidence, such as attack traces, will be kept in related transactions, which can later be The rise of blockchain technologies has profoundly trans- used to analyze the attack. formed computing, bringing to the front a new type of de- However, it is nontrivial to identify attack traces from over centralized applications on blockchain that facilitate transfer 350 million Ethereum transactions. Finding related transac- of values across users without a third party. Such applica- tions from published reports is inadequate at best, since they tions, dubbed Dapp, have already been widely deployed on tend to miss information about important actors and exploit Ethereum to provide services ranging from cryptocurrency behaviors (such as exploit developers, Section 4), when their management to voting and governance [17]. Online statistics EOAs are not included in the reports. Also absent are detailed show that till Nov. 5, 2019, 3,137 Dapps on Ethereum are internal operations triggered by each transaction, in terms of serving 63.77K active users every day through over one mil- function calls between the target Dapps and EOAs or between lion transactions that involve 7.55 million USD [2]. However, different EOAs (see Section 4). Such calls describe these par- the boundless potentials Dapps have opened also come with ties’ behaviors and are found to be critical for determining new security risks. It has been reported that cybercriminals their intents during the interactions. To address these chal- have fixed their gaze on Dapps and exploits on them, particu- lenges, we come up with a methodology that utilizes known larly their blockchain back-end (i.e., smart contracts, see Sec- attack-related transactions (called exploit transactions in the tion 2), happening from time to time. A prominent example is paper) and EOAs to find new ones and further analyze their ex- ecution traces (by re-executing these transactions). In this way, ∗This work was done when the student authors were in Indiana University Bloomington utilizing 25 Dapps related to 42 known attack incidents, we †First two authors contributed equally for this project identified 58,555 exploit transactions with 436,371 execution traces, all linked to 56 Dapps, including 29 being exploited world attacks on Dapps. DEFIER captures the adversary’s but never reported before (called 0-day victim Dapps). strategies and intents, as demonstrated by the operations trig- Our findings. From the transactions collected, our forensic gered by the transaction time series at each stage. Given a analysis has recovered critical CTI about strategically, well Dapp, our approach first gathers all its transactions recorded organized Dapp attacks, which have never been done before. on the blockchain and from them, further finds out other re- Such threat information (CTI) provides invaluable insights lated transactions and EOAs. All these transactions are then for understanding the strategies, approaches and intentions of clustered based upon the similarity of their execution traces real-world cybercriminals in attacking Dapps, and thus con- in a graph form and organized into several time series. Af- tributes to mitigating the emerging threats. Most interesting ter converting the execution traces of each transaction into a is the discovery about how the adversary systematically or- vector through graph embedding, we run a Long Short-Term chestrates an attack. More specifically, across different kinds Memory (LSTM) neural network to classify each time series, of exploits (weak randomness exploit, denial of services, inte- which determines not only whether the series is related to an ger overflow, reentrancy and authentication circumvention) exploit, but also its attack stage when it is. against different Dapps, we can see a general attack lifecycle Running DEFIER on 104 Dapps, we were able to dis- with four stages from the transaction sequences involved: at- cover 476,342 exploit transactions on 85 target (with a micro- tack preparation, exploitation, propagation and completion. precision of 91.7%). In particular, DEFIER reported 75 0-day These stages form a kill chain against Dapps, which has never victim Dapps (e.g., SpaceWar and SuperCard). Also surpris- been reported before. The chain starts with repeated attempts ingly, our study shows that a substantial portion (i.e., 26%) to probe the target Dapp from various sources for finding and of the transactions of these Dapps (on Ethereum) are attack- testing its vulnerable functions. That is, the adversary tests, related: e.g., 30% of Fomo3D’s transactions are attack-related debugs the attack code to ensure it can successfully exploit (from July 2018 to April 2019). This provides evidence that the particular target Dapp. This stage is followed by a series indeed the attack lifecycle we discovered is general. Such of exploit transactions to profit from the target, which are con- an attack lifecycle discovery tool can potentially be used to tinuously refined to improve efficiency. After that, the same disrupt exploits, sometimes even before damages are inflicted attack is often replayed to similar Dapps, with a sequence of (e.g., finding and stopping an attack at its preparation stage). transactions produced to aim at different targets. The attack Contribution. The contributions of the paper are as follows: is finalized with another sequence of transactions for termi- • We performed the first measurement study and forensic anal- nating attack contracts and transferring stolen funds. Across ysis on real-world Dapp attacks, leveraging the open and im- different attack instances against real-world Dapps, this life- mutable transaction records kept by the Ethereum blockchain cycle paradigm exhibits remarkable consistency, with each to recover critical CTI. Particularly, our study has led to the stage characterized by a time series of similar, inter-dependent discovery of a general, unique lifecycle of Dapp attacks, with transactions executed consecutively within a short time win- the adversary showing similar behaviors in orchestrating at- dow. The series describes the adversary’s behaviors and thus tack operations against different target Dapps, regardless of characterizes his intent at each stage. For example, continuous low-level exploit techniques. Also we brought to light the ad- probing transactions show the intent of finding weaknesses in versary’s attack infrastructures, campaigns they organized, as a target Dapp. well as the inadequacy of the current response by defenders. Further, our research reveals a hierarchical attack infras- • We demonstrate that our new understanding