trailofbits / manticore

Symbolic execution tool
https://blog.trailofbits.com/2017/04/27/manticore-symbolic-execution-for-humans/
GNU Affero General Public License v3.0
3.66k stars 470 forks source link

AttributeError: 'NoneType' object has no attribute 'result' #2547

Open alexdevassy opened 2 years ago

alexdevassy commented 2 years ago

Summary of the problem

I have using manticore in trailofbits docker image from here https://hub.docker.com/r/trailofbits/eth-security-toolbox. Tried to run manticore against example.sol available in https://github.com/trailofbits/manticore/wiki/Tutorial:-Running-under-Manticore. But it threw me AttributeError: 'NoneType' object has no attribute 'result'.

Manticore version

Manticore 0.3.6

Python version

Python 3.8.0

OS / Environment

Docker image from https://hub.docker.com/r/trailofbits/eth-security-toolbox No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic

Dependencies

solc, the solidity compiler commandline interface Version: 0.5.2+commit.1df8f40c.Linux.g++

Step to reproduce the behavior

$ manticore example.sol

Expected behavior

... ... m.c.manticore:INFO: Generated testcase No. 0 - STOP ... m.c.manticore:INFO: Generated testcase No. 1 - REVERT ... m.c.manticore:INFO: Generated testcase No. 2 - RETURN ... m.c.manticore:INFO: Generated testcase No. 3 - REVERT ... m.c.manticore:INFO: Generated testcase No. 4 - STOP ... m.c.manticore:INFO: Generated testcase No. 5 - REVERT ... m.c.manticore:INFO: Generated testcase No. 6 - REVERT ... m.c.manticore:INFO: Results in /home/ethsec/workshops/Automated Smart Contracts Audit - TruffleCon 2018/manticore/examples/mcore_t6vi6ij3 ...

Actual behavior

$ manticore example.sol 2022-05-13 11:24:14,653: [135] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'> 2022-05-13 11:24:14,654: [135] m.main:INFO: Beginning analysis 2022-05-13 11:24:14,658: [135] m.e.manticore:INFO: Starting symbolic create contract Process Process-12: Traceback (most recent call last): File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/home/ethsec/.local/lib/python3.6/site-packages/manticore/ethereum/manticore.py", line 1756, in worker_finalize finalizer(q.get_nowait()) File "/home/ethsec/.local/lib/python3.6/site-packages/manticore/ethereum/manticore.py", line 1747, in finalizer if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}: AttributeError: 'NoneType' object has no attribute 'result' 2022-05-13 11:24:14,906: [135] m.c.manticore:INFO: Results in /home/ethsec/mcore_y1p5dd8p 2022-05-13 11:24:14,907: [135] m.c.manticore:WARNING: Manticore failed to run

Any relevant logs

code in example.sol from https://github.com/trailofbits/manticore/wiki/Tutorial:-Running-under-Manticore pragma solidity >=0.4.24 <0.6.0; contract Simple { function f(uint a) payable public{ if (a == 65) { revert(); } } }

CharesFang commented 2 years ago

Give your user account more balance, such as 10**20. It is due to the insufficient account balance, the solidity_create_contract function would not throw any warning or error, just return a None instead.

trojanMcAfee commented 1 year ago

I think @alexdevassy was running a standalone analysis instead of a python script with its own constraints, so adding more balance wouldn't be possible here. I'm mentioning it because I'm getting the same error and that's what I'm doing.

Would you have by any chance another possible solution? Or if it's possible to specify a network? If so, I can default to hardhat and their first account with 10k ETH. @CharesFang

Full error:

Traceback (most recent call last):
  File "/Users/cdgmachado/anaconda3/envs/myenv/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/Users/cdgmachado/anaconda3/envs/myenv/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/cdgmachado/anaconda3/envs/myenv/lib/python3.6/site-packages/manticore/ethereum/manticore.py", line 1756, in worker_finalize
    finalizer(q.get_nowait())
  File "/Users/cdgmachado/anaconda3/envs/myenv/lib/python3.6/site-packages/manticore/ethereum/manticore.py", line 1747, in finalizer
    if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}:
AttributeError: 'NoneType' object has no attribute 'result'

Manticore call: manticore contracts/ethereum/ProxyFactory.sol --solc-remaps "@openzeppelin=node_modules/@openzeppelin @uniswap=node_modules/@uniswap @chainlink=node_modules/@chainlink @rari-capital=node_modules/@rari-capital hardhat=node_modules/hardhat" --contract ProxyFactory.sol

zarifpour commented 1 year ago

Give your user account more balance, such as 10**20. It is due to the insufficient account balance, the solidity_create_contract function would not throw any warning or error, just return a None instead.

I am having the same issue with the same error as @cdgmachado0. I am also trying to run the analysis on a standalone contract.

@CharesFang:

kevzettler commented 1 year ago

Same issue here in a monorepo hardhat project. Running locally to analyze source code. Dunno why we're talking about adding balance to account. @CharesFang point about balance seems off topic and misleading.

$ manticore --solc-remaps='@openzeppelin/contracts/utils/Context.sol=../../node_modules/@openzeppelin/contracts/utils/Context.sol @zk-kit/incremental-merkle-tree.sol/IncrementalBinaryTree.sol=../../node_modules/@zk-kit/incremental-merkle-tree.sol/IncrementalBinaryTree.sol' --contract=Semaphore ./contracts/Semaphore.sol
2022-09-30 04:11:12,828: [5105] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'>
2022-09-30 04:11:12,828: [5105] m.main:INFO: Beginning analysis
2022-09-30 04:11:12,830: [5105] m.e.manticore:INFO: Starting symbolic create contract
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 1766, in worker_finalize
    finalizer(q.get_nowait())
  File "/home/ubuntu/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 1757, in finalizer
    if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}:
AttributeError: 'NoneType' object has no attribute 'result'
kleozzy commented 1 year ago

so did anyone figure this out?

joedakwa commented 1 year ago

Did anyone sort this out? I am having the same issues too

spaceh3ad commented 7 months ago

Hmm it's been a while but seems to not be addressed. I am facing same issue.

confusedeinstein commented 4 months ago

Have anyfound solution to this, I'm facing this to.