Merge branch 'develop' of github.com:ConsenSys/mythril into call_depth

call_depth
Bernhard Mueller 5 years ago
commit 7f4b462af6
  1. 1
      README.md
  2. 3
      mythril/laser/ethereum/call.py
  3. 10
      mythril/laser/ethereum/instructions.py
  4. 9
      mythril/mythril/mythril_config.py

@ -51,6 +51,7 @@ $ myth analyze -a <contract-address>
Specify the maximum number of transaction to explore with `-t <number>`. You can also set a timeout with `--execution-timeout <seconds>`. Example ([source code](https://gist.github.com/b-mueller/2b251297ce88aa7628680f50f177a81a#file-killbilly-sol)): Specify the maximum number of transaction to explore with `-t <number>`. You can also set a timeout with `--execution-timeout <seconds>`. Example ([source code](https://gist.github.com/b-mueller/2b251297ce88aa7628680f50f177a81a#file-killbilly-sol)):
``` ```
> myth a killbilly.sol -t 3
==== Unprotected Selfdestruct ==== ==== Unprotected Selfdestruct ====
SWC ID: 106 SWC ID: 106
Severity: High Severity: High

@ -28,6 +28,7 @@ to get the necessary elements from the stack and determine the parameters for th
""" """
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
SYMBOLIC_CALLDATA_SIZE = 320 # Used when copying symbolic calldata
def get_call_parameters( def get_call_parameters(
@ -178,6 +179,8 @@ def get_call_data(
else memory_size else memory_size
), ),
) )
if memory_size.symbolic:
memory_size = SYMBOLIC_CALLDATA_SIZE
try: try:
calldata_from_mem = state.memory[ calldata_from_mem = state.memory[
util.get_concrete_int(memory_start) : util.get_concrete_int( util.get_concrete_int(memory_start) : util.get_concrete_int(

@ -35,7 +35,12 @@ from mythril.laser.ethereum.state.calldata import ConcreteCalldata, SymbolicCall
import mythril.laser.ethereum.util as helper import mythril.laser.ethereum.util as helper
from mythril.laser.ethereum import util from mythril.laser.ethereum import util
from mythril.laser.ethereum.keccak_function_manager import keccak_function_manager from mythril.laser.ethereum.keccak_function_manager import keccak_function_manager
from mythril.laser.ethereum.call import get_call_parameters, native_call, get_call_data from mythril.laser.ethereum.call import (
get_call_parameters,
native_call,
get_call_data,
SYMBOLIC_CALLDATA_SIZE,
)
from mythril.laser.ethereum.evm_exceptions import ( from mythril.laser.ethereum.evm_exceptions import (
VmException, VmException,
StackUnderflowException, StackUnderflowException,
@ -812,7 +817,7 @@ class Instruction:
size = util.get_concrete_int(size) # type: Union[int, BitVec] size = util.get_concrete_int(size) # type: Union[int, BitVec]
except TypeError: except TypeError:
log.debug("Unsupported symbolic size in CALLDATACOPY") log.debug("Unsupported symbolic size in CALLDATACOPY")
size = 320 # The excess size will get overwritten size = SYMBOLIC_CALLDATA_SIZE # The excess size will get overwritten
size = cast(int, size) size = cast(int, size)
if size > 0: if size > 0:
@ -2188,7 +2193,6 @@ class Instruction:
global_state.new_bitvec("retval_" + str(instr["address"]), 256) global_state.new_bitvec("retval_" + str(instr["address"]), 256)
) )
return [global_state] return [global_state]
except ValueError as e: except ValueError as e:
log.debug( log.debug(
"Could not determine required parameters for call, putting fresh symbol on the stack. \n{}".format( "Could not determine required parameters for call, putting fresh symbol on the stack. \n{}".format(

@ -192,11 +192,14 @@ class MythrilConfig:
if m and m.group(1) in ["mainnet", "rinkeby", "kovan", "ropsten"]: if m and m.group(1) in ["mainnet", "rinkeby", "kovan", "ropsten"]:
if self.infura_id in (None, ""): if self.infura_id in (None, ""):
raise CriticalError( log.info(
"Infura key not provided. Use --infura-id <INFURA_ID> " "Infura key not provided, so onchain access is disabled. "
"Use --infura-id <INFURA_ID> "
"or set it in the environment variable INFURA_ID " "or set it in the environment variable INFURA_ID "
"or in the ~/.mythril/config.ini file'" "or in the ~/.mythril/config.ini file"
) )
self.eth = None
return
rpcconfig = ( rpcconfig = (
"{}.infura.io/v3/{}".format(m.group(1), self.infura_id), "{}.infura.io/v3/{}".format(m.group(1), self.infura_id),

Loading…
Cancel
Save