Open hats-bug-reporter[bot] opened 5 months ago
Thanks. Validated as bug. Will determine severity internally.
Renouncing ownership is probably a rare occasion and the renouncing+assigning of ownership would probably be done atomically no? Guessing low due to likelihood conditions.
Likelihood: Low Impact: High
I think Medium is appropriated.
We have decided to classify this issue as low. Our decision is based on the following arguments:
According to these arguments, the issue is low. We have decided to check against address(0) when sending and verifying messages.
Github username: @erictee2802 Twitter username: 0xEricTee Submission hash (on-chain): 0x9a7fc1c76d4ef9f3e4798e9fb4975f13b683a020457a9f74c185117188d1b386 Severity: medium
Description: Description\ From
IncentivizedMockEscrow.sol
:The contract inherits
Ownable2Step
contract, meaning thatrenounceOwnership()
function can be used to set owner to address(0).In
IncentivizedMockEscrow::_verifyPacket()
:The line
require(messageSigner == owner(), "!signer");
checks that the message is indeed signed by legit signer. However, whenrenounceOwnership()
function is called, attacker can specify an invalidv
value to return address(0) duringecrecover
.Attack Scenario\ Signature Bypass when
renounceOwnership()
function is called.Attachments
NA
Add the following test to
SendMessagePayment.t.sol
:Run the test with
forge test --match-test test_signature_bypass_if_ownership_renounced_happened -vvvv
.Foundry Result:
Either disable the use of
renounceOwnership()
function or use OpenZeppelin’s ECDSA library instead of the built-in function: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol