Merge pull request #1355 from ConsenSys/origin_model

Correctly model the relation between tx.origin and msg.sender
pull/1359/head
Bernhard Mueller 5 years ago committed by GitHub
commit 80b8a59a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      mythril/analysis/module/modules/deprecated_ops.py
  2. 13
      mythril/laser/ethereum/transaction/symbolic.py

@ -1,8 +1,6 @@
"""This module contains the detection code for deprecated op codes."""
from mythril.analysis.potential_issues import (
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import DEPRECATED_FUNCTIONS_USAGE
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.laser.ethereum.state.global_state import GlobalState
@ -34,8 +32,7 @@ class DeprecatedOperations(DetectionModule):
return
issues = self._analyze_state(state)
annotation = get_potential_issues_annotation(state)
annotation.potential_issues.extend(issues)
self.issues.extend(issues)
def _analyze_state(self, state):
"""
@ -71,20 +68,18 @@ class DeprecatedOperations(DetectionModule):
else:
return []
potential_issue = PotentialIssue(
issue = Issue(
contract=state.environment.active_account.contract_name,
function_name=state.environment.active_function_name,
address=instruction["address"],
title=title,
bytecode=state.environment.code.bytecode,
detector=self,
swc_id=swc_id,
severity="Medium",
description_head=description_head,
description_tail=description_tail,
constraints=[],
)
return [potential_issue]
return [issue]
detector = DeprecatedOperations()

@ -83,6 +83,11 @@ def execute_message_call(laser_evm, callee_address: BitVec) -> None:
continue
next_transaction_id = get_next_transaction_id()
external_sender = symbol_factory.BitVecSym(
"sender_{}".format(next_transaction_id), 256
)
transaction = MessageCallTransaction(
world_state=open_world_state,
identifier=next_transaction_id,
@ -90,12 +95,8 @@ def execute_message_call(laser_evm, callee_address: BitVec) -> None:
"gas_price{}".format(next_transaction_id), 256
),
gas_limit=8000000, # block gas limit
origin=symbol_factory.BitVecSym(
"origin{}".format(next_transaction_id), 256
),
caller=symbol_factory.BitVecSym(
"sender_{}".format(next_transaction_id), 256
),
origin=external_sender,
caller=external_sender,
callee_account=open_world_state[callee_address],
call_data=SymbolicCalldata(next_transaction_id),
call_value=symbol_factory.BitVecSym(

Loading…
Cancel
Save