The laundrette.depositTheCrimeMoneyInATM function is vulnerable to frontrunning attacks, allowing malicious users to divert crime money to themselves.
The function depositTheCrimeMoneyInATM accepts two parameters: account and to. This design flaw permits a malicious user to frontrun transactions and redirect funds to their own account. When a user sends a transaction to deposit USDC into the MoneyShelf, an attacker can quickly submit a similar transaction with the victim's address as the account and their own address as the to parameter. This enables the attacker to intercept and reroute the intended funds.
UserA approves moneyshelf to spend their USDC.
UserA send transaction in the mempool to depositTheCrimeMoneyInATM.
Attacker frontrun the previous transaction specifying specifying UserA's address as the account and their own address as the to parameter.
The attacker successfully redirects the crime money to themselves.
Place the following into laundrette.t.sol.
Manual review, foundry
To prevent such attacks, remove the account argument from the depositTheCrimeMoneyInATM function and instead rely on msg.sender to determine the source of funds. This change will require reformatting other functions within the contract to ensure compatibility.
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.