Open hats-bug-reporter[bot] opened 2 months ago
This means that any authorized gateway can update the humanity status of any humanity ID, regardless of whether they have the rightful authority to do so.
If they are authorized, they have the rightful authority to do so.
@clesaege , i think there is a misunderstanding.please consider the below example.
Legitimate User Action:
Exploitation by Attacker Attacker Observes the Pending Transaction:
Bob, an attacker, observes Alice's pending transaction on the blockchain. Bob sees the parameters Alice used: _owner, _humanityId, _expirationTime, and _transferHash. Attacker Front-Runs the Transaction:
Bob quickly prepares his own transaction to the Foreign Bridge contract, calling requireToPassMessage() with the following parameters:
Executing the Transfer on the Home Side:
The Home Bridge contract decodes the message and calls receiveTransfer() on the CrossChainProofOfHumanity contract with Bob's parameters. The receiveTransfer() function sets Bob as the owner of the humanity ID (0x12345), even though Bob is not the legitimate owner.
Result Bob successfully front-ran Alice's transaction and received ownership of Alice's humanity ID on the other chain. Alice's legitimate transfer is now invalid because the receiveTransfer function has already processed the transfer hash (0xabcdef).
@clesaege ,please let me know if you need any further details.
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): 0x40c76a145bd69bf7c9683679bfcf2307c63d7c4c607ef19707908b7b1310e563 Severity: high
Description: Description\ The
updateHumanity
function in theCrossChainProofOfHumanity.sol
contract allows any valid gateway to update the humanity status of anyhumanity ID
. This could potentially lead to unauthorized updates, where a valid gateway could claim or update the humanity status of any humanity ID without proper authorization from the rightful owner.The
updateHumanity
function is designed to send an update of the humanity status to a foreign chain. However, the function allows anyvalid gateway
(as determined by the allowedGateway modifier) to call it. This means that any authorized gateway can update the humanity status of any humanity ID, regardless of whether they have the rightful authority to do so.Attack Scenario\ Step 1: Setup
Step 2: GatewayA Updates Humanity ID
Step 3: Unauthorized Update by GatewayB
Step 4: Impact
this also possible in another function in the crosschainHumnity() function,i will post it in detail in comments
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)