In Starknet smart contracts, when an internal error occurs during the execution of the call_contract_syscall
function, the entire transaction is reverted instead of returning an error (Err
).
The Starknet bridge contract relies on this method to attempt calling token_uri
and tokenURI
functions to retrieve the URIs of NFTs. However, if these functions are not present in the NFT contract, the transaction will fail completely.
According to the Starknet documentation, an internal error in call_contract_syscall
can lead to the entire transaction being reverted:
Below is a snippet showing how call_contract_syscall
is implemented in the Starknet bridge contract:
The contract first attempts to call the token_uri
function. If this call fails, it then tries to call the tokenURI
function as a fallback.
The vulnerability arises when an NFT collection does not implement the token_uri
function. Instead of returning an error, the entire transaction is reverted, leading to the NFT bridge operation failing.
If an NFT collection does not have the token_uri
function defined, users will not be able to bridge their NFTs using the bridge. This results in a Denial of Service (DoS) for those NFTs.
Manual Review
This issue does not affect NFT collections whose original contracts on L1, as the erc721_bridgeable
contracts deployed on Starknet support token_uri
function.
To mitigate this problem, when an admin whitelists an NFT collection on Starknet, they should specify whether the contract should call token_uri
or tokenURI
. This precaution will help avoid the issue described above.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.