一句话:通过对500余份审计报告和22万余合约的实证分析,定义八种库误用模式并揭示其普遍性。
Solidity 库可提升代码复用性,但库误用会引入漏洞并造成财务损失,此前缺乏系统研究。本文收集五家审计公司的500余份审计报告及 Etherscan 上223,336个真实智能合约,度量库流行度与误用情况。作者定义了覆盖库全生命周期的八种误用模式:三种发生于库开发阶段,五种发生于库使用阶段。通过人工分析1,018个真实合约,在456个合约中识别出905个误用案例,表明该问题广泛存在;其中三种模式出现在超过50个合约中,主因是开发者安全意识不足或低估负面影响。研究还发现,以太坊上存在漏洞的库即便被弃用或修补后仍被继续使用。
Smart contracts are Turing-complete programs that execute on the blockchain. Developers can implement complex contracts, such as auctions and lending, on Ethereum using the Solidity programming language. As an object-oriented language, Solidity provides libraries within its syntax to facilitate code reusability and reduce development complexity. Library misuse refers to the incorrect writing or usage of libraries, resulting in unexpected results, such as introducing vulnerabilities during library development or incorporating an unsafe library during contract development. Library misuse could lead to contract defects that cause financial losses. Currently, there is a lack of research on library misuse. To fill this gap, we collected more than 500 audit reports from the official websites of five audit companies and 223,336 real-world smart contracts from Etherscan to measure library popularity and library misuse. Then, we defined eight general patterns for library misuse; three of them occurring during library development and five during library utilization, which covers the entire library lifecycle. To validate the practicality of these patterns, we manually analyzed 1,018 real-world smart contracts and publicized our dataset. We identified 905 misuse cases across 456 contracts, indicating that library misuse is a widespread issue. Three patterns of misuse are found in more than 50 contracts, primarily due to developers lacking security awareness or underestimating negative impacts. Additionally, our research revealed that vulnerable libraries on Ethereum continue to be employed even after they have been deprecated or patched. Our findings can assist contract developers in preventing library misuse and ensuring the safe use of libraries.
DOI 原文 ·
@inproceedings{paperbot11390,
title = {Revealing Hidden Threats: An Empirical Study of Library Misuse in Smart Contracts},
author = {Mingyuan Huang and Jiachi Chen and Zigui Jiang and Zibin Zheng},
booktitle = {ICSE},
year = {2024},
doi = {10.1145/3597503.3623335}
}