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

0 stars 0 forks source link

Main Seaweed Condor - New lender will not be able to call auction() eventhough loan would be 'Called' Status #272

Open sherlock-admin4 opened 2 days ago

sherlock-admin4 commented 2 days ago

Main Seaweed Condor

High

New lender will not be able to call auction() eventhough loan would be 'Called' Status

Summary

The missing check in call() function regarding whenNotPaused modifier, will impact the lender in a way that no new lender will be able to call auction() for that particular loanID which is in auction phase.

When a contract is paused, no new loans including refinancing and auction can be created. But all operations with existing loans still work.

Root Cause

https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L731C1-L737C6

https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L731C1-L737C6

Here two case can be possible. 1) First contract is being paused by Admin , and then lender calls the call() for particular loanId. 2) second is lender calls the call() for particular loanId and then owner paused the contract.

for the first case , protocol should restrict anyone to call() the loan , as it is restricting any new lender to call the auction() as , it is restricted by whenNotPaused. So no use of calling the auction for old lender, as time will pass and now new lender will able to takeover the loan as contract is paused. we don't know for which amount of time. After the loan duration is over, loan status would be changed and now he will no able to call auction again for that loan id. So it would be lose-lose situation for old lender, as if during that phase question got reloved and it dont go his way, the chance of new lender taking over the loan will also gone. and now he will have only option to sieze the loan.

for second condition, if contract is paused after loan is called() by lender then also same situation will occur new lender will not be able to takeover the loan as, auction function is restricted. here if protocol dont want to restrict call() function, then during the togglePaused() check should be there regarding no loan should be in called state, if it would be, at that time no one would be able to call auction() for that loan during auction duration

Internal pre-conditions

1) Admin calls the togglePause() to pause the contract.

2) then if any lender calls the call() for particular loan

External pre-conditions

No response

Attack Path

No response

Impact

Loan with the status called will go unauctioned due to the lack of whenNotPaused check in call() and same modifier check present in auction(). it would impact lender as if during auction duration contract is paused and now new lender cannot takeover and then will only left with option of sieze. and any situation like question is resolved after the auction period but chances would be there if new lender can takeover the laon etc etc

PoC

No response

Mitigation

Better recommendation would be add whenNotPaused modifier to call function

function call(uint256 loanId) external nonReentrant whenNotPaused {}

And also if not this way you can put check regarding no loan status should be in called state in togglePause().