[论文解读] GasFuzz: Generating High Gas Consumption Inputs to Avoid Out-of-Gas Vulnerability.
该论文提出 V-Gas,一种基于反馈的突变模糊测试工具,通过生成高 gas 消耗输入,减少以太坊智能合约中 gas 限制的低估问题。通过构建 gas 加权控制流图并利用 gas 消耗反馈指导突变,V-Gas 将 gas 限制低估率从 44.02% 降低至 13.86%,并发现了 25 个此前未知的 out-of-gas 漏洞,其中 5 个已获得 CVE 标识符。
The out-of-gas error occurs when smart contract programs are provided with inputs that cause excessive gas consumption, and would be easily exploited to make the DoS attack. Multiple approaches have been proposed to estimate the gas limit of a function in smart contracts to avoid such error. However, under estimation often happens when the contract is complicated. In this work, we propose V-Gas, which could automatically generate inputs that maximizes the gas cost and reduce the under estimation cases. V-Gas is designed based on feedback-directed mutational fuzz testing. First, V-Gas builds the gas weighted control flow graph (CFG) of functions in smart contracts. Then, V-Gas develops gas consumption guided selection and mutation strategies to generate the input that maximize the gas consumption. For evaluation, we implement V-Gas based on js-evm, a widely used ethereum virtual machine written in javascript, and conduct experiments on 736 real-world transactions recorded on Ethereum. 44.02\% of the transactions would have out-of-gas errors under the estimation results given by solc, means that the recorded real gas consumption for those recorded transactions is larger than the gas limit value estimated by solc. While V-Gas could reduce the under estimation ratio to 13.86\%. Furthermore, V-Gas has exposed 25 previously unknown out-of-gas vulnerabilities in those widely-used smart contracts, 5 of which have been assigned unique CVE identifiers in the US National Vulnerability Database.
研究动机与目标
- 为解决以太坊智能合约中持续存在的 gas 限制低估问题,该问题会导致 out-of-gas 错误并可能引发拒绝服务攻击。
- 提高复杂智能合约中 gas 限制估算的准确性,这些合约的静态分析工具(如 solc)常会失效。
- 开发一种自动化的输入生成技术,以最大化 gas 消耗,从而暴露低估风险。
- 在广泛部署的智能合约中识别此前未被发现的 out-of-gas 漏洞。
提出的方法
- 为智能合约中的每个函数构建 gas 加权控制流图(CFG),以建模不同执行路径上的 gas 消耗。
- 应用基于反馈的突变模糊测试,其中突变策略由实时 gas 消耗反馈指导,以演化输入。
- 使用 gas 消耗作为适应度指标,选择并优先处理能增加 gas 使用量的输入突变。
- 将模糊测试器集成到 js-evm(一个基于 JavaScript 的以太坊虚拟机)中,以实现在真实交易上的精确 gas 测量。
- 在 736 个真实以太坊交易上评估生成的输入,以衡量低估率的降低和漏洞的发现情况。
实验结果
研究问题
- RQ1基于反馈的突变模糊测试能否有效生成最大化智能合约 gas 消耗的输入?
- RQ2与 solc 等静态分析工具相比,V-Gas 在降低 gas 限制低估率方面能达到何种程度?
- RQ3V-Gas 能在真实世界智能合约中发现多少个此前未知的 out-of-gas 漏洞?
- RQ4所发现的漏洞能否独立验证并被分配 CVE 标识符?
主要发现
- 在 736 个真实以太坊交易上评估时,V-Gas 将 gas 限制低估率从 44.02% 降低至 13.86%。
- 该工具成功暴露了广泛使用智能合约中 25 个此前未知的 out-of-gas 漏洞。
- 其中 5 个发现的漏洞被分配到美国国家漏洞数据库(NVD)的唯一 CVE 标识符,证实了其严重性和可重现性。
- gas 加权 CFG 和基于反馈的突变策略显著提升了对高成本执行路径的检测能力。
- 结果表明,与静态分析相比,动态的、基于反馈的模糊测试在识别 gas 相关漏洞方面更为有效。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。