请问如何使用manticore分析合约中存在的漏洞呢,如何将漏洞类型提示在shell中?
我尝试使用manticore符号执行分析漏洞合约中存在的漏洞,但是总是出问题,脚本如下,shell提示在最下面:
from manticore.ethereum import ManticoreEVM
# 定义智能合约源码
contract_source_code = """
pragma solidity >=0.4.22 <0.7.0;
/**
* @title Vulnerable to Re-Entrancy
*/
contract Vulnerable {
mapping(address => uint) public balances;
function deposit() public payable {
balances[msg.sender] += msg.value;
}
function withdraw() public {
uint transferAmount = balances[msg.sender];
require(transferAmount > 0);
(bool success, ) = msg.sender.call.value(transferAmount)("");
require(success);
balances[msg.sender] = 0;
}
}
"""
# 初始化 Manticore
m = ManticoreEVM()
# 创建一个以太坊账户
user_account = m.create_account(balance=1000000000)
# 从源码创建智能合约实例
contract = m.solidity_create_contract(contract_source_code, owner=user_account)
# 与合约交互
contract.deposit(value=100) # 用户存入 100 wei
contract.withdraw() # 尝试提现
# 开始分析
m.finalize()
shell提示以下问题,但是不报合约中存在的漏洞:
lrj@ubuntu:/mnt/hgfs/ubuntu_delegatecall/atestall$ python3 t3.py
2024-02-16 04:19:00,484: [26161] m.c.plugin:WARNING: Caught will_solve in state None, but failed to capture its initialization
另:
如果我使用manticore分析完成后,输出了一个mcroe_开头的文件夹,请问漏洞是不会自动报到shell中吗,漏洞只能通过文件夹内的内容分析么。如果只能通过文件夹中的内容分析的话,请问如何分析呢?