Smart contract anomaly detection: The Contrastive Learning Paradigm

IF 4.6 2区 计算机科学 Q1 COMPUTER SCIENCE, HARDWARE & ARCHITECTURE Computer Networks Pub Date : 2025-04-01 Epub Date: 2025-02-15 DOI:10.1016/j.comnet.2025.111121
Oumaima Fadi , Adil Bahaj , Karim Zkik , Abdellatif El Ghazi , Mounir Ghogho , Mohammed Boulmalf
{"title":"Smart contract anomaly detection: The Contrastive Learning Paradigm","authors":"Oumaima Fadi ,&nbsp;Adil Bahaj ,&nbsp;Karim Zkik ,&nbsp;Abdellatif El Ghazi ,&nbsp;Mounir Ghogho ,&nbsp;Mohammed Boulmalf","doi":"10.1016/j.comnet.2025.111121","DOIUrl":null,"url":null,"abstract":"<div><div>Smart contracts are digital agreements automating the execution of transactions in a decentralized manner. Although they offer many advantages, smart contracts are prone to multiple security vulnerabilities that might cause severe financial losses. Traditional anomaly detection methods, including Machine Learning and Deep Learning, struggle to capture the complexity of smart contract features. Recent advancements have utilized graph neural networks (GNNs) by transforming smart contracts into graphs. However, these approaches face robustness challenges due to small data sizes and model overparameterization. To address these issues, this paper proposes <strong>ACAD</strong> (<strong>A</strong>daptive <strong>C</strong>ontrastive Learning for Smart Contract <strong>A</strong>ttack <strong>D</strong>etection), a novel framework employing a two-phase training process for smart contract classification. After converting smart contract codes to representative graphs, the task-agnostic features are learned using graph contrastive learning with adaptive augmentations. Next, these features are utilized for smart contract vulnerability classification in a downstream task. Unlike previous works, which rely on a single-phase GNN-based approach, ACAD leverages contrastive learning to improve robustness and generalization. This approach effectively overcomes data scarcity while capturing richer and more distinctive representations. Extensive experiments demonstrate that ACAD outperforms baseline models, achieving 95.7% accuracy and 92.44% precision in reentrancy attack detection, which represents an improvement of 5.78% in accuracy and 6.19% in precision compared to the best-performing baseline model.</div></div>","PeriodicalId":50637,"journal":{"name":"Computer Networks","volume":"260 ","pages":"Article 111121"},"PeriodicalIF":4.6000,"publicationDate":"2025-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer Networks","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S1389128625000891","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2025/2/15 0:00:00","PubModel":"Epub","JCR":"Q1","JCRName":"COMPUTER SCIENCE, HARDWARE & ARCHITECTURE","Score":null,"Total":0}
引用次数: 0

Abstract

Smart contracts are digital agreements automating the execution of transactions in a decentralized manner. Although they offer many advantages, smart contracts are prone to multiple security vulnerabilities that might cause severe financial losses. Traditional anomaly detection methods, including Machine Learning and Deep Learning, struggle to capture the complexity of smart contract features. Recent advancements have utilized graph neural networks (GNNs) by transforming smart contracts into graphs. However, these approaches face robustness challenges due to small data sizes and model overparameterization. To address these issues, this paper proposes ACAD (Adaptive Contrastive Learning for Smart Contract Attack Detection), a novel framework employing a two-phase training process for smart contract classification. After converting smart contract codes to representative graphs, the task-agnostic features are learned using graph contrastive learning with adaptive augmentations. Next, these features are utilized for smart contract vulnerability classification in a downstream task. Unlike previous works, which rely on a single-phase GNN-based approach, ACAD leverages contrastive learning to improve robustness and generalization. This approach effectively overcomes data scarcity while capturing richer and more distinctive representations. Extensive experiments demonstrate that ACAD outperforms baseline models, achieving 95.7% accuracy and 92.44% precision in reentrancy attack detection, which represents an improvement of 5.78% in accuracy and 6.19% in precision compared to the best-performing baseline model.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
智能合约异常检测:对比学习范式
智能合约是以分散的方式自动执行交易的数字协议。尽管智能合约提供了许多优势,但它们容易存在多种安全漏洞,可能导致严重的经济损失。传统的异常检测方法,包括机器学习和深度学习,难以捕捉智能合约特征的复杂性。最近的进展是利用图神经网络(gnn)将智能合约转换为图。然而,由于数据规模小和模型过度参数化,这些方法面临鲁棒性挑战。为了解决这些问题,本文提出了ACAD(智能合约攻击检测的自适应对比学习),这是一个采用两阶段训练过程进行智能合约分类的新框架。在将智能合约代码转换为代表性图之后,使用带有自适应增强的图对比学习来学习任务不可知特征。接下来,在下游任务中利用这些特征对智能合约漏洞进行分类。与以往依赖于单相gnn方法的工作不同,ACAD利用对比学习来提高鲁棒性和泛化。这种方法有效地克服了数据稀缺性,同时捕获了更丰富、更独特的表示。大量实验表明,ACAD算法优于基线模型,在重入攻击检测中达到95.7%的准确率和92.44%的精度,与性能最好的基线模型相比,准确率和精度分别提高了5.78%和6.19%。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
Computer Networks
Computer Networks 工程技术-电信学
CiteScore
10.80
自引率
3.60%
发文量
434
审稿时长
8.6 months
期刊介绍: Computer Networks is an international, archival journal providing a publication vehicle for complete coverage of all topics of interest to those involved in the computer communications networking area. The audience includes researchers, managers and operators of networks as well as designers and implementors. The Editorial Board will consider any material for publication that is of interest to those groups.
期刊最新文献
A multimodal and perturbation-aware learning approach for robust traffic classification DACC: Discerning and adaptive offloading for coarse-grained content-aware video analytics Preemption-aware online AoI scheduling over two-state Markov channels Secure by design: Merging network and security bootstrapping for IoT systems through NDN Privacy-preserving multi-agent bitrate allocation for 360° video streaming
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1