-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redemptions can be unpaused by cleaning up the same term multiple times #1187
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
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-1141
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Comments
c4-bot-5
added
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
labels
Dec 28, 2023
0xSorryNotSorry marked the issue as sufficient quality report |
c4-pre-sort
added
the
sufficient quality report
This report is of sufficient quality
label
Jan 1, 2024
0xSorryNotSorry marked the issue as duplicate of #1141 |
Trumpero changed the severity to 2 (Med Risk) |
c4-judge
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
downgraded by judge
Judge downgraded the risk level of this issue
satisfactory
satisfies C4 submission criteria; eligible for awards
and removed
3 (High Risk)
Assets can be stolen/lost/compromised directly
labels
Jan 25, 2024
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
downgraded by judge
Judge downgraded the risk level of this issue
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/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
The text was updated successfully, but these errors were encountered: