The function L1BossBridge::withdrawTokensToL1 permits to sends token from vault to arbitrary user passed as argument.
The function L1BossBridge::withdrawTokensToL1 gets the target address as an argument and use it inside the abi.encodeCall function to create the message to pass to the function sendToL1.
The function sendToL1 call the function IERC20.transferFrom(address(vault), to, amount) on the address(token) and transfer the token from the vault to the attacker address.
Here a simple test to verify the vulnerability:
An attacker can steal tokens from the vault with the function withdrawTokensToL1.
Foundry test + manual check
One possible solution is to keep track of the balance of tokens that each user deposits and withdraws.
It is also necessary to manage access to the withdraw function only for users who have made a deposit.
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.