When sending tokens from L2 to L1, the tokens are locked in escrow on L2, and the user can receive the corresponding tokens on L1 by calling the withdrawTokens function. If use_withdraw_auto=true is provided, the function will revert. This is intentional and was done as a result of an audit, as mentioned in the comment. However, nothing prevents the L2 user from setting this flag to true. As a result, tokens will not be received on L1, and the tokens on L2 will remain locked.
Let's look at the deposit_tokens function in the bridge.cairo file. It is used for sending tokens from L2 to L1.
https://github.com/Cyfrin/2024-07-ark-project/blob/273b7b94986d3914d5ee737c99a59ec8728b1517/apps/blockchain/starknet/src/bridge.cairo#L242-L277
From the provided code, it is clear that use_withdraw_auto is passed by the user, stored in the request header, and nowhere is its value checked to see if it is true. The function is accompanied by the following comment:
use_withdraw_auto - Tokens are automatically withdrawn on L1 using Starklane indexer.
which gives the impression that both true and false values are possible. The user has no way of knowing that setting it to true will lead to their tokens being locked in escrow on L2 without receiving the corresponding tokens on L1. In the L2->L1 direction there is no cancel message functionality.
Lock of funds for the user and broken functionality.
Manual review
Udjust the deposit_tokens function to always pass use_withdraw_auto=false.
Impact: High, token will be stuck in L2 bridge. Likelyhood: Very low, option is available in L2 but has been disabled since March on L1, would be almost a user error.
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.