A malicious lender could repeatedly call giveLoan
to collect compound interest from the user.
The buyLoan
function in Lender.sol
can be called by anyone. Therefore, random user A can force lender2 to buy lender1's loan, which means that lender2 can be forced to buy the loan by random users even if they don't want to. The big problem here is when updating loan information:
lender.loan
is a variable that indicates which lender the loan was issued to. However, as mentioned earlier, an arbitrary user A can call buyLoan
and msg.sender
will be user A. In other words, lender2 bought the loan, but lender will be set to user A. When borrower makes a repayment, lender will be set to user A.
At this time, if the borrower wants to repay, borrower will repay the loan token to the lender of the loan. In other words, the loan token that should be repaid to lender2 can be stolen by userA.
Scenario:
borrower loans 1000 tokens B to lender1 for 100 tokens A.
auction starts for the loan.
userA calls buyLoan
with lender2's pool. (loan.lender is userA)
borrower repays the loan (tokenB 1000 + interest)
loan.lender repays the loan tokens to the pool.
userA removeFromPool
lender2 cannot removeFromPool
because the poolBalance
does not increase even though the loan is repaid.
userA can steal 1000 tokensB.
POC:
It is possible to steal Loan tokens from other pools and consequently make the protocol insolvent.
VS Code
buyLoan
should be called by the owner of poolId.
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.