LendingTermOffboarding.supportOffboard
function can be called to change offboarded term's canOffboard
back to true
#790
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-1141
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/e3d3e581e0e51a9ecf3a5a0c4e4bd4af32552fc0/src/governance/LendingTermOffboarding.sol#L116-L148
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/e3d3e581e0e51a9ecf3a5a0c4e4bd4af32552fc0/src/governance/LendingTermOffboarding.sol#L153-L170
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/e3d3e581e0e51a9ecf3a5a0c4e4bd4af32552fc0/src/governance/LendingTermOffboarding.sol#L175-L199
Vulnerability details
Impact
After an offboarding proposal gains enough votes through voters'
LendingTermOffboarding.supportOffboard
function calls, which can be beforePOLL_DURATION_BLOCKS
aftersnapshotBlock
is reached,canOffboard[term]
for the corresponding term changes totrue
.https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/e3d3e581e0e51a9ecf3a5a0c4e4bd4af32552fc0/src/governance/LendingTermOffboarding.sol#L116-L148
After the
LendingTermOffboarding.offboard
function is called for such term, theLendingTermOffboarding.cleanup
function can be called to changecanOffboard[term]
for the corresponding term tofalse
.https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/e3d3e581e0e51a9ecf3a5a0c4e4bd4af32552fc0/src/governance/LendingTermOffboarding.sol#L153-L170
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/e3d3e581e0e51a9ecf3a5a0c4e4bd4af32552fc0/src/governance/LendingTermOffboarding.sol#L175-L199
Before
POLL_DURATION_BLOCKS
aftersnapshotBlock
is reached for such term, if theseLendingTermOffboarding.offboard
andLendingTermOffboarding.cleanup
functions are called, wheresnapshotBlock
is the samesnapshotBlock
used in the previousLendingTermOffboarding.supportOffboard
function calls for the same term, a user, who has at least 1 vote at the end ofsnapshotBlock
and is not one of the voters who made the previousLendingTermOffboarding.supportOffboard
function calls for such term, can call theLendingTermOffboarding.supportOffboard
function with the samesnapshotBlock
for the same term to change such term'scanOffboard[term]
back totrue
. This can be done becausepolls[snapshotBlock][term]
remains more thanquorum
after theLendingTermOffboarding.offboard
andLendingTermOffboarding.cleanup
functions were called for the corresponding term.Then, if this offboarded term is re-onboarded in the future, the
LendingTermOffboarding.offboard
andLendingTermOffboarding.cleanup
functions can be directly called without anyLendingTermOffboarding.supportOffboard
function calls. In this case, even if only less than enough voters support offboarding the corresponding term at that time, such term can still be offboarded unexpectedly.Proof of Concept
The following steps can occur.
block.number
being 12345678.LendingTermOffboarding.supportOffboard
function withsnapshotBlock
being 12345678 for the same term, which changes such term'scanOffboard[term]
totrue
after the quorum is reached. This is done beforePOLL_DURATION_BLOCKS
aftersnapshotBlock
is reached.POLL_DURATION_BLOCKS
aftersnapshotBlock
, which is 12345678, is reached, theLendingTermOffboarding.offboard
andLendingTermOffboarding.cleanup
functions are called so the corresponding term'scanOffboard[term]
is changed tofalse
.POLL_DURATION_BLOCKS
aftersnapshotBlock
, which is 12345678, is reached, a user, who has just 1 vote at the end of block 12345678 and is not one of the voters who called theLendingTermOffboarding.supportOffboard
function in Step 2, can call theLendingTermOffboarding.supportOffboard
function withsnapshotBlock
being 12345678 for the same term. This changes such term'scanOffboard[term]
back totrue
.LendingTermOffboarding.offboard
andLendingTermOffboarding.cleanup
functions can be called directly without anyLendingTermOffboarding.supportOffboard
function calls. Although only less than enough voters support offboarding the corresponding term at that time, such term can still be offboarded.Tools Used
Manual Review
Recommended Mitigation Steps
After a term is offboarded through the
LendingTermOffboarding.offboard
function call, such term can be locked for a reasonable duration, such as a period of time that equals the duration forPOLL_DURATION_BLOCKS
. During such lock time period, theLendingTermOffboarding.supportOffboard
function would not be allowed to be called for such term.Assessed type
Context
The text was updated successfully, but these errors were encountered: