crytic / rattle

evm binary static analysis
https://www.trailofbits.com/presentations/rattle/
344 stars 41 forks source link

Delegatecalls causes ValueError #13

Closed itszn closed 5 years ago

itszn commented 6 years ago

If a contract has a delegatecall, we get this exception:

Traceback (most recent call last):
  File "rattle-cli.py", line 191, in <module>
    main()
  File "rattle-cli.py", line 87, in main
    can_send, functions_that_can_send = ssa.can_send_ether()
  File "/home/itszn/tools/rattle/rattle/recover.py", line 724, in can_send_ether
    frv, _ = function.can_send_ether()
  File "/home/itszn/tools/rattle/rattle/ssa.py", line 692, in can_send_ether
    gas, to, value, in_offset, in_size, out_offset, out_size = insn.arguments
ValueError: not enough values to unpack (expected 7, got 6)

Here is an example contract:

pragma solidity ^0.4.24;
contract Test {
    function test(address target, bytes data) public {
        target.delegatecall(data);
    }
}
withzombies commented 5 years ago

Fixed in a92b7a7