PSM redemptions for the market can get
completely bricked`
#997
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
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#L153-L170
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L175-L199
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOnboarding.sol#L239-L261
Vulnerability details
Impact
PSM
redemptions for the market can getcompletely bricked
if the term isonboarded
andoffboarded
twice without calling thecleanup
, until the governance resumes the redemptions on the PSM. This will make the credit tokens unredeemable until the governance calls thesetRedemptionsPaused(false)
on thePSM
. Also, every offboarding of a term will now require additional attention from governance to unpause the redemptions every time the term is offboarded.Proof of Concept
onboarded
as part of governance.offboarded
andre-onboarded
later.offboards
a term thenOffboardingsInProgress
is increased. The first offboard call in the market will also pause the redemptions for the whole market as seen in the function below.0
thecleanup
can be callednOffboardingsInProgress
, setcanOffboard[term] = false
and resume redemptions ifnOffboardingsInProgress
is reduced to0
.Example
term A
offboard(term A)
nOffboardingsInProgress = 1
andcanOffboard[term] = true
cleanup
is not called and the term isre-onboarded
again.canOffboard[term] = true
anyone can immediately call theoffboard(term A)
followed bycleanup(term A)
and brick the wholePSM
until governance intervenes. Why? Let's take a looknOffboardingsInProgress = 2
.cleanup
is called thenOffboardingsInProgress
is reduced to1
andcanOffboard[term]
set tofalse
canOffboard[term] = false
thecleanup
cannot be called again and thenOffboardingsInProgress
cannot be reduced from1 to 0
and can never unpause the redemptions on the PSM unless thegovernance
calls thesetRedemptionsPaused(false)
on the PSM.DOS
for some time as governance actions are under timelock and the credit cannot be redeemed until the redemptions are resumed.cleanup
forgets to be called as it is not enforced to be. Everybody makes mistakes and in time i think it is bound to happen if the protocol is widely used.Coded POC
Add this test to
LendingTermOffboarding.t.sol
fileRun with
forge test --match-path ./test/unit/governance/LendingTermOffboarding.t.sol -vvv
Tools Used
Manual review
Recommended Mitigation Steps
Ensure that the cleanup has to be called before the term re-onboarding
function proposeOnboard( address term ) external whenNotPaused returns (uint256 proposalId) { ... bool isGauge = GuildToken(guildToken).isGauge(term); require(!isGauge, "LendingTermOnboarding: active term"); + require(!core().hasRole(CoreRoles.RATE_LIMITED_CREDIT_MINTER, term), "Term not offboarded properly"); // Generate calldata for the proposal ( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description ) = getOnboardProposeArgs(term); // propose return Governor.propose(targets, values, calldatas, description); }
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: