错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

CFGCon: A Scheme for Accurately Generating Control Flow Graphs of Smart Contracts

  • Nengyu Xia,
  • Yixin Zhang,
  • Wei Ren,
  • Xianyi Chen

摘要

Smart contracts are a significant component that allows decentralized applications (DApps) to automate the exchange of digital assets without third-party surveillance. To build trust, smart contracts are designed to be immutable, resulting in design flaws that may remain unrevealed in deployed contracts. Many analysis tools are developed to identify various vulnerabilities that could be targeted by hackers after deployment and thus cause financial losses. However, these approaches based on graph classification rely much on the quality of control flow graphs (CFGs) generated from the bytecode of smart contracts. In this paper, we propose a novel generator named CFGCon to convert bytecodes of smart contracts to CFGs. After targeting the difficulties for the existing CFG generators, a program counter is designed to deal with the opcodes with loops or instructions that need to read the current counter. Experimental results show that our proposed CFGCon reached a much higher success rate than other state-of-art CFG generators on the dataset containing 579 open source contracts and 10,000 non-open source contracts from Ethereum. At the same time, the analysis speed of CFGCon is similar to that of the current mainstream tools.