From d34ba49f1ceabd7a8abeb52b0841283451fa39b7 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Thu, 7 May 2020 17:44:27 +0100 Subject: [PATCH 1/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) 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 From bd00d944cad6b10b7f13ede199ae5d969ea4148f Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Sat, 9 May 2020 00:44:08 +0100 Subject: [PATCH 2/3] Fix config to handle when infura key isn't provided (#1380) --- mythril/mythril/mythril_config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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), From 24b2ec862f3c7092b9a482f347ed87401c964ede Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Mon, 11 May 2020 13:44:37 +0100 Subject: [PATCH 3/3] Use concrete calldata size value when copying and transfering (#1381) * Use concrete value over symbolic * Use debug over info Co-authored-by: Nikhil Parasaram --- mythril/laser/ethereum/call.py | 3 +++ mythril/laser/ethereum/instructions.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) 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 175ef9db..d991fdfe 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, @@ -811,7 +816,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: @@ -2158,7 +2163,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(