信息安全研究 ›› 2025, Vol. 11 ›› Issue (4): 333-.

• 学术论文 • 上一篇    下一篇

基于多访问控制的智能合约重入攻击防御方法

陈虹1谢金彤1金海波1武聪2马博宇1


  

  1. 1(辽宁工程技术大学软件学院辽宁葫芦岛125105)
    2(辽宁工程技术大学科学技术研究院辽宁阜新123032)
  • 出版日期:2025-04-30 发布日期:2025-04-30
  • 通讯作者: 陈虹 硕士,副教授.主要研究方向为信息安全和网络安全. chh3188@163.com
  • 作者简介:陈虹 硕士,副教授.主要研究方向为信息安全和网络安全. chh3188@163.com 谢金彤 硕士研究生.主要研究方向为网络安全和区块链. 925137456@qq.com 金海波 博士,副教授.主要研究方向为随机过程、决策理论、复杂系统优化维护、系统可靠性. jinhaibo@Intu.edu.cn 武聪 博士,讲师.主要研究方向为电子商务、数据分析与智能决策. fxwucong@163.com 马博宇 硕士研究生.主要研究方向为网络安全、密码学. mby145373@163.com

Multiaccess Controls for Defense Against Smart Contract Reentry Attacks

Chen Hong1, Xie Jintong1, Jin Haibo1, Wu Cong2, and Ma Boyu1   

  1. 1(College of Software, Liaoning Technical University, Huludao, Liaoning 125105)
    2(Institute of Science and Technology, Liaoning Technical University, Fuxin, Liaoning 123032)
  • Online:2025-04-30 Published:2025-04-30

摘要: 为解决智能合约在处理外部合约调用时存在漏洞而导致的重入攻击问题,提出一种基于多访问控制(multiple access controls, MAC)的智能合约重入攻击防御方法.通过采用多访问控制仅允许合约所有者进行调用,并防止函数在执行期间对同一事务重复进入;同时修改状态变量存储安全合约地址并更新合约状态.最后使用形式化验证运行经过防御后的智能合约.以银行存取款交易模型为例验证该方法.实验结果表明,采用该防御方法的智能合约能够有效解决外部合约调用时存在的重入攻击问题.相较于其他主流防御方法具有较高的可行性、有效性、逻辑正确性和易理解性;相较于未进行防御的合约,防御后的智能合约在等效内存使用量上减少了64.51%,同时缩短了运行时间.

关键词: 智能合约, 多访问控制, 重入攻击, 形式化验证, 银行存取款

Abstract: In order to solve the problem of reentry attacks caused by the vulnerability of smart contracts in handling external contract calls, a smart contract reentry attack defense method based on Multiple Access Controls (MAC) is proposed. By using MAC, only the contract owner is allowed to make calls and prevent functions from repeatedly entering the same transaction during execution; at the same time, the state variable is modified to store the secure contract address and update the contract state. Finally, formal verification is used to run the defended smart contract. In this paper, we verifies the method with a bank deposit and withdrawal transaction model. The experimental results show that the smart contract using this defense method can effectively solve the problem of reentry attacks when external contracts are invoked. Compared with other mainstream defense methods, it has higher feasibility, effectiveness, logical correctness and comprehensibility; compared with the undefended contract, the defended smart contract reduces the equivalent memory usage by 64.51%, and the running time is also shortened.

Key words: smart contract, multiple access controls, reentry attacks, formal authentication, bank access

中图分类号: