20,000 USDC
View results
Submission Details
Severity: high
Valid

The contract's funds can be drained entirely

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:

  1. create (1st) pool with loanToken WETH
 and collateral token DMT (Dummy Malicious Token)

  2. borrow WETH for DMT and get WETH back

  3. startAuction

  4. create another (2nd) pool with loanToken DMT

  5. buyLoan from himself using the second pool

  6. 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();

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.