diff --git a/README.md b/README.md index b2afaa08..0adc54ee 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ $ myth analyze -a Specify the maximum number of transaction to explore with `-t `. You can also set a timeout with `--execution-timeout `. Example ([source code](https://gist.github.com/b-mueller/2b251297ce88aa7628680f50f177a81a#file-killbilly-sol)): ``` +> myth a killbilly.sol -t 3 ==== Unprotected Selfdestruct ==== SWC ID: 106 Severity: High diff --git a/mythril/laser/ethereum/call.py b/mythril/laser/ethereum/call.py index 5ad1943c..7be156d0 100644 --- a/mythril/laser/ethereum/call.py +++ b/mythril/laser/ethereum/call.py @@ -28,6 +28,7 @@ to get the necessary elements from the stack and determine the parameters for th """ log = logging.getLogger(__name__) +SYMBOLIC_CALLDATA_SIZE = 320 # Used when copying symbolic calldata def get_call_parameters( @@ -178,6 +179,8 @@ def get_call_data( else memory_size ), ) + if memory_size.symbolic: + memory_size = SYMBOLIC_CALLDATA_SIZE try: calldata_from_mem = state.memory[ util.get_concrete_int(memory_start) : util.get_concrete_int( diff --git a/mythril/laser/ethereum/instructions.py b/mythril/laser/ethereum/instructions.py index 9ace7cac..e2b5bedf 100644 --- a/mythril/laser/ethereum/instructions.py +++ b/mythril/laser/ethereum/instructions.py @@ -35,7 +35,12 @@ from mythril.laser.ethereum.state.calldata import ConcreteCalldata, SymbolicCall import mythril.laser.ethereum.util as helper from mythril.laser.ethereum import util 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 ( VmException, StackUnderflowException, @@ -812,7 +817,7 @@ class Instruction: size = util.get_concrete_int(size) # type: Union[int, BitVec] except TypeError: 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) if size > 0: @@ -2188,7 +2193,6 @@ class Instruction: global_state.new_bitvec("retval_" + str(instr["address"]), 256) ) return [global_state] - except ValueError as e: log.debug( "Could not determine required parameters for call, putting fresh symbol on the stack. \n{}".format( diff --git a/mythril/mythril/mythril_config.py b/mythril/mythril/mythril_config.py index 174e47e5..e7f4463b 100644 --- a/mythril/mythril/mythril_config.py +++ b/mythril/mythril/mythril_config.py @@ -192,11 +192,14 @@ class MythrilConfig: if m and m.group(1) in ["mainnet", "rinkeby", "kovan", "ropsten"]: if self.infura_id in (None, ""): - raise CriticalError( - "Infura key not provided. Use --infura-id " + log.info( + "Infura key not provided, so onchain access is disabled. " + "Use --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 = ( "{}.infura.io/v3/{}".format(m.group(1), self.infura_id),