arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.14580cs.CRcs.PLcs.SE
收藏

揭秘不变式在智能合约安全防护中的有效性

Demystifying Invariant Effectiveness for Securing Smart Contracts

Zhiyang Chen, Ye Liu, Sidi Mohamed Beillahi, Yi Li, Fan Long

AI总结:

本研究针对智能合约不变式防护有效性不明的问题,开发了可基于历史交易生成定制化不变式的工具Trace2Inv,在以太坊合约测试中展现出优异的攻击拦截效果与低误报率,还发现了未被报告的漏洞利用交易。

摘要:

与安全攻击相关的智能合约交易,相较于攻击事件发生前的历史良性交易,往往表现出截然不同的行为模式。尽管已有许多运行时监控与防护机制被提出,用于验证不变式并实时拦截异常交易,但所采用的不变式的实际有效性仍缺乏充分研究。本文研究了8大类共23种常用不变式,这些不变式要么已部署在知名协议中,要么得到了顶尖审计公司与安全专家的认可。我们以这些成熟的不变式为模板,开发了工具Trace2Inv,该工具可基于给定合约的历史交易数据,动态生成适配该合约的定制化不变式。\n我们在以太坊区块链上42个曾遭受27种不同漏洞利用攻击的智能合约上对Trace2Inv进行了评估。研究结果显示,仅靠最有效的单一不变式防护,就能以极低的gas开销成功拦截27种已识别漏洞利用中的18种。我们的分析还表明,即便经验丰富的攻击者试图绕过这些不变式,大多数不变式仍能保持有效性。此外,我们研究了组合多种不变式防护的可行性,最终可拦截27种基准漏洞利用中的多达23种,且误报率低至0.32%。Trace2Inv在实用性与准确性两方面均优于当前智能合约不变式挖掘与交易攻击检测领域的前沿工作。尽管Trace2Inv最初并非专为交易攻击检测设计,但它出人意料地发现了两笔此前未被报告的漏洞利用交易,时间早于针对相同受害合约的所有已报告漏洞利用交易。

英文摘要:

Smart contract transactions associated with security attacks often exhibit distinct behavioral patterns compared with historical benign transactions before the attacking events. While many runtime monitoring and guarding mechanisms have been proposed to validate invariants and stop anomalous transactions on the fly, the empirical effectiveness of the invariants used remains largely unexplored. In this paper, we studied 23 prevalent invariants of 8 categories, which are either deployed in high-profile protocols or endorsed by leading auditing firms and security experts. Using these well-established invariants as templates, we developed a tool Trace2Inv which dynamically generates new invariants customized for a given contract based on its historical transaction data. We evaluated Trace2Inv on 42 smart contracts that fell victim to 27 distinct exploits on the Ethereum blockchain. Our findings reveal that the most effective invariant guard alone can successfully block 18 of the 27 identified exploits with minimal gas overhead. Our analysis also shows that most of the invariants remain effective even when the experienced attackers attempt to bypass them. Additionally, we studied the possibility of combining multiple invariant guards, resulting in blocking up to 23 of the 27 benchmark exploits and achieving false positive rates as low as 0.32%. Trace2Inv outperforms current state-of-the-art works on smart contract invariant mining and transaction attack detection in terms of both practicality and accuracy. Though Trace2Inv is not primarily designed for transaction attack detection, it surprisingly found two previously unreported exploit transactions, earlier than any reported exploit transactions against the same victim contracts.

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

↑