pr/894
Bernhard Mueller 6 years ago
parent 43c774cdf0
commit ef98d051c2
  1. 11
      mythril/analysis/modules/suicide.py
  2. 20
      tests/testdata/outputs_expected/suicide.sol.o.json
  3. 28
      tests/testdata/outputs_expected/suicide.sol.o.jsonv2
  4. 2
      tests/testdata/outputs_expected/suicide.sol.o.markdown
  5. 2
      tests/testdata/outputs_expected/suicide.sol.o.text

@ -65,16 +65,15 @@ class SuicideModule(DetectionModule):
node.constraints node.constraints
+ [to == 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF], + [to == 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF],
) )
description_tail = "Anyone can kill this contract and withdraw its balance to an arbitrary " description_tail = (
"account." "Anyone can kill this contract and withdraw its balance to an arbitrary "
"address."
)
except UnsatError: except UnsatError:
transaction_sequence = solver.get_transaction_sequence( transaction_sequence = solver.get_transaction_sequence(
state, node.constraints state, node.constraints
) )
description_tail = ( description_tail = "Arbitrary senders can kill this contract."
"Arbitrary senders can kill this contract."
)
debug = json.dumps(transaction_sequence, indent=4) debug = json.dumps(transaction_sequence, indent=4)
self._cache_address[instruction["address"]] = True self._cache_address[instruction["address"]] = True

@ -1 +1,19 @@
{"error": null, "issues": [{"address": 146, "contract": "Unknown", "debug": "<DEBUG-DATA>", "description": "The contract can be killed by anyone.\nAnyone can kill this contract and withdraw its balance to an arbitrary ", "function": "kill(address)", "max_gas_used": 263, "min_gas_used": 168, "severity": "High", "sourceMap": null, "swc-id": "106", "title": "Unprotected Selfdestruct"}], "success": true} {
"error" : null,
"issues" : [
{
"title" : "Unprotected Selfdestruct",
"swc-id" : "106",
"severity" : "High",
"contract" : "Unknown",
"description" : "The contract can be killed by anyone.\nAnyone can kill this contract and withdraw its balance to an arbitrary address.",
"function" : "kill(address)",
"min_gas_used" : 168,
"max_gas_used" : 263,
"debug" : "<DEBUG-DATA>",
"sourceMap" : null,
"address" : 146
}
],
"success" : true
}

@ -1 +1,27 @@
[{"issues": [{"description": {"head": "The contract can be killed by anyone.", "tail": "Anyone can kill this contract and withdraw its balance to an arbitrary "}, "extra": {}, "locations": [{"sourceMap": "146:1:0"}], "severity": "High", "swcID": "SWC-106", "swcTitle": "Unprotected SELFDESTRUCT Instruction"}], "meta": {}, "sourceFormat": "evm-byzantium-bytecode", "sourceList": ["0x2fb801366b61a05b30550481a1c8f7d5f20de0b93d9f2f2ce2b28c4e322033c9"], "sourceType": "raw-bytecode"}] [
{
"issues" : [
{
"swcTitle" : "Unprotected SELFDESTRUCT Instruction",
"locations" : [
{
"sourceMap" : "146:1:0"
}
],
"extra" : {},
"description" : {
"tail" : "Anyone can kill this contract and withdraw its balance to an arbitrary address.",
"head" : "The contract can be killed by anyone."
},
"severity" : "High",
"swcID" : "SWC-106"
}
],
"sourceFormat" : "evm-byzantium-bytecode",
"meta" : {},
"sourceType" : "raw-bytecode",
"sourceList" : [
"0x2fb801366b61a05b30550481a1c8f7d5f20de0b93d9f2f2ce2b28c4e322033c9"
]
}
]

@ -11,4 +11,4 @@
### Description ### Description
The contract can be killed by anyone. The contract can be killed by anyone.
Anyone can kill this contract and withdraw its balance to an arbitrary Anyone can kill this contract and withdraw its balance to an arbitrary address.

@ -6,6 +6,6 @@ Function name: kill(address)
PC address: 146 PC address: 146
Estimated Gas Usage: 168 - 263 Estimated Gas Usage: 168 - 263
The contract can be killed by anyone. The contract can be killed by anyone.
Anyone can kill this contract and withdraw its balance to an arbitrary Anyone can kill this contract and withdraw its balance to an arbitrary address.
-------------------- --------------------

Loading…
Cancel
Save