Bytecode Similarity Detection of Smart Contract across Optimization Options and Compiler Versions Based on Triplet Network

被引:6
|
作者
Zhu, Di [1 ]
Yue, Feng [1 ]
Pang, Jianmin [1 ]
Zhou, Xin [1 ]
Han, Wenjie [1 ]
Liu, Fudong [1 ]
机构
[1] State Key Lab Math Engn & Adv Comp, Zhengzhou 450001, Peoples R China
关键词
smart contract; bytecode similarity; basic block; triplet network;
D O I
10.3390/electronics11040597
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
In recent years, the number of smart contracts running in the blockchain has increased rapidly, accompanied by many security problems, such as vulnerability propagation caused by code reuse or vicious transaction caused by malicious contract deployment, for example. Most smart contracts do not publish the source code, but only the bytecode. Based on the research of bytecode similarity of smart contract, smart contract upgrade, vulnerability search and malicious contract analysis can be carried out. The difficulty of bytecode similarity research is that different compilation versions and optimization options lead to the diversification of bytecode of the same source code. This paper presents a solution, including a series of methods to measure the similarity of smart contract bytecode. Starting from the opcode of smart contract, a method of pre-training the basic block sequence of smart contract is proposed, which can embed the basic block vector. Positive samples were obtained by basic block marking, and the negative sampling method is improved. After these works, we put the obtained positive samples, negative samples and basic blocks themselves into the triplet network composed of transformers. Our solution can obtain evaluation results with an accuracy of 97.8%, so that the basic block sequence of optimized and unoptimized options can be transformed into each other. At the same time, the instructions are normalized, and the order of compiled version instructions is normalized. Experiments show that our solution can effectively reduce the bytecode difference caused by optimization options and compiler version, and improve the accuracy by 1.4% compared with the existing work. We provide a data set covering 64 currently used Solidity compilers, including one million basic block pairs extracted from them.
引用
收藏
页数:21
相关论文
共 20 条
  • [1] Smart contract vulnerability detection based on a bytecode critical path
    Yin, Guisheng
    Gao, Le
    Zhuang, Yuan
    Li, Jun
    Harbin Gongcheng Daxue Xuebao/Journal of Harbin Engineering University, 2022, 43 (02): : 255 - 261
  • [2] Semantic-aware Graph Neural Network for Smart Contract Bytecode Vulnerability Detection
    Zhao B.
    Shangguan C.
    Peng X.
    An Y.
    Tong J.
    Yuan A.
    Gongcheng Kexue Yu Jishu/Advanced Engineering Sciences, 2022, 54 (02): : 49 - 55
  • [3] Ethereum Smart Contract Vulnerability Detection Model Based on Triplet Loss and BiLSTM
    Wang, Meiying
    Xie, Zheyu
    Wen, Xuefan
    Li, Jianmin
    Zhou, Kuanjiu
    ELECTRONICS, 2023, 12 (10)
  • [4] Smart Contract Vulnerability Detection Method Based on Capsule Network and Attention Mechanism
    Lu L.
    Lai J.
    Huanan Ligong Daxue Xuebao/Journal of South China University of Technology (Natural Science), 2023, 51 (05): : 36 - 44
  • [5] Smart contract reentrancy vulnerability detection method based on manifold pigeon optimization algorithm
    Liu F.
    Huang H.
    Xiang Y.
    Hao Z.
    Zhongguo Kexue Jishu Kexue/Scientia Sinica Technologica, 2023, 53 (11): : 1922 - 1938
  • [6] HGAT: smart contract vulnerability detection method based on hierarchical graph attention network
    Chuang Ma
    Shuaiwu Liu
    Guangxia Xu
    Journal of Cloud Computing, 12
  • [7] HGAT: smart contract vulnerability detection method based on hierarchical graph attention network
    Ma, Chuang
    Liu, Shuaiwu
    Xu, Guangxia
    JOURNAL OF CLOUD COMPUTING-ADVANCES SYSTEMS AND APPLICATIONS, 2023, 12 (01):
  • [8] A Graph Neural Network-Based Smart Contract Vulnerability Detection Method with Artificial Rule
    Wei, Ziyue
    Zheng, Weining
    Su, Xiaohong
    Tao, Wenxin
    Wang, Tiantian
    ARTIFICIAL NEURAL NETWORKS AND MACHINE LEARNING, ICANN 2023, PT IV, 2023, 14257 : 241 - 252
  • [9] Smart contract vulnerability detection based on a semantic code structure and a self-designed neural network
    Ren, Xiaojun
    Wu, Yongtang
    Li, Jiaqing
    Hao, Dongmin
    Alam, Muhammad
    COMPUTERS & ELECTRICAL ENGINEERING, 2023, 109
  • [10] Smart Contract Vulnerability Detection Model Based on Siamese Network (SCVSN): A Case Study of Reentrancy Vulnerability
    Guo, Ran
    Chen, Weijie
    Zhang, Lejun
    Wang, Guopeng
    Chen, Huiling
    ENERGIES, 2022, 15 (24)