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

IF 6.6 2区 计算机科学 Q1 COMPUTER SCIENCE, SOFTWARE ENGINEERING ACM Transactions on Software Engineering and Methodology Pub Date : 2024-02-08 DOI:10.1145/3641846
Cuifeng Gao, Wenzhang Yang, Jiaming Ye, Yinxing Xue, Jun Sun
{"title":"sGuard+: Machine Learning Guided Rule-based Automated Vulnerability Repair on Smart Contracts.","authors":"Cuifeng Gao, Wenzhang Yang, Jiaming Ye, Yinxing Xue, Jun Sun","doi":"10.1145/3641846","DOIUrl":null,"url":null,"abstract":"<p>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 <span>SCRepair</span> and <span>sGuard</span>, 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; (3) showing poor performance in terms of time and gas overhead. </p><p>In this work, we propose machine learning guided rule-based automated vulnerability repair on smart contracts to improve the effectiveness and efficiency of <span>sGuard</span>. 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 <span>sGuard</span> to preserve the original business logic of smart contracts and support new vulnerability types. Our tool, named <span>sGuard+</span>, reduces time overhead based on machine learning models, and reduces gas overhead by fewer code changes and precise patching. </p><p>In our experiment, we collect a publicly available vulnerability dataset from CVE, SWC and SmartBugs Curated as a ground truth for evaluations. Overall, <span>sGuard+</span> 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 <span>sGuard+</span> has no impact on the original business logic of smart contracts.</p>","PeriodicalId":50933,"journal":{"name":"ACM Transactions on Software Engineering and Methodology","volume":"67 1","pages":""},"PeriodicalIF":6.6000,"publicationDate":"2024-02-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACM Transactions on Software Engineering and Methodology","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1145/3641846","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

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; (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.

查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
sGuard+:智能合约上基于机器学习规则的自动漏洞修复。
由于黑客控制着大量加密货币,智能合约正成为黑客们青睐的目标。近年来,因智能合约代码被利用而造成的资产损失大幅增加。为了保证智能合约不存在漏洞,目前有许多检测智能合约漏洞的工作,但只有少数漏洞修复工作被提出。在源代码层面修复智能合约漏洞对用户来说是透明的,因此很有吸引力,而现有的修复工具,如 SCRepair 和 sGuard,存在很多局限性:(1)忽略了漏洞预防代码;(2)可能将修复应用于错误的语句,改变了智能合约原有的业务逻辑;(3)在时间和气体开销方面表现不佳。在这项工作中,我们提出了基于机器学习引导规则的智能合约自动漏洞修复方法,以提高 sGuard 的有效性和效率。针对上述局限性,我们设计了既能描述漏洞症状又能描述漏洞预防方法的特征,以学习各种漏洞模式,减少误报。此外,我们还通过遍历抽象语法树的节点设计了一种细粒度定位算法,并完善和扩展了 sGuard 的修复规则,以保留智能合约的原始业务逻辑并支持新的漏洞类型。我们的工具被命名为 sGuard+,它基于机器学习模型减少了时间开销,并通过减少代码修改和精确修补减少了气体开销。在实验中,我们收集了来自 CVE、SWC 和 SmartBugs Curated 的公开漏洞数据集作为评估的基本事实。总体而言,与最先进的工具相比,sGuard+ 能以更少的时间和气体开销修复更多的漏洞。此外,我们还重现了约 9,000 个历史事务进行回归测试。结果表明,sGuard+ 对智能合约的原始业务逻辑没有影响。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
ACM Transactions on Software Engineering and Methodology
ACM Transactions on Software Engineering and Methodology 工程技术-计算机:软件工程
CiteScore
6.30
自引率
4.50%
发文量
164
审稿时长
>12 weeks
期刊介绍: Designing and building a large, complex software system is a tremendous challenge. ACM Transactions on Software Engineering and Methodology (TOSEM) publishes papers on all aspects of that challenge: specification, design, development and maintenance. It covers tools and methodologies, languages, data structures, and algorithms. TOSEM also reports on successful efforts, noting practical lessons that can be scaled and transferred to other projects, and often looks at applications of innovative technologies. The tone is scholarly but readable; the content is worthy of study; the presentation is effective.
期刊最新文献
Effective, Platform-Independent GUI Testing via Image Embedding and Reinforcement Learning Bitmap-Based Security Monitoring for Deeply Embedded Systems Harmonising Contributions: Exploring Diversity in Software Engineering through CQA Mining on Stack Overflow An Empirical Study on the Characteristics of Database Access Bugs in Java Applications Self-planning Code Generation with Large Language Models
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1