L1BossBridge::sendToL1 has a state visibility of public meaning that anyone can call this function with an arbitrary value for the message parameter. This means that they can encode any arbitrary function call. An attacker can therefore specify the target to be the vault, and since the msg.sender will be L1BossBridge which is the owner of the vault contract, it can call L1Vault::approveTo to approve their attacking address to be able to withdraw the entire balance from the vault.
In L1BossBridge::sendToL1 on lines 112-125, any arbitrary message can be passed as a parameter. This message is then decoded to find the target contract, the value, and the data (or function selector with ABI encoded arguments) to call:
This is an external call where the msg.sender is the L1BossBridge contract. The bridge is the owner of the L1Vault contract as it deploys the vault:
In the vault's constructor, the deployer of the vault is set as the owner:
An attacker can encode L1Vault::approveTo to be called, with their attacking address as the to value and type(uint256).max as the amount, meaning that the attacker can withdraw the entire vault balance.
## Impact
Attackers can force their approval to withdraw the entire vault balance. This is a high-risk and high-likelihood finding, therefore high-severity.
A user deposits tokens into the vault. An attacker can then call sendToL1() with the message parameter set as an ABI-encoded call to the vault, forcing the attacker to have the maximum approval limit. The attacker is then able to call token.transferFrom() to transfer all of the funds held in the vault to themselves.
Running the test shows that the attacker has been able to withdraw the vault's token balance, stealing the user's deposit.
Set the L1BossBridge::sendToL1 function visibility to private to ensure that it can only be called via L1BossBridge::withdrawToL1 or restrict the call data to specific function selectors.
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.