Closed c4-submissions closed 11 months ago
bytes032 marked the issue as insufficient quality report
GalloDaSballo (sponsor) disputed
See my gist
Repaying costs less than doing this
And exiting RM is desired
jhsagd76 marked the issue as unsatisfactory: Out of scope
Lines of code
https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/LiquidationLibrary.sol#L93 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/CdpManagerStorage.sol#L53 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/BorrowerOperations.sol#L874 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/BorrowerOperations.sol#L891 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/BorrowerOperations.sol#L385
Vulnerability details
Impact
Users can reset the grace period that's about ending continually, preventing it from ever ending and leaving collaterals non-liquidatable during recovery mode
Proof of Concept
Liquation operations enforce a grace period before liquidating, it checks this grace period has exceeded the duration else reverts
However,
lastGracePeriodStartTimestamp
can be reset by the users by sufficiently Increasing TCR past 1250000000000000000 (125%) which stops the grace period, and then decreasing it back below CCR which restarts the grace period all over again in a single transaction.This can be done using a flashloan of stEth to call addColl() and then repay flashloan after calling withdrawColl(). Both functions calls _adjustCdpInternal() which checks new TCR in the certain modes but also in turn stops or starts the Grace Period.
Example Attack Scenario:
Tools Used
Visual Studio Code
Recommended Mitigation Steps
I believe there is no logical reason a user would want to add collateral and withdraw collateral in a single transaction except with the aim of trying to game the protocol. So set a time gap between
addColl
andwithdrawColl
operations of a particular user using a mapping,check
consider opening and closing CDP operations as well
Assessed type
Other