From 3a1c7cb065d91e47a3788a6d34ff842c78d05b55 Mon Sep 17 00:00:00 2001 From: Yordan Miladinov Date: Mon, 6 Mar 2023 05:16:58 +0200 Subject: [PATCH 1/4] incorrect-equality: do not check addresses --- .../statements/incorrect_strict_equality.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/slither/detectors/statements/incorrect_strict_equality.py b/slither/detectors/statements/incorrect_strict_equality.py index bc7b0cebe3..bd34d61b1a 100644 --- a/slither/detectors/statements/incorrect_strict_equality.py +++ b/slither/detectors/statements/incorrect_strict_equality.py @@ -72,6 +72,14 @@ class IncorrectStrictEquality(AbstractDetector): def is_direct_comparison(ir: Operation) -> bool: return isinstance(ir, Binary) and ir.type == BinaryType.EQUAL + @staticmethod + def is_not_comparing_addresses(ir: Binary) -> bool: + """ + Comparing addresses strictly should not be flagged. + """ + addr = ElementaryType("address") + return ir.variable_left.type != addr or ir.variable_right.type != addr + @staticmethod def is_any_tainted( variables: List[ @@ -145,7 +153,12 @@ def tainted_equality_nodes( for ir in node.irs_ssa: # Filter to only tainted equality (==) comparisons - if self.is_direct_comparison(ir) and self.is_any_tainted(ir.used, taints, func): + if ( + self.is_direct_comparison(ir) + and self.is_not_comparing_addresses(ir) + and self.is_any_tainted(ir.used, taints, func) + ): + # if func not in results: results[func] = [] results[func].append(node) From 2d65116392d6152e6c747012ddc51d9099975d71 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Thu, 4 May 2023 21:45:13 -0500 Subject: [PATCH 2/4] reduce false positives for incorrect-equality on struct fields --- slither/core/declarations/custom_error.py | 4 +-- .../statements/incorrect_strict_equality.py | 14 ++++++---- slither/utils/type.py | 14 ++++++++++ .../0.7.6/incorrect_equality.sol | 24 ++++++++++++++++++ .../0.7.6/incorrect_equality.sol-0.7.6.zip | Bin 8237 -> 10221 bytes 5 files changed, 49 insertions(+), 7 deletions(-) diff --git a/slither/core/declarations/custom_error.py b/slither/core/declarations/custom_error.py index 7e78748c60..8ed943d942 100644 --- a/slither/core/declarations/custom_error.py +++ b/slither/core/declarations/custom_error.py @@ -1,8 +1,8 @@ from typing import List, TYPE_CHECKING, Optional, Type -from slither.core.solidity_types import UserDefinedType from slither.core.source_mapping.source_mapping import SourceMapping from slither.core.variables.local_variable import LocalVariable +from slither.utils.type import is_underlying_type_address if TYPE_CHECKING: from slither.core.compilation_unit import SlitherCompilationUnit @@ -46,7 +46,7 @@ def _convert_type_for_solidity_signature(t: Optional[Type]) -> str: # pylint: disable=import-outside-toplevel from slither.core.declarations import Contract - if isinstance(t, UserDefinedType) and isinstance(t.type, Contract): + if is_underlying_type_address(t): return "address" return str(t) diff --git a/slither/detectors/statements/incorrect_strict_equality.py b/slither/detectors/statements/incorrect_strict_equality.py index bd34d61b1a..ae06d7bf3b 100644 --- a/slither/detectors/statements/incorrect_strict_equality.py +++ b/slither/detectors/statements/incorrect_strict_equality.py @@ -31,6 +31,7 @@ from slither.slithir.variables.local_variable import LocalIRVariable from slither.slithir.variables.temporary_ssa import TemporaryVariableSSA from slither.utils.output import Output +from slither.utils.type import is_underlying_type_address class IncorrectStrictEquality(AbstractDetector): @@ -77,8 +78,13 @@ def is_not_comparing_addresses(ir: Binary) -> bool: """ Comparing addresses strictly should not be flagged. """ - addr = ElementaryType("address") - return ir.variable_left.type != addr or ir.variable_right.type != addr + + if is_underlying_type_address(ir.variable_left.type) and is_underlying_type_address( + ir.variable_right.type + ): + return False + + return True @staticmethod def is_any_tainted( @@ -116,7 +122,6 @@ def taint_balance_equalities( ): taints.append(ir.lvalue) if isinstance(ir, HighLevelCall): - # print(ir.function.full_name) if ( isinstance(ir.function, Function) and ir.function.full_name == "balanceOf(address)" @@ -133,7 +138,6 @@ def taint_balance_equalities( if isinstance(ir, Assignment): if ir.rvalue in self.sources_taint: taints.append(ir.lvalue) - return taints # Retrieve all tainted (node, function) pairs @@ -155,10 +159,10 @@ def tainted_equality_nodes( # Filter to only tainted equality (==) comparisons if ( self.is_direct_comparison(ir) + # Filter out address comparisons which may occur due to lack of field sensitivity in data dependency and self.is_not_comparing_addresses(ir) and self.is_any_tainted(ir.used, taints, func) ): - # if func not in results: results[func] = [] results[func].append(node) diff --git a/slither/utils/type.py b/slither/utils/type.py index 1674999aa5..916cf42b57 100644 --- a/slither/utils/type.py +++ b/slither/utils/type.py @@ -197,3 +197,17 @@ def export_return_type_from_variable( return ret return [variable_or_type.type] + + +def is_underlying_type_address(t: "Type") -> bool: + """ + Return true if the underlying type is an address + i.e. if the type is an address or a contract + """ + from slither.core.declarations.contract import Contract + + if t == ElementaryType("address"): + return True + if isinstance(t, UserDefinedType) and isinstance(t.type, Contract): + return True + return False diff --git a/tests/e2e/detectors/test_data/incorrect-equality/0.7.6/incorrect_equality.sol b/tests/e2e/detectors/test_data/incorrect-equality/0.7.6/incorrect_equality.sol index b2e4c2f142..58b6b593e0 100644 --- a/tests/e2e/detectors/test_data/incorrect-equality/0.7.6/incorrect_equality.sol +++ b/tests/e2e/detectors/test_data/incorrect-equality/0.7.6/incorrect_equality.sol @@ -134,3 +134,27 @@ contract TestSolidityKeyword{ } +interface Receiver { + +} +contract A { + mapping(address => Info) data; + + struct Info { + uint a; + address b; + uint c; + } + function good(address b) public payable { + data[msg.sender] = Info(block.timestamp, b, msg.value); + if (data[msg.sender].b == address(0)) { + payable(msg.sender).transfer(data[msg.sender].c); + } + } + function good2(address b) public payable { + data[msg.sender] = Info(block.timestamp, b, msg.value); + if (Receiver(data[msg.sender].b) == Receiver(address(0))) { + payable(msg.sender).transfer(data[msg.sender].c); + } + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/incorrect-equality/0.7.6/incorrect_equality.sol-0.7.6.zip b/tests/e2e/detectors/test_data/incorrect-equality/0.7.6/incorrect_equality.sol-0.7.6.zip index a7fbdc6b68cb2bde137d455418999079da2d40b7..99de07e26a1870ec4bfdaaa471a8fe3722aa684a 100644 GIT binary patch delta 9990 zcmV+hC;8Z|K@KL7#%4gffIhPVK(`C;a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?ugt^5)=F` Date: Thu, 4 May 2023 22:11:28 -0500 Subject: [PATCH 3/4] lint --- slither/utils/type.py | 1 + 1 file changed, 1 insertion(+) diff --git a/slither/utils/type.py b/slither/utils/type.py index 916cf42b57..a6b6402027 100644 --- a/slither/utils/type.py +++ b/slither/utils/type.py @@ -204,6 +204,7 @@ def is_underlying_type_address(t: "Type") -> bool: Return true if the underlying type is an address i.e. if the type is an address or a contract """ + # pylint: disable=import-outside-toplevel from slither.core.declarations.contract import Contract if t == ElementaryType("address"): From abcef3015ad90c76830912965212d2e188b5e848 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Thu, 4 May 2023 22:14:28 -0500 Subject: [PATCH 4/4] remove unused import --- slither/core/declarations/custom_error.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/slither/core/declarations/custom_error.py b/slither/core/declarations/custom_error.py index 8ed943d942..234873eaca 100644 --- a/slither/core/declarations/custom_error.py +++ b/slither/core/declarations/custom_error.py @@ -43,9 +43,6 @@ def compilation_unit(self) -> "SlitherCompilationUnit": @staticmethod def _convert_type_for_solidity_signature(t: Optional[Type]) -> str: - # pylint: disable=import-outside-toplevel - from slither.core.declarations import Contract - if is_underlying_type_address(t): return "address" return str(t)