From 128b0cf5c11482fda10ff8c18df11aa76128d182 Mon Sep 17 00:00:00 2001 From: Natalie Chin Date: Fri, 18 Dec 2020 14:53:24 -0500 Subject: [PATCH] Added tests for benign reentrancy --- .../reentrancy-benign/reentrancy-benign.sol | 61 + ...cy-benign.sol.0.4.26.ReentrancyBenign.json | 4580 +++++++++++++++++ tests/test_detectors.py | 5 + 3 files changed, 4646 insertions(+) create mode 100644 tests/detectors/reentrancy-benign/reentrancy-benign.sol create mode 100644 tests/detectors/reentrancy-benign/reentrancy-benign.sol.0.4.26.ReentrancyBenign.json diff --git a/tests/detectors/reentrancy-benign/reentrancy-benign.sol b/tests/detectors/reentrancy-benign/reentrancy-benign.sol new file mode 100644 index 000000000..8b37f9852 --- /dev/null +++ b/tests/detectors/reentrancy-benign/reentrancy-benign.sol @@ -0,0 +1,61 @@ +pragma solidity ^0.4.0; + +contract ReentrancyBenign { + uint8 anotherVariableToChange; + uint8 counter = 0; + + function bad0() public { + if (!(msg.sender.call())) { + revert(); + } + counter += 1; + } + + function bad1(address target) public { + (bool success) = target.call(); + require(success); + counter += 1; + } + + function bad2(address target) public { + (bool success) = target.call(); + if (success) { + address(target).call.value(1000)(); + counter += 1; + } + else { + revert(); + } + } + + function bad3(address target) public { + externalCaller(target); + varChanger(); + ethSender(target); + } + + function bad4(address target) public { + externalCaller(target); + ethSender(address(0)); + varChanger(); + address(target).call.value(2)(); + } + + function bad5(address target) public { + ethSender(address(0)); + varChanger(); + ethSender(address(0)); + } + + function externalCaller(address target) private { + address(target).call(); + } + + function ethSender(address target) private { + address(target).call.value(1)(); + } + + function varChanger() private { + anotherVariableToChange++; + } +} \ No newline at end of file diff --git a/tests/detectors/reentrancy-benign/reentrancy-benign.sol.0.4.26.ReentrancyBenign.json b/tests/detectors/reentrancy-benign/reentrancy-benign.sol.0.4.26.ReentrancyBenign.json new file mode 100644 index 000000000..46c1bb4f3 --- /dev/null +++ b/tests/detectors/reentrancy-benign/reentrancy-benign.sol.0.4.26.ReentrancyBenign.json @@ -0,0 +1,4580 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad0", + "source_mapping": { + "start": 116, + "length": 120, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad0()" + } + }, + { + "type": "node", + "name": "! (msg.sender.call())", + "source_mapping": { + "start": 153, + "length": 20, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 8 + ], + "starting_column": 13, + "ending_column": 33 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad0", + "source_mapping": { + "start": 116, + "length": 120, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad0()" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "! (msg.sender.call())", + "source_mapping": { + "start": 153, + "length": 20, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 8 + ], + "starting_column": 13, + "ending_column": 33 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad0", + "source_mapping": { + "start": 116, + "length": 120, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad0()" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "counter += 1", + "source_mapping": { + "start": 217, + "length": 12, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 11 + ], + "starting_column": 9, + "ending_column": 21 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad0", + "source_mapping": { + "start": 116, + "length": 120, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad0()" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "counter" + } + } + ], + "description": "Reentrancy in ReentrancyBenign.bad0() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#7-12):\n\tExternal calls:\n\t- ! (msg.sender.call()) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#8)\n\tState variables written after the call(s):\n\t- counter += 1 (tests/detectors/reentrancy-benign/reentrancy-benign.sol#11)\n", + "markdown": "Reentrancy in [ReentrancyBenign.bad0()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L7-L12):\n\tExternal calls:\n\t- [! (msg.sender.call())](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L8)\n\tState variables written after the call(s):\n\t- [counter += 1](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L11)\n", + "id": "23f4fbdccaa9fd4c46c12759d22b8f19d92b6652303c84f8a9e59012a83cbf9c", + "check": "reentrancy-benign", + "impact": "Low", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 242, + "length": 132, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 14, + 15, + 16, + 17, + 18 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(address)" + } + }, + { + "type": "node", + "name": "success = target.call()", + "source_mapping": { + "start": 289, + "length": 30, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 15 + ], + "starting_column": 9, + "ending_column": 39 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 242, + "length": 132, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 14, + 15, + 16, + 17, + 18 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "success = target.call()", + "source_mapping": { + "start": 289, + "length": 30, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 15 + ], + "starting_column": 9, + "ending_column": 39 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 242, + "length": 132, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 14, + 15, + 16, + 17, + 18 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "counter += 1", + "source_mapping": { + "start": 355, + "length": 12, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 17 + ], + "starting_column": 9, + "ending_column": 21 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 242, + "length": 132, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 14, + 15, + 16, + 17, + 18 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(address)" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "counter" + } + } + ], + "description": "Reentrancy in ReentrancyBenign.bad1(address) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#14-18):\n\tExternal calls:\n\t- success = target.call() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#15)\n\tState variables written after the call(s):\n\t- counter += 1 (tests/detectors/reentrancy-benign/reentrancy-benign.sol#17)\n", + "markdown": "Reentrancy in [ReentrancyBenign.bad1(address)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L14-L18):\n\tExternal calls:\n\t- [success = target.call()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L15)\n\tState variables written after the call(s):\n\t- [counter += 1](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L17)\n", + "id": "404eb3881e9d5765548d023eeacff9a2147786601b5d7eaa204c3838b7d665d9", + "check": "reentrancy-benign", + "impact": "Low", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 380, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad2(address)" + } + }, + { + "type": "node", + "name": "success = target.call()", + "source_mapping": { + "start": 427, + "length": 30, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 21 + ], + "starting_column": 9, + "ending_column": 39 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 380, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad2(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "address(target).call.value(1000)()", + "source_mapping": { + "start": 494, + "length": 34, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 23 + ], + "starting_column": 13, + "ending_column": 47 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 380, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad2(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "success = target.call()", + "source_mapping": { + "start": 427, + "length": 30, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 21 + ], + "starting_column": 9, + "ending_column": 39 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 380, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad2(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "address(target).call.value(1000)()", + "source_mapping": { + "start": 494, + "length": 34, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 23 + ], + "starting_column": 13, + "ending_column": 47 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 380, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad2(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "counter += 1", + "source_mapping": { + "start": 542, + "length": 12, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 24 + ], + "starting_column": 13, + "ending_column": 25 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 380, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad2(address)" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "counter" + } + } + ], + "description": "Reentrancy in ReentrancyBenign.bad2(address) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#20-29):\n\tExternal calls:\n\t- success = target.call() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#21)\n\t- address(target).call.value(1000)() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#23)\n\tExternal calls sending eth:\n\t- address(target).call.value(1000)() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#23)\n\tState variables written after the call(s):\n\t- counter += 1 (tests/detectors/reentrancy-benign/reentrancy-benign.sol#24)\n", + "markdown": "Reentrancy in [ReentrancyBenign.bad2(address)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L20-L29):\n\tExternal calls:\n\t- [success = target.call()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L21)\n\t- [address(target).call.value(1000)()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L23)\n\tExternal calls sending eth:\n\t- [address(target).call.value(1000)()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L23)\n\tState variables written after the call(s):\n\t- [counter += 1](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L24)\n", + "id": "cf749257747679a6caaf9ae293360de238a17a22a13320f189e438e4e226276f", + "check": "reentrancy-benign", + "impact": "Low", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 624, + "length": 125, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 31, + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad3(address)" + } + }, + { + "type": "node", + "name": "externalCaller(target)", + "source_mapping": { + "start": 671, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 32 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 624, + "length": 125, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 31, + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad3(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "address(target).call()", + "source_mapping": { + "start": 1123, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 51 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "externalCaller", + "source_mapping": { + "start": 1065, + "length": 87, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 50, + 51, + 52 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "externalCaller(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "externalCaller(target)", + "source_mapping": { + "start": 671, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 32 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 624, + "length": 125, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 31, + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad3(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "address(target).call()", + "source_mapping": { + "start": 1123, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 51 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "externalCaller", + "source_mapping": { + "start": 1065, + "length": 87, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 50, + 51, + 52 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "externalCaller(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "varChanger()", + "source_mapping": { + "start": 703, + "length": 12, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 33 + ], + "starting_column": 9, + "ending_column": 21 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 624, + "length": 125, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 31, + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad3(address)" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "anotherVariableToChange" + } + }, + { + "type": "node", + "name": "anotherVariableToChange ++", + "source_mapping": { + "start": 1295, + "length": 25, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 59 + ], + "starting_column": 9, + "ending_column": 34 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "varChanger", + "source_mapping": { + "start": 1255, + "length": 72, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 58, + 59, + 60 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "varChanger()" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "anotherVariableToChange" + } + } + ], + "description": "Reentrancy in ReentrancyBenign.bad3(address) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#31-35):\n\tExternal calls:\n\t- externalCaller(target) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#32)\n\t\t- address(target).call() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#51)\n\tState variables written after the call(s):\n\t- varChanger() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#33)\n\t\t- anotherVariableToChange ++ (tests/detectors/reentrancy-benign/reentrancy-benign.sol#59)\n", + "markdown": "Reentrancy in [ReentrancyBenign.bad3(address)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L31-L35):\n\tExternal calls:\n\t- [externalCaller(target)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L32)\n\t\t- [address(target).call()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L51)\n\tState variables written after the call(s):\n\t- [varChanger()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L33)\n\t\t- [anotherVariableToChange ++](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L59)\n", + "id": "5419993a97881c5ada3458672ea5955e9eefae288ac2d4fd84854499ff1569b5", + "check": "reentrancy-benign", + "impact": "Low", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 755, + "length": 170, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 37, + 38, + 39, + 40, + 41, + 42 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad4(address)" + } + }, + { + "type": "node", + "name": "externalCaller(target)", + "source_mapping": { + "start": 802, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 38 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 755, + "length": 170, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 37, + 38, + 39, + 40, + 41, + 42 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad4(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "address(target).call()", + "source_mapping": { + "start": 1123, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 51 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "externalCaller", + "source_mapping": { + "start": 1065, + "length": 87, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 50, + 51, + 52 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "externalCaller(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "ethSender(address(0))", + "source_mapping": { + "start": 834, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 39 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 755, + "length": 170, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 37, + 38, + 39, + 40, + 41, + 42 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad4(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "address(target).call.value(1)()", + "source_mapping": { + "start": 1211, + "length": 31, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 55 + ], + "starting_column": 9, + "ending_column": 40 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "ethSender", + "source_mapping": { + "start": 1158, + "length": 91, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 54, + 55, + 56 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "ethSender(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "externalCaller(target)", + "source_mapping": { + "start": 802, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 38 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 755, + "length": 170, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 37, + 38, + 39, + 40, + 41, + 42 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad4(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "address(target).call()", + "source_mapping": { + "start": 1123, + "length": 22, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 51 + ], + "starting_column": 9, + "ending_column": 31 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "externalCaller", + "source_mapping": { + "start": 1065, + "length": 87, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 50, + 51, + 52 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "externalCaller(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "ethSender(address(0))", + "source_mapping": { + "start": 834, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 39 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 755, + "length": 170, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 37, + 38, + 39, + 40, + 41, + 42 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad4(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "address(target).call.value(1)()", + "source_mapping": { + "start": 1211, + "length": 31, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 55 + ], + "starting_column": 9, + "ending_column": 40 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "ethSender", + "source_mapping": { + "start": 1158, + "length": 91, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 54, + 55, + 56 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "ethSender(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "varChanger()", + "source_mapping": { + "start": 865, + "length": 12, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 40 + ], + "starting_column": 9, + "ending_column": 21 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 755, + "length": 170, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 37, + 38, + 39, + 40, + 41, + 42 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad4(address)" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "anotherVariableToChange" + } + }, + { + "type": "node", + "name": "anotherVariableToChange ++", + "source_mapping": { + "start": 1295, + "length": 25, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 59 + ], + "starting_column": 9, + "ending_column": 34 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "varChanger", + "source_mapping": { + "start": 1255, + "length": 72, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 58, + 59, + 60 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "varChanger()" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "anotherVariableToChange" + } + } + ], + "description": "Reentrancy in ReentrancyBenign.bad4(address) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#37-42):\n\tExternal calls:\n\t- externalCaller(target) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#38)\n\t\t- address(target).call() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#51)\n\t- ethSender(address(0)) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#39)\n\t\t- address(target).call.value(1)() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#55)\n\tExternal calls sending eth:\n\t- ethSender(address(0)) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#39)\n\t\t- address(target).call.value(1)() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#55)\n\tState variables written after the call(s):\n\t- varChanger() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#40)\n\t\t- anotherVariableToChange ++ (tests/detectors/reentrancy-benign/reentrancy-benign.sol#59)\n", + "markdown": "Reentrancy in [ReentrancyBenign.bad4(address)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L37-L42):\n\tExternal calls:\n\t- [externalCaller(target)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L38)\n\t\t- [address(target).call()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L51)\n\t- [ethSender(address(0))](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L39)\n\t\t- [address(target).call.value(1)()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L55)\n\tExternal calls sending eth:\n\t- [ethSender(address(0))](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L39)\n\t\t- [address(target).call.value(1)()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L55)\n\tState variables written after the call(s):\n\t- [varChanger()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L40)\n\t\t- [anotherVariableToChange ++](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L59)\n", + "id": "fa81e2a2e03ed4653b8e905384a02bfa7fedc6f9dbbcfed919c9c7e7d39958eb", + "check": "reentrancy-benign", + "impact": "Low", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad5", + "source_mapping": { + "start": 931, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad5(address)" + } + }, + { + "type": "node", + "name": "ethSender(address(0))", + "source_mapping": { + "start": 978, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 45 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad5", + "source_mapping": { + "start": 931, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad5(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls" + } + }, + { + "type": "node", + "name": "address(target).call.value(1)()", + "source_mapping": { + "start": 1211, + "length": 31, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 55 + ], + "starting_column": 9, + "ending_column": 40 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "ethSender", + "source_mapping": { + "start": 1158, + "length": 91, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 54, + 55, + 56 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "ethSender(address)" + } + } + }, + "additional_fields": { + "underlying_type": "external_calls_sending_eth" + } + }, + { + "type": "node", + "name": "varChanger()", + "source_mapping": { + "start": 1009, + "length": 12, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 46 + ], + "starting_column": 9, + "ending_column": 21 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad5", + "source_mapping": { + "start": 931, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad5(address)" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "anotherVariableToChange" + } + }, + { + "type": "node", + "name": "anotherVariableToChange ++", + "source_mapping": { + "start": 1295, + "length": 25, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 59 + ], + "starting_column": 9, + "ending_column": 34 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "varChanger", + "source_mapping": { + "start": 1255, + "length": 72, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "is_dependency": false, + "lines": [ + 58, + 59, + 60 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "ReentrancyBenign", + "source_mapping": { + "start": 25, + "length": 1304, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/reentrancy-benign/reentrancy-benign.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, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "varChanger()" + } + } + }, + "additional_fields": { + "underlying_type": "variables_written", + "variable_name": "anotherVariableToChange" + } + } + ], + "description": "Reentrancy in ReentrancyBenign.bad5(address) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#44-48):\n\tExternal calls:\n\t- ethSender(address(0)) (tests/detectors/reentrancy-benign/reentrancy-benign.sol#45)\n\t\t- address(target).call.value(1)() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#55)\n\tState variables written after the call(s):\n\t- varChanger() (tests/detectors/reentrancy-benign/reentrancy-benign.sol#46)\n\t\t- anotherVariableToChange ++ (tests/detectors/reentrancy-benign/reentrancy-benign.sol#59)\n", + "markdown": "Reentrancy in [ReentrancyBenign.bad5(address)](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L44-L48):\n\tExternal calls:\n\t- [ethSender(address(0))](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L45)\n\t\t- [address(target).call.value(1)()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L55)\n\tState variables written after the call(s):\n\t- [varChanger()](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L46)\n\t\t- [anotherVariableToChange ++](tests/detectors/reentrancy-benign/reentrancy-benign.sol#L59)\n", + "id": "ef84aa3ab4543f3983d06b6aa80c190924de70eb4e679a9a4330efa67f406ae6", + "check": "reentrancy-benign", + "impact": "Low", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/test_detectors.py b/tests/test_detectors.py index 24c82b9a7..b3bb4a50e 100644 --- a/tests/test_detectors.py +++ b/tests/test_detectors.py @@ -53,6 +53,11 @@ def id_test(test_item: Test): ALL_TESTS = [ + Test( + all_detectors.ReentrancyBenign, + "tests/detectors/reentrancy-benign/reentrancy-benign.sol", + "0.4.26", + ), Test( all_detectors.ReentrancyReadBeforeWritten, "tests/detectors/reentrancy-before-write/reentrancy-write.sol",