以太坊智能合约的安全分析工具
项目描述
秘银
Mythril 是 EVM 字节码的安全分析工具。它检测为以太坊、Hedera、Quorum、Vechain、Roostock、Tron 和其他与 EVM 兼容的区块链构建的智能合约中的安全漏洞。它使用符号执行、SMT 解决和污点分析来检测各种安全漏洞。它还在MythX安全分析平台中使用(与其他工具和技术结合使用)。
如果您是智能合约开发人员,我们建议您使用针对可用性进行了优化并涵盖更广泛的安全问题的MythX 工具。
无论您是想做出贡献、需要支持,还是想了解我们未来的烹饪方式,我们的Discord 服务器都将满足您的需求。
安装和设置
使用Docker获取它:
$ docker pull mythril/myth
从 Pypi (Python 3.6-3.9) 安装:
$ pip3 install mythril
有关更详细的说明,请参阅文档。
用法
跑:
$ myth analyze <solidity-file>
或者:
$ myth analyze -a <contract-address>
指定要探索的最大事务数-t <number>。您还可以使用 设置超时--execution-timeout <seconds>。
killbilly.sol以下是在事务solidity_examples目录中的文件上运行 Mythril 的示例3:
> myth a killbilly.sol -t 3
==== Unprotected Selfdestruct ====
SWC ID: 106
Severity: High
Contract: KillBilly
Function name: commencekilling()
PC address: 354
Estimated Gas Usage: 974 - 1399
Any sender can cause the contract to self-destruct.
Any sender can trigger execution of the SELFDESTRUCT instruction to destroy this contract account and withdraw its balance to an arbitrary address. Review the transaction trace generated for this issue and make sure that appropriate security controls are in place to prevent unrestricted access.
--------------------
In file: killbilly.sol:22
selfdestruct(msg.sender)
--------------------
Initial State:
Account: [CREATOR], balance: 0x2, nonce:0, storage:{}
Account: [ATTACKER], balance: 0x1001, nonce:0, storage:{}
Transaction Sequence:
Caller: [CREATOR], calldata: , decoded_data: , value: 0x0
Caller: [ATTACKER], function: killerize(address), txdata: 0x9fa299cc000000000000000000000000deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, decoded_data: ('0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',), value: 0x0
Caller: [ATTACKER], function: activatekillability(), txdata: 0x84057065, value: 0x0
Caller: [ATTACKER], function: commencekilling(), txdata: 0x7c11da20, value: 0x0
在文档中可以找到使用 Mythril 的说明。
如需支持或一般性讨论,请加入Discord上的 Mythril 社区。
构建文档
Mythril 的文档包含在该docs文件夹中,并发布到Read the Docs。它基于 Sphinx,可以使用子目录中包含的 Makefile 构建:
cd docs
make html
这将创建一个build包含 HTML 输出的输出目录。或者,可以使用make latexpdf. 可用的输出格式选项可以通过make help.
漏洞修复
访问智能合约漏洞分类注册表以查找报告的漏洞的详细信息和修复指南。