buyLoan()
doesn't validate collateral/loan tokens between a loan and a pool.
Lenders can buy a loan during the auction period using buyLoan()
.
But this function doesn't validate if the loan and pool have the same collateral/loan tokens and attackers can steal funds from the contract.
An attacker Alice
notices the Lender
contract has 10000 USDC for some pools.
Then she creates a pool with collateral = ETH, loanToken = USDC
using setPool()
and deposits 10000 USDC.
In the same transaction, she borrows 10000 USDC by providing 10 ETH using another account (called Alice2
). Now the contract has 10 ETH and 10000 USDC.
Then she starts an auction immediately and buys Alice2
's loan after creating another pool. This pool has collateral = ETH, loanToken = FakeUSDC(zero cost)
and she deposits 10000 FakeUSDC
.
After that, Alice2
repays the loan by depositing 10000 FakeUSDC
with 0 costs and receives her 10 ETH(collateral).
Also, Alice
withdraws 10000 USDC from her original pool because there are no active loans. So the contract has 10000 FakeUSDC
instead of 10000 USDC.
I've explained without any interest/protocol fees for simplicity but it shows attackers can steal any funds from the contract.
Attackers can steal all funds from the Lender
contract using buyLoan()
.
Manual Review
We should validate collateral/loan tokens something like this.
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.