In decentralized finance (DeFi) ecosystem, lenders can offer flash loans to borrowers, i.e., loans that are only valid within a blockchain transaction and must be repaid with some fees by the end of that transaction. Unlike normal loans, flash loans allow borrowers to borrow a large amount of assets without upfront collaterals deposits. Malicious adversaries can use flash loans to gather large amount of assets to launch costly exploitations targeting DeFi protocols. In this paper, we introduce a new framework for automated synthesis of adversarial contracts that exploit DeFi protocols using flash loans. To bypass the complexity of a DeFi protocol, we propose a new technique to approximate DeFi protocol functional behaviors using numerical methods. Then, we propose a novel algorithm to find an adversarial attack which constitutes of a sequence of invocations of functions in a DeFi protocol with the optimized parameters for profits. We implemented our framework in a tool called FlashSyn. We run FlashSyn on 5 DeFi protocols that were victims to flash loan attacks and DeFi protocols from Damn Vulnerable DeFi challenges. FlashSyn automatically synthesizes an adversarial attack for each one of them.
翻译:在分散化的金融(DeFi)生态系统中,放款人可以向借款人提供闪存贷款,也就是说,贷款只在链条交易中有效,而且必须在交易结束时以某些费用偿还。与正常贷款不同,闪存贷款允许借款人借大量资产而不先抵押存款。恶意对手可以利用闪存贷款来收集大量资产,以针对DeFi协议启动代价高昂的开发开发。在本文中,我们引入了利用闪存贷款开发DeFi协议的对抗性合同自动合成新框架。为了绕过 DeFi协议的复杂性,我们提出了一个使用数字方法接近 DeFi协议功能行为的新技术。然后,我们提出了一种新算法,以寻找在DeFi协议中援引一系列功能的对抗性攻击,其中含有最佳利润参数。我们在一个名为FlashSyn的工具中实施了我们的框架。我们在5 DeFi协议上运行了Fi协议FasSyn,这些协议是闪存贷款袭击的受害者和DiFi Fi挑战的 DeFi协议。我们用数字脆弱DISyn自动合成对抗性攻击的对抗性攻击。