Laundrette::depositTheCrimeMoneyInATMallows front-running attacks where malicious gangmembers can steal funds from honest depositors.
Depositing USDC funds in the protocol is a two-step process:
user needs to approve the MoneyShelf contract to spend USDC on its behalf, and then
user needs to call Laundrette::depositTheCrimeMoneyInATM to make the actual deposit.
However, the current implementation of Laundrette::depositTheCrimeMoneyInATM allows front-running attacks:
seeing the approval transaction from another user, a malicious gangmember can quickly call the Laundrette::depositTheCrimeMoneyInATM to deposit the victim's funds into their own account, instead of the indended account.
The test below demonstartes that
gangmember_1 tries to deposit USDC for himself, but after he approves the MoneyShelf contract,
gangmember_2 intervenes and calls Laundrette::depositTheCrimeMoneyInATM with input parameters account = gangmember_1 and to = gangmember_2, essentially stealing funds from gangmember_1.
Malicious gangmembers can steal funds from honest depositors.
Manual review, Foundry.
Ensure that no front-running is possible by modifying the code as follows:
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.