buyLoan() is missing a check for loanToken and collateralToken
These checks are missing:
if (pool.loanToken != loan.loanToken) revert TokenMismatch();
if (pool.collateralToken != loan.collateralToken)
revert TokenMismatch();
This allows attacker to steal all funds from the contract:
create (1st) pool with loanToken WETH and collateral token DMT (Dummy Malicious Token)
borrow WETH for DMT and get WETH back
startAuction
create another (2nd) pool with loanToken DMT
buyLoan from himself using the second pool
Since 1st pool outStandingLoan is now 0 an attacker can withdraw WETH again. Therefore they doubled their original amount
Mitigations steps:
Add these checks
if (pool.loanToken != loan.loanToken) revert TokenMismatch();
if (pool.collateralToken != loan.collateralToken)
revert TokenMismatch();
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.