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

An attacker can adjust the hash value using the salt value.

Summary

An attacker can adjust the hash value using the salt value, as a result, various problem can occur.

Vulnerability Details

According to protocol flow, users call depositTokens() to deposit token in escrow and initiate the transfer to Starknet.

function depositTokens(
@ uint256 salt,
address collectionL1,
snaddress ownerL2,
uint256[] calldata ids,
bool useAutoBurn
)
external
payable
{
...
req.hash = Protocol.requestHash(salt, collectionL1, ownerL2, ids);
...
}

Parameter salt of depositTokens() is set by input of user.
The requestHash() generates hash value by using salt.
This incorrect hash value is used in withdrawTokens().

function withdrawTokens(
uint256[] calldata request
)
external
payable
returns (address)
{
...
if (collectionL1 == address(0x0)) {
if (ctype == CollectionType.ERC721) {
collectionL1 = _deployERC721Bridgeable(
req.name,
req.symbol,
req.collectionL2,
req.hash
);
// update whitelist if needed
_whiteListCollection(collectionL1, true);
} else {
revert NotSupportedYetError();
}
}
...
}

Impact

An attacker can adjust the hash value using the salt value, as a result, various problem can occur.

Tools Used

Mannual Review

Recommendations

Generate salt randomly.

Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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