Open hats-bug-reporter[bot] opened 2 months ago
An attacker or malicious owner could exploit this by front-running a legitimate transfer and calling the receiveTransfer function with their own address as the _owner, thereby claiming the humanity ID for themselves.
We check that the sender is an allowed gateway so an attacker call would revert.
@clesaege ,I think there is misunderstanding.please consider the below example
below is how the bridge works from the docs
now let's understand the attack scenario
Legitimate User Action:
Exploitation by Attacker
Bob quickly prepares his own transaction to the Foreign Bridge contract, calling requireToPassMessage() with the following parameters:
Executing the Transfer on the Home Side:
Result
Bob quickly prepares his own transaction to the Foreign Bridge contract, calling requireToPassMessage() with the following parameters:
This will not satisfy require(amb.messageSender() == foreignGateway, "!foreignGateway");
so won't work.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x7313cb04938b02de4544bf87fade63830fe3b1fecc7313ffc0663d6c1066e8ee Severity: high
Description: Description\ The
receiveTransfer
function in CrossChainProofOfHumanity.sol has a potential vulnerability that allows anyowner
to receive anyone'shumanity ID
. This vulnerability arises because the function does not adequately verify that the_owner
parameter is the intended recipient of the humanity transfer. An attacker or malicious owner could exploit this by front-running a legitimate transfer and calling thereceiveTransfer
function with their own address as the_owner
, thereby claiming the humanity ID for themselves.Attack Scenario\
Legitimate Transfer Initiation:
Monitoring the Blockchain:
Front-Running the Transfer:
Execution of receiveTransfer Function:
Granting Humanity to the Attacker:
Humanity Not Claimed:
ccGrantHumanity
function checks if the humanity ID 0x123 is already claimed. Since it is not, the function proceeds to grant the humanity to Bob.Updating State:
The humanity ID 0x123 is now associated with Bob's address 0xBob. The state is updated to reflect Bob as the owner of the humanity ID.
Attachments
_owner
parameter in receiveTransfer matches the intended recipient.