应用科学学报 ›› 2021, Vol. 39 ›› Issue (1): 151-163.doi: 10.3969/j.issn.0255-8297.2021.01.013

• 区块链 • 上一篇    

基于Ethereum智能合约的安全策略分析

张登记1, 赵相福2, 陈中育1, 童向荣2   

  1. 1. 浙江师范大学 数学与计算机科学学院, 浙江 金华 321004;
    2. 烟台大学 计算机与控制工程学院, 山东 烟台 264005
  • 收稿日期:2020-11-12 发布日期:2021-02-04
  • 通信作者: 赵相福,教授,研究方向为基于模型的故障诊断、区块链。E-mail:xiangfuzhao@163.com E-mail:xiangfuzhao@163.com
  • 基金资助:
    国家自然科学基金(No.61972360)资助

Analysis of Security Strategies for Smart Contracts Based on Ethereum

ZHANG Dengji1, ZHAO Xiangfu2, CHEN Zhongyu1, TONG Xiangrong2   

  1. 1. College of Mathematics and Computer Science, Zhejiang Normal University, Jinhua 321004, Zhejiang, China;
    2. School of Computer and Control Engineering, Yantai University, Yantai 264005, Shandong, China
  • Received:2020-11-12 Published:2021-02-04

摘要: 智能合约是代码和数据的集合,一旦部署便无法更改,且其自身持有金融属性,若出现安全漏洞问题将会造成巨大损失,可见编写出安全可靠的智能合约是至关重要的。为此,基于Ethereum平台研究并分析智能合约的安全漏洞,总结了几种易见的安全漏洞,包括可重入漏洞、整数溢出漏洞、拒绝服务(denial of service,DoS)漏洞、时间戳依赖漏洞、交易序列依赖漏洞等;针对上述合约的漏洞进行详细的原理分析和场景复现,提出了相应的预防安全策略并通过实验进行有效性验证;最后分析并比较了几种主流的智能合约安全漏洞检测工具。

关键词: 区块链, 以太坊, 智能合约, 漏洞分析, 预防策略

Abstract: A smart contract is a collection of code and data. Once a smart contract is deployed, it cannot be changed. Smart contracts have financial properties, thus, it would cause huge losses if there were vulnerabilities in smart contracts. Therefore, it is essential to write safe and reliable smart contracts. Based on the Ethereum platform, related security of smart contracts is analyzed, and several common vulnerabilities are summarized, including reentrancy vulnerabilities, integer overflow vulnerabilities, deny of service (DoS) vulnerabilities, timestamp dependence vulnerabilities, and transaction-ordering dependence vulnerabilities. We made theoretical analysis in detail and scenario recurrence on these vulnerabilities, proposed corresponding preventive security strategies, and verified the effectiveness of these strategies. Finally, we analyzed and compared several popular tools for detecting smart contract vulnerabilities.

Key words: blockchain, Ethereum, smart contract, vulnerability analysis, prevention strategy

中图分类号: