mirror of https://github.com/crytic/slither
commit
89dee16b06
File diff suppressed because one or more lines are too long
@ -0,0 +1,22 @@ |
||||
interface Receiver{ |
||||
function send_funds() payable external; |
||||
} |
||||
|
||||
contract TestWithBug{ |
||||
mapping(address => uint) balances; |
||||
|
||||
function withdraw(uint amount) public{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
// slither-disable-start all |
||||
function withdrawFiltered(uint amount) public{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
// slither-disable-end all |
||||
} |
||||
|
@ -0,0 +1,231 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 133, |
||||
"length": 194, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBug", |
||||
"source_mapping": { |
||||
"start": 67, |
||||
"length": 534, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "Receiver(msg.sender).send_funds{value: amount}()", |
||||
"source_mapping": { |
||||
"start": 231, |
||||
"length": 48, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
10 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 58 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 133, |
||||
"length": 194, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBug", |
||||
"source_mapping": { |
||||
"start": 67, |
||||
"length": 534, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "external_calls" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "balances[msg.sender] -= amount", |
||||
"source_mapping": { |
||||
"start": 290, |
||||
"length": 30, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
11 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 40 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 133, |
||||
"length": 194, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBug", |
||||
"source_mapping": { |
||||
"start": 67, |
||||
"length": 534, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "variables_written", |
||||
"variable_name": "balances" |
||||
} |
||||
} |
||||
], |
||||
"description": "Reentrancy in TestWithBug.withdraw(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#8-12):\n\tExternal calls:\n\t- Receiver(msg.sender).send_funds{value: amount}() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#10)\n\tState variables written after the call(s):\n\t- balances[msg.sender] -= amount (tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#11)\n\tTestWithBug.balances (tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#6) can be used in cross function reentrancies:\n\t- TestWithBug.withdraw(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#8-12)\n\t- TestWithBug.withdrawFiltered(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#15-19)\n", |
||||
"markdown": "Reentrancy in [TestWithBug.withdraw(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L8-L12):\n\tExternal calls:\n\t- [Receiver(msg.sender).send_funds{value: amount}()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L10)\n\tState variables written after the call(s):\n\t- [balances[msg.sender] -= amount](tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L11)\n\t[TestWithBug.balances](tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L6) can be used in cross function reentrancies:\n\t- [TestWithBug.withdraw(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L8-L12)\n\t- [TestWithBug.withdrawFiltered(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L15-L19)\n", |
||||
"first_markdown_element": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_filtered_comments.sol#L8-L12", |
||||
"id": "176d2b5b09c260c72fd638ff8b5db4709df3ff3eb253daa1cfde254c8299fb94", |
||||
"check": "reentrancy-eth", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,151 @@ |
||||
interface Receiver{ |
||||
function send_funds() payable external; |
||||
} |
||||
|
||||
contract TestWithBug{ |
||||
|
||||
mapping(address => uint) balances; |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function withdraw(uint amount) nonReentrant public{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
function withdraw_all() public{ |
||||
uint amount = balances[msg.sender]; |
||||
balances[msg.sender] = 0; |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
contract TestWithoutBug{ |
||||
|
||||
mapping(address => uint) balances; |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function withdraw(uint amount) nonReentrant public{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
function withdraw_all() nonReentrant public{ |
||||
uint amount = balances[msg.sender]; |
||||
balances[msg.sender] = 0; |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
} |
||||
|
||||
} |
||||
|
||||
contract TestWithBugInternal{ |
||||
|
||||
mapping(address => uint) balances; |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function withdraw(uint amount) nonReentrant public{ |
||||
withdraw_internal(amount); |
||||
} |
||||
|
||||
function withdraw_internal(uint amount) internal{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
function withdraw_all() public{ |
||||
withdraw_all_internal(); |
||||
} |
||||
|
||||
function withdraw_all_internal() internal { |
||||
uint amount = balances[msg.sender]; |
||||
balances[msg.sender] = 0; |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
} |
||||
|
||||
} |
||||
|
||||
contract TestWithoutBugInternal{ |
||||
|
||||
mapping(address => uint) balances; |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function withdraw(uint amount) nonReentrant public{ |
||||
withdraw_internal(amount); |
||||
} |
||||
|
||||
function withdraw_internal(uint amount) internal{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
function withdraw_all() nonReentrant public{ |
||||
withdraw_all_internal(); |
||||
} |
||||
|
||||
function withdraw_all_internal() internal { |
||||
uint amount = balances[msg.sender]; |
||||
balances[msg.sender] = 0; |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
} |
||||
|
||||
} |
||||
|
||||
contract TestBugWithPublicVariable{ |
||||
|
||||
mapping(address => uint) public balances; |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function withdraw(uint amount) nonReentrant public{ |
||||
withdraw_internal(amount); |
||||
} |
||||
|
||||
function withdraw_internal(uint amount) internal{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
} |
||||
|
||||
contract TestWithBugNonReentrantRead{ |
||||
|
||||
mapping(address => uint) balances; |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function withdraw(uint amount) nonReentrant public{ |
||||
require(amount <= balances[msg.sender]); |
||||
Receiver(msg.sender).send_funds{value: amount}(); |
||||
balances[msg.sender] -= amount; |
||||
} |
||||
|
||||
// Simulate a reentrancy that allows to read variable in a potential incorrect state during a reentrancy |
||||
// This is more likely to impact protocol like reentrancy |
||||
function read() public returns(uint){ |
||||
uint amount = balances[msg.sender]; |
||||
return amount; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,981 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 3089, |
||||
"length": 207, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBugNonReentrantRead", |
||||
"source_mapping": { |
||||
"start": 2959, |
||||
"length": 629, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "Receiver(msg.sender).send_funds{value: amount}()", |
||||
"source_mapping": { |
||||
"start": 3200, |
||||
"length": 48, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
140 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 58 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 3089, |
||||
"length": 207, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBugNonReentrantRead", |
||||
"source_mapping": { |
||||
"start": 2959, |
||||
"length": 629, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "external_calls" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "balances[msg.sender] -= amount", |
||||
"source_mapping": { |
||||
"start": 3259, |
||||
"length": 30, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
141 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 40 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 3089, |
||||
"length": 207, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBugNonReentrantRead", |
||||
"source_mapping": { |
||||
"start": 2959, |
||||
"length": 629, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "variables_written", |
||||
"variable_name": "balances" |
||||
} |
||||
} |
||||
], |
||||
"description": "Reentrancy in TestWithBugNonReentrantRead.withdraw(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#138-142):\n\tExternal calls:\n\t- Receiver(msg.sender).send_funds{value: amount}() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#140)\n\tState variables written after the call(s):\n\t- balances[msg.sender] -= amount (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#141)\n\tTestWithBugNonReentrantRead.balances (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#132) can be used in cross function reentrancies:\n\t- TestWithBugNonReentrantRead.read() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#146-149)\n", |
||||
"markdown": "Reentrancy in [TestWithBugNonReentrantRead.withdraw(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L138-L142):\n\tExternal calls:\n\t- [Receiver(msg.sender).send_funds{value: amount}()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L140)\n\tState variables written after the call(s):\n\t- [balances[msg.sender] -= amount](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L141)\n\t[TestWithBugNonReentrantRead.balances](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L132) can be used in cross function reentrancies:\n\t- [TestWithBugNonReentrantRead.read()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L146-L149)\n", |
||||
"first_markdown_element": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L138-L142", |
||||
"id": "0b2149d8ea8554c24092bad5ce3061d661d4f0447d5d96716893538474bca40f", |
||||
"check": "reentrancy-eth", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
}, |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "withdraw_internal", |
||||
"source_mapping": { |
||||
"start": 1320, |
||||
"length": 205, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBugInternal", |
||||
"source_mapping": { |
||||
"start": 1100, |
||||
"length": 698, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw_internal(uint256)" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "Receiver(msg.sender).send_funds{value: amount}()", |
||||
"source_mapping": { |
||||
"start": 1429, |
||||
"length": 48, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
64 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 58 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw_internal", |
||||
"source_mapping": { |
||||
"start": 1320, |
||||
"length": 205, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBugInternal", |
||||
"source_mapping": { |
||||
"start": 1100, |
||||
"length": 698, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw_internal(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "external_calls" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "balances[msg.sender] -= amount", |
||||
"source_mapping": { |
||||
"start": 1488, |
||||
"length": 30, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
65 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 40 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw_internal", |
||||
"source_mapping": { |
||||
"start": 1320, |
||||
"length": 205, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBugInternal", |
||||
"source_mapping": { |
||||
"start": 1100, |
||||
"length": 698, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw_internal(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "variables_written", |
||||
"variable_name": "balances" |
||||
} |
||||
} |
||||
], |
||||
"description": "Reentrancy in TestWithBugInternal.withdraw_internal(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#62-66):\n\tExternal calls:\n\t- Receiver(msg.sender).send_funds{value: amount}() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#64)\n\tState variables written after the call(s):\n\t- balances[msg.sender] -= amount (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#65)\n\tTestWithBugInternal.balances (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#52) can be used in cross function reentrancies:\n\t- TestWithBugInternal.withdraw_all_internal() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#72-76)\n", |
||||
"markdown": "Reentrancy in [TestWithBugInternal.withdraw_internal(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L62-L66):\n\tExternal calls:\n\t- [Receiver(msg.sender).send_funds{value: amount}()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L64)\n\tState variables written after the call(s):\n\t- [balances[msg.sender] -= amount](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L65)\n\t[TestWithBugInternal.balances](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L52) can be used in cross function reentrancies:\n\t- [TestWithBugInternal.withdraw_all_internal()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L72-L76)\n", |
||||
"first_markdown_element": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L62-L66", |
||||
"id": "7d618f027540d61d9af79a3a9475677476d1c4d7ad1be68ff8026f6c0d4cdc82", |
||||
"check": "reentrancy-eth", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
}, |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "withdraw_internal", |
||||
"source_mapping": { |
||||
"start": 2749, |
||||
"length": 205, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestBugWithPublicVariable", |
||||
"source_mapping": { |
||||
"start": 2516, |
||||
"length": 441, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw_internal(uint256)" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "Receiver(msg.sender).send_funds{value: amount}()", |
||||
"source_mapping": { |
||||
"start": 2858, |
||||
"length": 48, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
124 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 58 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw_internal", |
||||
"source_mapping": { |
||||
"start": 2749, |
||||
"length": 205, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestBugWithPublicVariable", |
||||
"source_mapping": { |
||||
"start": 2516, |
||||
"length": 441, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw_internal(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "external_calls" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "balances[msg.sender] -= amount", |
||||
"source_mapping": { |
||||
"start": 2917, |
||||
"length": 30, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
125 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 40 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw_internal", |
||||
"source_mapping": { |
||||
"start": 2749, |
||||
"length": 205, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestBugWithPublicVariable", |
||||
"source_mapping": { |
||||
"start": 2516, |
||||
"length": 441, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw_internal(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "variables_written", |
||||
"variable_name": "balances" |
||||
} |
||||
} |
||||
], |
||||
"description": "Reentrancy in TestBugWithPublicVariable.withdraw_internal(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#122-126):\n\tExternal calls:\n\t- Receiver(msg.sender).send_funds{value: amount}() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#124)\n\tState variables written after the call(s):\n\t- balances[msg.sender] -= amount (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#125)\n\tTestBugWithPublicVariable.balances (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#112) can be used in cross function reentrancies:\n\t- TestBugWithPublicVariable.balances (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#112)\n", |
||||
"markdown": "Reentrancy in [TestBugWithPublicVariable.withdraw_internal(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L122-L126):\n\tExternal calls:\n\t- [Receiver(msg.sender).send_funds{value: amount}()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L124)\n\tState variables written after the call(s):\n\t- [balances[msg.sender] -= amount](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L125)\n\t[TestBugWithPublicVariable.balances](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L112) can be used in cross function reentrancies:\n\t- [TestBugWithPublicVariable.balances](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L112)\n", |
||||
"first_markdown_element": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L122-L126", |
||||
"id": "a3e52c882aa9fb88119aa3507f4158436bfe3f1abee0828665afa41213587097", |
||||
"check": "reentrancy-eth", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
}, |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 181, |
||||
"length": 207, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBug", |
||||
"source_mapping": { |
||||
"start": 67, |
||||
"length": 506, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "Receiver(msg.sender).send_funds{value: amount}()", |
||||
"source_mapping": { |
||||
"start": 292, |
||||
"length": 48, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
15 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 58 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 181, |
||||
"length": 207, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBug", |
||||
"source_mapping": { |
||||
"start": 67, |
||||
"length": 506, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "external_calls" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "balances[msg.sender] -= amount", |
||||
"source_mapping": { |
||||
"start": 351, |
||||
"length": 30, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
16 |
||||
], |
||||
"starting_column": 10, |
||||
"ending_column": 40 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "withdraw", |
||||
"source_mapping": { |
||||
"start": 181, |
||||
"length": 207, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "TestWithBug", |
||||
"source_mapping": { |
||||
"start": 67, |
||||
"length": 506, |
||||
"filename_relative": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "withdraw(uint256)" |
||||
} |
||||
} |
||||
}, |
||||
"additional_fields": { |
||||
"underlying_type": "variables_written", |
||||
"variable_name": "balances" |
||||
} |
||||
} |
||||
], |
||||
"description": "Reentrancy in TestWithBug.withdraw(uint256) (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#13-17):\n\tExternal calls:\n\t- Receiver(msg.sender).send_funds{value: amount}() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#15)\n\tState variables written after the call(s):\n\t- balances[msg.sender] -= amount (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#16)\n\tTestWithBug.balances (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#7) can be used in cross function reentrancies:\n\t- TestWithBug.withdraw_all() (tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#19-23)\n", |
||||
"markdown": "Reentrancy in [TestWithBug.withdraw(uint256)](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L13-L17):\n\tExternal calls:\n\t- [Receiver(msg.sender).send_funds{value: amount}()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L15)\n\tState variables written after the call(s):\n\t- [balances[msg.sender] -= amount](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L16)\n\t[TestWithBug.balances](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L7) can be used in cross function reentrancies:\n\t- [TestWithBug.withdraw_all()](tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L19-L23)\n", |
||||
"first_markdown_element": "tests/detectors/reentrancy-eth/0.8.10/reentrancy_with_non_reentrant.sol#L13-L17", |
||||
"id": "bcfa65e776908d618f202fa48f03dde3fbf8397b752d2e8cc3c8e46019e9e174", |
||||
"check": "reentrancy-eth", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
} |
||||
] |
||||
] |
File diff suppressed because one or more lines are too long
@ -1,506 +1,3 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "contract", |
||||
"name": "A", |
||||
"source_mapping": { |
||||
"start": 25, |
||||
"length": 2256, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
{ |
||||
"type": "function", |
||||
"name": "bad1", |
||||
"source_mapping": { |
||||
"start": 601, |
||||
"length": 170, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
15, |
||||
16, |
||||
17 |
||||
], |
||||
"starting_column": 3, |
||||
"ending_column": 4 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "A", |
||||
"source_mapping": { |
||||
"start": 25, |
||||
"length": 2256, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "bad1(int128[3])" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "intArray = userArray", |
||||
"source_mapping": { |
||||
"start": 746, |
||||
"length": 20, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
16 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 25 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "bad1", |
||||
"source_mapping": { |
||||
"start": 601, |
||||
"length": 170, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
15, |
||||
16, |
||||
17 |
||||
], |
||||
"starting_column": 3, |
||||
"ending_column": 4 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "A", |
||||
"source_mapping": { |
||||
"start": 25, |
||||
"length": 2256, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "bad1(int128[3])" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "Contract A (tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#3-45) \n\t- Function A.bad1(int128[3]) (tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#15-17)\n\t\t- intArray = userArray (tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#16) has a storage signed integer array assignment\n", |
||||
"markdown": "Contract [A](tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L3-L45) \n\t- Function [A.bad1(int128[3])](tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L15-L17)\n\t\t- [intArray = userArray](tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L16) has a storage signed integer array assignment\n", |
||||
"first_markdown_element": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L3-L45", |
||||
"id": "7ba5efbfb61ba63a7ac01d376a0cede2fda18c2a2d8604c4a82cccec92ae2bdb", |
||||
"check": "storage-array", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
}, |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "contract", |
||||
"name": "A", |
||||
"source_mapping": { |
||||
"start": 25, |
||||
"length": 2256, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
{ |
||||
"type": "function", |
||||
"name": "bad0", |
||||
"source_mapping": { |
||||
"start": 355, |
||||
"length": 132, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
10, |
||||
11, |
||||
12 |
||||
], |
||||
"starting_column": 3, |
||||
"ending_column": 4 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "A", |
||||
"source_mapping": { |
||||
"start": 25, |
||||
"length": 2256, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "bad0()" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "node", |
||||
"name": "intArray = (- 1,- 2,- 3)", |
||||
"source_mapping": { |
||||
"start": 384, |
||||
"length": 23, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
11 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 28 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "function", |
||||
"name": "bad0", |
||||
"source_mapping": { |
||||
"start": 355, |
||||
"length": 132, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
10, |
||||
11, |
||||
12 |
||||
], |
||||
"starting_column": 3, |
||||
"ending_column": 4 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "A", |
||||
"source_mapping": { |
||||
"start": 25, |
||||
"length": 2256, |
||||
"filename_relative": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
3, |
||||
4, |
||||
5, |
||||
6, |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "bad0()" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "Contract A (tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#3-45) \n\t- Function A.bad0() (tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#10-12)\n\t\t- intArray = (- 1,- 2,- 3) (tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#11) has a storage signed integer array assignment\n", |
||||
"markdown": "Contract [A](tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L3-L45) \n\t- Function [A.bad0()](tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L10-L12)\n\t\t- [intArray = (- 1,- 2,- 3)](tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L11) has a storage signed integer array assignment\n", |
||||
"first_markdown_element": "tests/detectors/storage-array/0.5.10/storage_signed_integer_array.sol#L3-L45", |
||||
"id": "da870be9a396bc52d2f6f8caeb00e6b8809ad1b6fb4c24a019568257b3404a2f", |
||||
"check": "storage-array", |
||||
"impact": "High", |
||||
"confidence": "Medium" |
||||
} |
||||
] |
||||
[] |
||||
] |
@ -0,0 +1,36 @@ |
||||
contract TestReentrant{ |
||||
|
||||
modifier nonReentrant(){ |
||||
_; |
||||
} |
||||
|
||||
function is_reentrant() public{ |
||||
internal_and_could_be_reentrant(); |
||||
internal_and_reentrant(); |
||||
} |
||||
|
||||
function is_non_reentrant() nonReentrant() public{ |
||||
internal_and_could_be_reentrant(); |
||||
internal_and_not_reentrant2(); |
||||
} |
||||
|
||||
function internal_and_not_reentrant() nonReentrant() internal{ |
||||
|
||||
} |
||||
|
||||
function internal_and_not_reentrant2() internal{ |
||||
|
||||
} |
||||
|
||||
// Called by a protected and unprotected function |
||||
function internal_and_could_be_reentrant() internal{ |
||||
|
||||
} |
||||
|
||||
// Called by a protected and unprotected function |
||||
function internal_and_reentrant() internal{ |
||||
|
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue