In the Starklane::depositTokens
function, users are required to send ether along with their transaction. According to the documentation, to simplify interactions between Layer 1 (L1) and Layer 2 (L2), L1 → L2 messages are payable on L1 by sending ETH with the call to the payable function sendMessageToL2
on the Starknet Core Contract. However, the current implementation lacks a fee estimation function and does not validate the msg.value
parameter. properly.
Consequences:
• Users cannot accurately estimate the required fee, leading to uncertainty.
• If a user sends less ether than required, the cross-chain transaction may not proceed on L2, or the hash may fail to be written back, causing unintended consequences. For example, users who do not receive their NFTs may have to wait an additional 5 days to cancel the action, causing their tokens to be temporarily stuck.
• If a user sends more ether than necessary, the excess will not be refunded, leading to a loss of funds.
The Starklane::depositTokens
function requires users to send ether, which is used to call sendMessageToL2
on the Starknet Core Contract:
In the L1 <==> L2 cross-chain mechanism
, this ether is used to pay for the transaction on L2, as outlined in the Starknet documentation. However, there is no functionality to determine the correct amount of ether to send, nor is there a check on msg.value
to ensure the ether sent is within an acceptable range. The StarknetMessaging::sendMessageToL2
function does not calculate or validate the fee either.
Per the documentation, there is a minimum fee required for the message to be fully processed:
The following PoC demonstrates the vulnerability:
This code demonstrates that a deposit still succeeds even when only 1 wei
is transferred, and events are emitted:
The PoC was executed on forked-ETH
with forge test --mt testERC721LowValue2 -vvvv --evm-version shanghai
. It confirms that the event is emitted successfully, even with an insufficient fee.
As a result:
• Users cannot estimate the fee they should pay due to the lack of functionality.
• If a user sends less than the required amount, the cross-chain transaction might not proceed on L2, leading to unintended consequences like temporary token lockups. Users who do not receive their NFTs might have to wait an additional 5 days to cancel the action.
• If a user overpays, the excess fee will not be refunded, resulting in a loss of funds.
Manual review, Foundry
• Implement a minimum fee validation to try to prevent temporary token lockup.
• Provide a query function (or update the fee estimation process) to help users more accurately determine the required fee for transactions.
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
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
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.