20,000 USDC
View results
Submission Details
Severity: medium

in giveLoan the new lender can cause the function to revert

Summary

giveLoan can revert, how? By the new lender frontrunning the updating their poolbalance causing the function to revert and dosing giveLoan

Vulnerability Details

ex:

Alice the old lender wants to give his loan to Bob

Bob front runs Alice tx to give him the loan

By taking out their pool balance

causing Alice tx to revert and putting more risk on Alice

// in `giveLoan` the new lender can make poolBalance less then totalDebt
_updatePoolBalance(poolId, pool.poolBalance - totalDebt);

Impact

Now you might think this is the system design but this is a bug the new pool shouldn't be able to make the old lender revet and not accept the loan

In the future if the protocol has a list of lenders that accept that they will take old lenders loans over they can cause revert and cause gas loss for the lenders which interim will cause more risk and maybe loss of funds for the old lender/lenders

Tools Used

Recommendations

either use some sort of flashbots or instead of reverting don't allow setPool to get called when giveLoan is going to happen

Support

FAQs

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