NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing Hash Verification in `bridge.cairo::withdraw_auto_from_l1` Function

Description:

The bridge.cairo::withdraw_auto_from_l1 function currently lacks a verification process for the hash associated with token transfer requests from Layer 1 to Layer 2. The hash is a critical component that ensures the integrity of the request data. Without proper hash verification, there is a risk that the data could be tampered with during transmission, leading to potential security vulnerabilities.

Impact:

Failure to verify the hash could allow attackers to alter the data during transmission from Layer 1 to Layer 2, leading to unauthorized or incorrect token transfers. This could compromise the integrity of the token bridge process, resulting in incorrect token balances or potential loss of assets.

Recommended Mitigation:

Implement hash verification within the bridge.cairo::withdraw_auto_from_l1 function to ensure that the data received on Layer 2 matches the data sent from Layer 1. This will help detect and prevent any tampering or data alteration during the transfer process. The following changes are recommended:

#[l1_handler]
fn withdraw_auto_from_l1(
ref self: ContractState,
from_address: felt252,
req: Request
) {
ensure_is_enabled(@self);
assert(self.bridge_l1_address.read().into() == from_address,
'Invalid L1 msg sender');
// Recompute the hash using the request data
+ let recomputed_hash = compute_request_hash(
+ req.header,
+ req.collection_l2,
+ req.owner_l1,
+ req.ids
);
// Verify the recomputed hash matches the received hash
+ assert(recomputed_hash == req.hash, 'Hash mismatch');
}
Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational / Gas

Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.