sGuard+: Machine Learning Guided Rule-Based Automated Vulnerability Repair on Smart Contracts

Author:

Gao Cuifeng1ORCID,Yang Wenzhang2ORCID,Ye Jiaming3ORCID,Xue Yinxing1ORCID,Sun Jun4ORCID

Affiliation:

1. School of Computer Science and Technology, University of Science and Technology of China, Hefei, China and Suzhou lnstitute for Advanced Research, University of Science and Technology of China, Suzhou, China

2. University of Science and Technology of China, Hefei, China

3. Kyushu University, Fukuoka, Japan

4. Singapore Management University, Singapore, Singapore

Abstract

Smart contracts are becoming appealing targets for hackers because of the vast amount of cryptocurrencies under their control. Asset loss due to the exploitation of smart contract codes has increased significantly in recent years. To guarantee that smart contracts are vulnerability-free, there are many works to detect the vulnerabilities of smart contracts, but only a few vulnerability repair works have been proposed. Repairing smart contract vulnerabilities at the source code level is attractive as it is transparent to users, whereas existing repair tools, such as SCRepair and sGuard , suffer from many limitations: (1) ignoring the code of vulnerability prevention; (2) possibly applying the repair to the wrong statements and changing the original business logic of smart contracts; and (3) showing poor performance in terms of time and gas overhead. In this work, we propose machine learning guided rule-based automated vulnerability repair on smart contracts to improve the effectiveness and efficiency of sGuard . To address the limitations mentioned above, we design the features that characterize both the symptoms of vulnerabilities and the methods of vulnerability prevention to learn various vulnerability patterns and reduce false positives. Additionally, a fine-grained localization algorithm is designed by traversing the nodes of the abstract syntax tree, and we refine and extend the repair rules of sGuard to preserve the original business logic of smart contracts and support new vulnerability types. Our tool, named sGuard+ , reduces time overhead based on machine learning models, and reduces gas overhead by fewer code changes and precise patching. In our experiment, we collect a publicly available vulnerability dataset from CVE, SWC, and SmartBugs Curated as a ground truth for evaluations. Overall, sGuard+ repairs more vulnerabilities with less time and gas overhead than state-of-the-art tools. Furthermore, we reproduce about 9,000 historical transactions for regression testing. It is shown that sGuard+ has no impact on the original business logic of smart contracts.

Funder

Anhui Provincial Department of Science and Technology

National Natural Science Foundation of China

Basic Research Program of Jiangsu Province

CAS Pioneer Hundred Talents Program of China

Ministry of Education, Singapore under its Academic Research Fund Tier 3

Publisher

Association for Computing Machinery (ACM)

Reference121 articles.

1. 2016. DAO at v1.0. Retrieved from https://github.com/blockchainsllc/DAO/tree/v1.0. Online; accessed 17 June 2016.

2. 2017. The Parity Wallet Hack Explained. Retrieved from https://blog.openzeppelin.com/on-the-parity-wallet-multisig-hack-405a8c12e8f7/. Online; accessed 19 July 2017.

3. 2022. CVE-2020-19765. Retrieved from https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-19765. Online; accessed 1 January 2022.

4. 2022. The CVE Records Related to Smart Contracts Without Explict Keyworks. Retrieved fromhttps://github.com/ToolmanInside/CVEs. Online; accessed 1 January 2022.

5. 2022. Etherscan. Retrieved from https://etherscan.io/. Online; accessed 25 April 2022.

Cited by 2 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3