sherlock-audit / 2024-09-predict-fun-judging

0 stars 0 forks source link

Modern Chili Pelican - Setting `protocolFeeBasisPoints = 0` will allow the lender to DoS on repaying a matured loan by auctioning the loan #295

Open sherlock-admin3 opened 2 days ago

sherlock-admin3 commented 2 days ago

Modern Chili Pelican

Medium

Setting protocolFeeBasisPoints = 0 will allow the lender to DoS on repaying a matured loan by auctioning the loan

Summary

Setting protocolFeeBasisPoints = 0 will allow the lender to DoS on repaying a matured loan by auctioning the loan.

Root Cause

When a new lender auctions a matured loan, they have to pay the protocol fee

https://github.com/sherlock-audit/2024-09-predict-fun/blob/41e70f9eed3f00dd29aba4038544150f5b35dccb/predict-dot-loan/contracts/PredictDotLoan.sol#L598

If protocolFeeBasisPoints = 0, then the protocol fee will be zero. In this case, the fee of auctioning is just the gas fee.

Internal pre-conditions

  1. Admin set protocolFeeBasisPoints = 0
  2. A loan is matured

External pre-conditions

No response

Attack Path

  1. Alice borrows from Bob
  2. The loan is matured
  3. Alice repays the loan
  4. Bob front-runs Alice's transaction by calling the loan and stuffs the current block to push Alice's transaction to the next block
  5. In the next block, Bob front-runs Alice's transaction with auction, to create a new loan.

Impact

  1. The borrower can not repay the loan
  2. Every time the loan is auctioned, the loanAmount will increase, because debt is accrued from the startTime to the callTime. At some point, the value of the loan amount will be greater than the value of the collateral amount, the borrower will give up on repaying the loan. As a result, the lender can seize the loan and benefit from the collateral.

PoC

No response

Mitigation

Have a higher minimum of protocolFeeBasisPoints. For example, protocolFeeBasisPoints should be between 100 and 200.