arXiv:2511.12971cs.CRcs.AI2025-11

提出新方法检测以太坊合约字节码相似性,有效识别抄袭和漏洞代码。

Esim: EVM Bytecode Similarity Detection Based on Stable-Semantic Graph

  • 构建稳定语义图捕捉关键指令关系,克服编译器差异影响。
  • 在267万份合约上测试,相似度检测AUC达96.3%,优于现有工具。
  • 适合区块链安全分析、智能合约审计人员使用。

去中心化金融(DeFi)快速发展,但代码复用普遍且开源贡献有限,导致合约抄袭和漏洞传播问题严重。亟需高效准确的EVM字节码相似性检测方法。传统基于指令流或控制流图的方法因低级字节码和大量重复基本块而受限,且不同Solidity编译器版本加剧了检测难度。为此,本文提出一种新型EVM字节码表示——稳定语义图(SSG),捕捉‘稳定指令’间的语义关系。我们实现原型系统Esim,将SSG嵌入矩阵,利用异构图神经网络进行相似性检测。Esim在构建阶段控制流与数据流的F1得分分别达到100%和95.16%,相似性检测的AUC为96.3%,显著优于传统方法。大规模实验分析了六条EVM兼容链上为期一年的2,675,573个智能合约,结果显示Esim在漏洞搜索中优于当前最优工具Etherscan。

原文摘要 · Abstract (English)

Decentralized finance (DeFi) is experiencing rapid expansion. However, prevalent code reuse and limited open-source contributions have introduced significant challenges to the blockchain ecosystem, including plagiarism and the propagation of vulnerable code. Consequently, an effective and accurate similarity detection method for EVM bytecode is urgently needed to identify similar contracts. Traditional binary similarity detection methods are typically based on instruction stream or control flow graph (CFG), which have limitations on EVM bytecode due to specific features like low-level EVM bytecode and heavily-reused basic blocks. Moreover, the highly-diverse Solidity Compiler (Solc) versions further complicate accurate similarity detection. Motivated by these challenges, we propose a novel EVM bytecode representation called Stable-Semantic Graph (SSG), which captures relationships between 'stable instructions' (special instructions identified by our study). Moreover, we implement a prototype, Esim, which embeds SSG into matrices for similarity detection using a heterogeneous graph neural network. Esim demonstrates high accuracy in SSG construction, achieving F1-scores of 100% for control flow and 95.16% for data flow, and its similarity detection performance reaches 96.3% AUC, surpassing traditional approaches. Our large-scale study, analyzing 2,675,573 smart contracts on six EVM-compatible chains over a one-year period, also demonstrates that Esim outperforms the SOTA tool Etherscan in vulnerability search.

智能合约代码相似性安全检测图神经网络

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。