计算机应用 ›› 2020, Vol. 40 ›› Issue (4): 947-953.DOI: 10.11772/j.issn.1001-9081.2019111919

• 区块链 • 上一篇    下一篇

基于符号执行的智能合约漏洞检测方案

赵伟1,2, 张问银1, 王九如1, 王海峰1, 武传坤1   

  1. 1. 临沂大学 信息科学与工程学院, 山东 临沂 276002;
    2. 山东科技大学 计算机科学与工程学院, 山东 青岛 266000
  • 收稿日期:2019-11-05 修回日期:2019-11-18 出版日期:2020-04-10 发布日期:2019-12-17
  • 通讯作者: 张问银
  • 作者简介:赵伟(1994-),男,河南平顶山人,硕士研究生,主要研究方向:区块链;张问银(1972-),男,山东临沂人,教授,博士,CCF会员,主要研究方向:图像处理、信息隐藏、区块链;王九如(1983-),男,山东临沂人,教授,博士,主要研究方向:网络空间安全、区块链;王海峰(1976-),男,山东临沂人,副教授,博士,CCF会员,主要研究方向:计算机体系结构、高性能集群计算、复杂网络;武传坤(1964-),男,山东临沂人,教授,博士,CCF会员,主要研究方向:信息安全、移动网络安全、物联网安全。
  • 基金资助:
    山东省重点研发计划项目(2017CXGC0701,2019GNC106027)。

Smart contract vulnerability detection scheme based on symbol execution

ZHAO Wei1,2, ZHANG Wenyin1, WANG Jiuru1, WANG Haifeng1, WU Chuankun1   

  1. 1. School of Information Science and Engineering, Linyi University, Linyi Shandong 276002, China;
    2. School of Computer Science and Engineering, Shandong University of Science and Technology, Qingdao Shandong 266000, China
  • Received:2019-11-05 Revised:2019-11-18 Online:2020-04-10 Published:2019-12-17
  • Supported by:
    This work is partially supported by the Key Research and Development Program of Shandong Province(2017CXGC0701, 2019GNC106027).

摘要: 随着区块链技术的应用推广,智能合约的数量呈现爆发式增长,而智能合约的漏洞将给用户带来巨大损失。但目前研究侧重于以太坊智能合约的语义分析、符号执行的建模与优化等,没有详细描述利用符号执行技术检测智能合约漏洞流程,以及如何检测智能合约常见漏洞。为此,在分析以太坊智能合约的运行机制和常见漏洞原理的基础上,利用符号执行技术检测智能合约漏洞。首先基于以太坊字节码构建智能合约执行控制流图,再根据智能合约漏洞特点设计相应的约束条件,利用约束求解器生成软件测试用例,检测常见的整型溢出、权限控制、Call注入、重入攻击等智能合约漏洞。实验结果表明,所提检测方案具有良好的检测效果,对Awesome-Buggy-ERC20-Tokens漏洞库中70份含漏洞的智能合约的漏洞检测正确率达85%。

关键词: 区块链, 智能合约, 符号执行, 漏洞分析, 以太坊

Abstract: Smart contract is one of the core technologies of blockchain,and its security and reliability are very important. With the popularization of blockchain application,the number of smart contracts has increased explosively. And the vulnerabilities of smart contracts will bring huge losses to users. However,the current research focuses on the semantic analysis of Ethereum smart contracts,the modeling and optimization of symbolic execution,and does not specifically describe the process of detecting smart contract vulnerabilities using symbolic execution technology,and how to detect common vulnerabilities in smart contracts. Based on the analysis of the operation mechanism and common vulnerabilities of Ethereum smart contract,the symbol execution technology was used to detect vulnerabilities in smart contracts. Firstly,the smart contract control flow graph was constructed based on Ethereum bytecode,then the corresponding constraint conditions were designed according to the characteristics of smart contract vulnerabilities,and the constraint solver was used to generate software test cases to detect the common vulnerabilities of smart contracts such as integer overflow,access control,call injection and reentry attack. The experimental results show that the proposed detection scheme has good detection effect, and has the accuracy of smart contract vulnerability detection up to 85% on 70 smart contracts with vulnerabilities in Awesome-Buggy-ERC20-Tokens.

Key words: blockchain, smart contract, symbol execution, vulnerability analysis, Ethereum

中图分类号: