Reonboarding a term before calling cleanup
breaks the offboard redemption pause mechanism
#694
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-1147
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L150-L199
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/tokens/ERC20Gauges.sol#L395-L42
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/SimplePSM.sol#L146-L154
Vulnerability details
Summary
When a term is offboarded, redeeming CREDIT tokens is paused till all loans are closed and the
cleanup
function is called. If the term is re-onboarded before thecleanup
function is called, redemption stays paused and can be manually unpaused by the governance, but the automatic pause / unpause mechanism of the offboarding process stays broken forever as thenOffboardingsInProgress
variable will always be above 0.Vulnerability Details
Offboarding a term goes through a voting process which updates the
canOffboard
mapping for the given term to true so that theoffboard
function can be called:As we can see if the
nOffboardingsInProgress
is currently 0 thesetRedemptionsPaused
function of theSimplePSM
contract is called to pause the redemption of CREDIT tokens.After that the
cleanup
function can be called (if there are no open loans) which will callsetRedemptionsPaused
again to unpause the redemption of CREDIT tokens ifnOffboardingsInProgress
- 1 equals 0:A term can also be re-onboarded if it was offboarded before, which is done by the
addGauge
function:If the cleanup function was not called before the term is re-onboarded, the
nOffboardingsInProgress
variable and theredemptionsPaused
variable are not updated. Therefore, redemption stays paused andnOffboardingsInProgress
at 1 or higher.The redemptions can be manually unpaused by the governance:
But as the
nOffboardingsInProgress
variable is not updated, the automatic pause / unpause mechanism of the offboarding process stays broken forever as thenOffboardingsInProgress
variable will always be above 0 and thereforeif (nOffboardingsInProgress++ == 0 && !SimplePSM(psm).redemptionsPaused())
clause will never be reached to pause the redemption of CREDIT tokens.The following POC can be implemented in the
LendingTermOnboarding.t.sol
test file (import {LendingTermOffboarding} from "@src/governance/LendingTermOffboarding.sol"; must be added to the imports first):Impact
The offboarding redemption potentially stays paused for a longer time as a manual governance process is needed to unpause them, therefore a temporary DoS. And the pause / unpause mechanism of the offboarding process stays broken forever as the
nOffboardingsInProgress
variable will always be above 0.Recommendations
Update the
setRedemptionsPaused
andnOffboardingsInProgress
parameters on re-onboarding, or do not allow re-onboarding before the cleanup is done.Assessed type
Context
The text was updated successfully, but these errors were encountered: