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.68k stars 472 forks source link

finalizer: 'NoneType' object has no attribute 'result' #2617

Open gsalzer opened 1 year ago

gsalzer commented 1 year ago

Summary of the problem

Running Manticore on even the most basic contracts results invariably in an AttributeError: 'NoneType' object has no attribute 'result'.

Manticore version

Latest docker image:

$ docker images --digests trailofbits/manticore
REPOSITORY              TAG       DIGEST                                                                    IMAGE ID       CREATED      SIZE
trailofbits/manticore   latest    sha256:58c2bf71237a0b44e4c2600a0f951a11a53db54863048dbd469b266a05da5d7b   8e84d9fb9105   6 days ago   892MB

Steps to reproduce the behavior

[ The file t.sol is copied into the container, after starting it.]

$ docker run -it --entrypoint /bin/bash trailofbits/manticore

root@dac57690929e:/# cat t.sol
pragma solidity ^0.4.0;
contract test {}

root@dac57690929e:/# manticore t.sol
2023-01-20 17:46:50,679: [116] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'>
2023-01-20 17:46:50,680: [116] m.main:INFO: Beginning analysis
2023-01-20 17:46:50,682: [116] 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 "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1767, in worker_finalize
    finalizer(q.get_nowait())
  File "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1758, in finalizer
    if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}:
AttributeError: 'NoneType' object has no attribute 'result'
2023-01-20 17:46:50,753: [116] m.c.manticore:INFO: Results in /mcore_5lmji0vy
2023-01-20 17:46:50,753: [116] m.c.manticore:WARNING: Manticore failed to run
jingxuan98 commented 1 year ago

got same error here

theluxaz commented 1 year ago

same here

talfao commented 12 months ago

same

MarkLee131 commented 9 months ago

same error, seems Manticore failed to generate its report.

cwj893390557 commented 3 months ago

@gsalzer may I ask if any solution for this error yet?

gsalzer commented 3 months ago

@cwj893390557 Nothing has changed. This moment, I did:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:    24.04
Codename:   noble

$ docker --version
Docker version 24.0.7, build 24.0.7-0ubuntu4

$ docker pull trailofbits/manticore:latest
[ ... ]
Digest: sha256:d489a7bd7bcaafb1d38f09ab4f58ca80a80f6c1fd7ad33c8d0f407e0184eece9
Status: Downloaded newer image for trailofbits/manticore:latest

$ docker run -it --entrypoint /bin/bash trailofbits/manticore
root@ecc5145368d7:/#
[ ... from some other terminal, do: docker cp t.sol ecc5145368d7:/ ... ]

root@ecc5145368d7:/# cat t.sol
pragma solidity ^0.4.0;
contract test {}

root@ecc5145368d7:/# manticore t.sol
2024-06-15 09:57:25,725: [14] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'>
2024-06-15 09:57:25,725: [14] m.main:INFO: Beginning analysis
2024-06-15 09:57:25,726: [14] m.e.manticore:INFO: Starting symbolic create contract
2024-06-15 09:57:25,774: [14] m.e.manticore:INFO: Failed to build contract None Errors : 
Solidity version not found:
STDOUT:

STDERR:
Traceback (most recent call last):
  File "/usr/local/bin/solc", line 8, in <module>
    sys.exit(solc())
  File "/usr/local/lib/python3.8/dist-packages/solc_select/__main__.py", line 87, in solc
    res = current_version()
  File "/usr/local/lib/python3.8/dist-packages/solc_select/solc_select.py", line 67, in current_version
    raise argparse.ArgumentTypeError(
argparse.ArgumentTypeError: No solc version set. Run `solc-select use VERSION` or set SOLC_VERSION environment variable.

. Solidity failed to generate bytecode for your contract. Check if all the abstract functions are implemented. 
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 "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1767, in worker_finalize
    finalizer(q.get_nowait())
  File "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1758, in finalizer
    if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}:
AttributeError: 'NoneType' object has no attribute 'result'
2024-06-15 09:57:25,804: [14] m.c.manticore:INFO: Results in /mcore_ob9yzbcq
2024-06-15 09:57:25,805: [14] m.c.manticore:WARNING: Manticore failed to run
gsalzer commented 3 months ago

BTW, this error does not seem related to the fact that the test contract specifies pragma solidity ^0.4.0. The same error message occurs when requiring 0.8.25, selecting this compiler version manually and then running Manticore.

$ docker run -it --entrypoint /bin/bash trailofbits/manticore

root@35a510e62cab:/#  cat > t.sol <<ENDCAT
> pragma solidity ^0.8.25;
> contract test {}
> ENDCAT

root@35a510e62cab:/# cat t.sol
pragma solidity ^0.8.25;
contract test {}

root@35a510e62cab:/# solc-select install 0.8.25
Installing solc '0.8.25'...
Version '0.8.25' installed.
root@35a510e62cab:/# solc-select use 0.8.25
Switched global version to 0.8.25
root@35a510e62cab:/# solc --version
solc, the solidity compiler commandline interface
Version: 0.8.25+commit.b61c2a91.Linux.g++

root@35a510e62cab:/# manticore t.sol
2024-06-15 10:14:04,318: [83] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'>
2024-06-15 10:14:04,318: [83] m.main:INFO: Beginning analysis
2024-06-15 10:14:04,319: [83] 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 "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1767, in worker_finalize
    finalizer(q.get_nowait())
  File "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1758, in finalizer
    if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}:
AttributeError: 'NoneType' object has no attribute 'result'
2024-06-15 10:14:04,450: [83] m.c.manticore:INFO: Results in /mcore_rllwwaj9
2024-06-15 10:14:04,450: [83] m.c.manticore:WARNING: Manticore failed to run
gsalzer commented 3 months ago

According to the README on the main page, Manticore is no longer actively maintained by the developers, and they will not look into old and new issues. Instead, they expect that the issues are handled 'by the community'. So, even though this seems to be just a basic issue (maybe just a usage error), I do not expect that it becomes resolved any time soon, given that the 'community' hasn't done so in the past 18 months.