arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2501.06459cs.SE
收藏

增强The Open Network:智能合约缺陷的定义与自动化检测

Enhancing The Open Network: Definition and Automated Detection of Smart Contract Defects

Hao Song, Teng Li, Jiachi Chen, Ting Chen, Beibei Li, Zhangyan Lin, Yi Lu, Pan Li, Xihan Zhou

AI总结:

本文针对TON生态智能合约缺陷研究不足的问题,定义了8类TON智能合约缺陷,提出适配TON特性的静态检测框架TONScanner,在1640个合约中检测出14995个缺陷,准确率达97.49%,可辅助开发者修复合约问题。

摘要:

The Open Network(TON,开放网络)旨在支撑Telegram数亿规模的庞大用户群,自2022年上线以来已获得广泛关注。FunC是TON生态中编写智能合约最主流的编程语言,与其他智能合约语言相比,它具备独特的语法特性。尽管业界对TON的兴趣日益增长,但针对TON智能合约实际缺陷的研究仍处于起步阶段。\n本文总结了从TON官方博客与审计报告中识别出的8类智能合约缺陷,每类均附带详细定义与代码示例。此外,我们提出了名为TONScanner的静态分析框架,以实现对这些缺陷的高效检测。具体而言,TONScanner复用FunC编译器的前端代码,将FunC源代码转换为有向无环图(DAG)形式的FunC中间表示(IR)。基于该中间表示,TONScanner构建控制流图(CFG),再将其转换为静态单赋值(SSA)形式以简化后续分析。TONScanner还集成了数据依赖分析、调用图、污点分析以及Cell构造模块,这些模块均是针对TON区块链独特的数据结构定制开发的,最终共同支撑8类缺陷的识别工作。\n我们通过将TONScanner应用于1640个智能合约来评估其有效性,共检测出14995个缺陷。通过随机抽样与人工标注验证,TONScanner的整体准确率达到97.49%。结果显示,当前的TON合约中存在大量缺陷,表明开发者在编写合约时容易出错。TONScanner已被证明能够精准识别这些缺陷,从而助力缺陷修复工作。

英文摘要:

The Open Network (TON), designed to support Telegram's extensive user base of hundreds of millions, has garnered considerable attention since its launch in 2022. FunC is the most popular programming language for writing smart contracts on TON. It is distinguished by a unique syntax compared to other smart contract languages. Despite growing interest, research on the practical defects of TON smart contracts is still in its early stages. In this paper, we summarize eight smart contract defects identified from TON's official blogs and audit reports, each with detailed definitions and code examples. Furthermore, we propose a static analysis framework called TONScanner to facilitate the detection of these defects. Specifically, TONScanner reuses FunC compiler's frontend code to transform the FunC source code into FunC intermediate representation (IR) in the form of a directed acyclic graph (DAG). Based on this IR, TONScanner constructs a control flow graph (CFG), then transforms it into a static single assignment (SSA) form to simplify further analysis. TONScanner also integrates Data Dependency, Call Graph, Taint Analysis, and Cell Construct, which are specifically tailored for TON blockchain's unique data structures. These components finally facilitate the identification of the eight defects. We evaluate the effectiveness of TONScanner by applying it to 1,640 smart contracts and find a total of 14,995 defects. Through random sampling and manual labeling, we find that TONScanner achieves an overall precision of 97.49%. The results reveal that current TON contracts contain numerous defects, indicating that developers are prone to making errors. TONScanner has proven its ability to accurately identify these defects, thereby aiding in their correction.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑