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

KeyError: 'upsert(tuple,bool)' #2560

Open ghost opened 2 years ago

ghost commented 2 years ago

Summary of the problem

Manticore can't load correctly ABI by signature self._function_abi_items_by_signature[sig] probably miscounts signature for methods with struct

Manticore version

0.3.7

Python version

3.8

OS / Environment

MacOS

Dependencies

manticore==0.3.7
slither-analyzer==0.8.3

Step to reproduce the behavior

interface IMigrate {
    struct Deposit {
        bool exists;
        bool withdrawn;
        uint8 networkId; // Only for ethereum and bsc
        uint256 lockId;
        uint256 amount;
        uint256 lockUntil;
        address withdrawalAddress;
        string packageKey;
    }

    function upsert(Deposit memory, bool) external returns (bool);
}

contract Migrate {
    function upsert(Deposit memory deposit, bool update) external onlyOwner returns (bool) {
       ...
    }
}

Expected behavior

I should get full output of audit

Actual behavior

I get error:

Traceback (most recent call last):
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/core/worker.py", line 137, in run
    current_state.execute()
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/ethereum/state.py", line 8, in execute
    return self._platform.execute()
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/platforms/evm.py", line 3102, in execute
    self._process_pending_transaction()
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/platforms/evm.py", line 3394, in _process_pending_transaction
    self._open_transaction(sort, address, price, data, caller, value, gas=gas)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/platforms/evm.py", line 2660, in _open_transaction
    self._publish("will_open_transaction", tx)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/utils/event.py", line 148, in _publish
    self._publish_impl(_name, *args, **kwargs)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/utils/event.py", line 175, in _publish_impl
    sink._publish_impl(_name, *args, **kwargs)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/utils/event.py", line 173, in _publish_impl
    sink._publish_impl(_name, self, *args, **kwargs)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/utils/event.py", line 166, in _publish_impl
    callback(robj(), *new_args, **kwargs)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/core/plugin.py", line 25, in g
    return f(self, *args, **kwargs)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/ethereum/plugins.py", line 71, in will_open_transaction_callback
    abi = md.get_abi(func_hsh)
  File "/Users/dante/.venv/oyente/lib/python3.9/site-packages/manticore/ethereum/solidity.py", line 226, in get_abi
    return dict(self._function_abi_items_by_signature[sig])
KeyError: 'upsert(tuple,bool)'