Re-onboarded term can be offboarded instantly #874
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/main/src/governance/LendingTermOffboarding.sol#L154
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/LendingTermOffboarding.sol#L197
Vulnerability details
Impact
There can be a situation where an offboarded term has been re-onboarded without a
cleanup
, that term can be offboarded instantly, without a 7 day vote.Proof of Concept
In order to offboard a term users need to start a 7 day voting in the
LendingTermOffboarding.sol
, after it succeeded we setcanOffboard[term] = true
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/LendingTermOffboarding.sol#L139
and anyone can call
offboard
function to remove the gauge from the active listhttps://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/LendingTermOffboarding.sol#L153
Later this gauge can be re-onboarded with the
LendingTermOnboarding.sol
, unfortunatelycanOffboard
flag isn't reset for the re-onboarded term and it can be offboarded again by anyone without a vote. To set this flag to false we need to execute acleanup
functionhttps://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/LendingTermOffboarding.sol#L197
but this requirement indicates that it is not necessary to call this function if we plan to re-onboard the term
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/LendingTermOffboarding.sol#L181-L184
It is worth noting that the
nOffboardingsInProgress
counter is also not updated, which can create problems with following requirement in the futurehttps://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/governance/LendingTermOffboarding.sol#L191-L195
Check this test case for
LendingTermOffboarding.t.sol
Tools Used
Foundry
Recommended Mitigation Steps
Set
canOffboard[term]
to false and decrementnOffboardingsInProgress
if the gauge was previously removedAssessed type
Governance
The text was updated successfully, but these errors were encountered: