Closed c4-bot-5 closed 9 months ago
0xSorryNotSorry marked the issue as sufficient quality report
0xSorryNotSorry marked the issue as duplicate of #1141
Trumpero changed the severity to 2 (Med Risk)
Trumpero marked the issue as satisfactory
dup of #1141 due to the same root cause: supportOffboard can still be called after offboarding.
Trumpero marked the issue as not a duplicate
Trumpero marked the issue as duplicate of #1141
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L138
Vulnerability details
When a quorum is met
canOffboard[term]
is set to true which means that the term will be offboarded and all loans will be closed. When all loans are closedcleanup()
is called andcanOffboard[term]
is set to false.The problem here is that the
polls
mapping tracking the quorum supporting the removal is not reset and whencanOffboard[term]
is set to false, the attacker can callsupportOffboard()
again and because quorum was already met and the polls mapping wasnt reset,canOffboard[term]
will be set to true again when the attacker adds 1 wei of voting power.The attacker will then be able to call
cleanup()
again because the term is deprecated and has 0 issuance, this will then decrease thenOffboardingsInProgress
and the attacker can repeat this until redemptions are unpaused even though other terms are currently being offboarded and liquidations are happening.The only requirement here is that the first cleanup happened < 7 days(
POLL_DURATION_BLOCKS
) from the proposal creation so that the attacker is able to callsupportOffboard()
again after the first cleanup.There is no proposal delay when offboarding and the auctions are 30 minutes so < 7 days is completely possible.
Impact
The attacker will be able to unpause redemptions while other terms are being offboarded which breaks the core protocol functionality. Some users will be able to redeem through the PSM to avoid losses while some users will suffer big losses and bad debt will not be handled fairly. This will also break the
LendingTermOffboarding
contract because thenOffboardingsInProgress
will not correspond to the actual number.Proof of Concept
This test demonstrates how an attacker can unpause redemptions even though 2 terms are currently being offboarded by repeatedly cleaning up the same term until
nOffboardingsInProgress
is 0.Add this to
LendingTermOffboarding.t.sol
andimport "@forge-std/console.sol";
Tools Used
Foundry
Recommended Mitigation Steps
supportOffboard()
should check if the term is deprecated and revert if yes.Assessed type
Invalid Validation