-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Description:
Dynamic control flow introduced by dynamic jumps is broken. A dynamic jump's target address may come from memory or storage stored before. And gigahorse doesn't handle these indirect jumps, which leads to broken control flow. Reachability is the precondition of parsed code blocks being included in gigahorse IR. Broken control flow could make some code blocks unreachable and then be ignored in gigahorse IR generation.
POC:
- source code
contract IncompletenessPOC { function callee1() internal view returns (uint) { return 0x999; } function callee2() internal view returns (uint) { return 0x998; } function test() public view returns (uint) { function() internal view returns (uint)[2] memory funcs; funcs[0] = callee1; funcs[1] = callee2; function() internal view returns (uint) func = funcs[0]; return func(); } }
- bin-runtime hex
608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8a8fd6d1461002d575b5f80fd5b61003561004b565b604051610042919061014b565b60405180910390f35b5f610054610101565b6100ef815f6002811061006a57610069610164565b5b602002019067ffffffffffffffff16908167ffffffffffffffff16815250506100f8816001600281106100a05761009f610164565b5b602002019067ffffffffffffffff16908167ffffffffffffffff1681525050610129815f600281106100d5576100d4610164565b5b602002015190506100e88163ffffffff16565b9250505090565b5f610999905090565b5f610998905090565b60405180604001604052806002905b6101298152602001906001900390816101105790505090565b610131610191565b565b5f819050919050565b61014581610133565b82525050565b5f60208201905061015e5f83018461013c565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52605160045260245ffdfea2646970667358221220f85da9acbfe2b470870c2989a497f2a258ebdd9424a6b153e0dd999a090f4a8d64736f6c63430008140033
Steps to Reproduce:
- run the tool under the latest version (for now it's the commit 3e6f86d)
$ ./gigahorse.py --debug -C clients/visualizeout.py POC.bin-runtime.hex
Expected Behavior:
TAC_Variable_Value(_, 0x999)orTAC_Variable_Value(_, 0x998)
Actual Behavior:
!TAC_Variable_Value(_, 0x999)and!TAC_Variable_Value(_, 0x998)
Environment:
- gigahorse: commit 3e6f86d
Metadata
Metadata
Assignees
Labels
No labels