|
|
@ -4,6 +4,7 @@ from mythril.analysis.swc_data import UNPROTECTED_SELFDESTRUCT |
|
|
|
from mythril.exceptions import UnsatError |
|
|
|
from mythril.exceptions import UnsatError |
|
|
|
from mythril.analysis.modules.base import DetectionModule |
|
|
|
from mythril.analysis.modules.base import DetectionModule |
|
|
|
from mythril.laser.ethereum.state.global_state import GlobalState |
|
|
|
from mythril.laser.ethereum.state.global_state import GlobalState |
|
|
|
|
|
|
|
from mythril.laser.ethereum.transaction.symbolic import ATTACKER_ADDRESS |
|
|
|
import logging |
|
|
|
import logging |
|
|
|
import json |
|
|
|
import json |
|
|
|
|
|
|
|
|
|
|
@ -57,13 +58,16 @@ class SuicideModule(DetectionModule): |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
description_head = "The contract can be killed by anyone." |
|
|
|
description_head = "The contract can be killed by anyone." |
|
|
|
|
|
|
|
caller = state.current_transaction.caller |
|
|
|
try: |
|
|
|
try: |
|
|
|
try: |
|
|
|
try: |
|
|
|
transaction_sequence = solver.get_transaction_sequence( |
|
|
|
transaction_sequence = solver.get_transaction_sequence( |
|
|
|
state, |
|
|
|
state, |
|
|
|
state.mstate.constraints |
|
|
|
state.mstate.constraints |
|
|
|
+ [to == 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF], |
|
|
|
+ [ |
|
|
|
|
|
|
|
to == 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF, |
|
|
|
|
|
|
|
caller == ATTACKER_ADDRESS, |
|
|
|
|
|
|
|
], |
|
|
|
) |
|
|
|
) |
|
|
|
description_tail = ( |
|
|
|
description_tail = ( |
|
|
|
"Anyone can kill this contract and withdraw its balance to an arbitrary " |
|
|
|
"Anyone can kill this contract and withdraw its balance to an arbitrary " |
|
|
@ -71,7 +75,7 @@ class SuicideModule(DetectionModule): |
|
|
|
) |
|
|
|
) |
|
|
|
except UnsatError: |
|
|
|
except UnsatError: |
|
|
|
transaction_sequence = solver.get_transaction_sequence( |
|
|
|
transaction_sequence = solver.get_transaction_sequence( |
|
|
|
state, state.mstate.constraints |
|
|
|
state, state.mstate.constraints + [caller == ATTACKER_ADDRESS] |
|
|
|
) |
|
|
|
) |
|
|
|
description_tail = "Arbitrary senders can kill this contract." |
|
|
|
description_tail = "Arbitrary senders can kill this contract." |
|
|
|
|
|
|
|
|
|
|
|