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

[M-2] No implementation of lower limit in `msg.value` while depositing NFTs in `depositToken()` functions in `bridge.sol`

Summary

The depositTokens() function in bridge.sol is a payable function that requires Ether to be sent along with its execution. This Ether is utilized by the StarknetMessaging.sendMessageToL2{value:msg.value}(snaddress.unwrap(_starklaneL2Address), felt252.unwrap(_starklaneL2Selector), payload) function, which forwards the fee to the sequencer to perform the computation. According to the documentation, "The fee itself is calculated in the same manner as 'regular' L2 transactions." The CLI tool can be used to estimate the L1 → L2 message fee. However, if the Ether sent with the transaction is less than the estimated fee, the transaction may fail due to insufficient funds. In the UI, there is a limit defined 0.00004 ether , something like this must be implemented in the smart contract itself.

References

Vulnerability Details

In the current implementation of the depositTokens() function, there is no mechanism to ensure that the Ether sent with the transaction meets the required minimum fee. If the Ether provided is less than the estimated amount, the transaction could fail, leading to incomplete execution and potential issues.

Impact

Medium: The vulnerability could result in transaction failures due to insufficient Ether being sent along with the depositTokens() function. This could lead to disruptions and potential loss of functionality in the bridge mechanism.

Recommendations

Implement a lower limit check within the depositTokens() function to ensure that the Ether sent (msg.value) is greater than or equal to the estimated transaction fee. This will prevent transaction failures due to insufficient funds and ensure smooth execution of the function.

Example code :

require(msg.value>=estimate_value)
Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-not-enough-fee-can-block-NFT

Impact: Medium/High. Need an admin to start a cancellation and wait for 5 days once done. DoS > 5 days. Likelyhood: Low. Everytime a wallet/or a user do not send enough gas

Support

FAQs

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