-
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
Re-triggering the canOffboard[term]
flag to bypass the DAO vote of the lending term offboarding mechanism
#1141
Comments
The issue is well demonstrated, properly formatted, contains a coded POC. |
0xSorryNotSorry marked the issue as high quality report |
0xSorryNotSorry marked the issue as primary issue |
Thanks for the very high quality report :) Confirming this, but disagree with severity. I think medium is more fit for this, given the unlikely situation of re-onboarding a term that just has been offboarded, and that no user funds are at risk. |
eswak (sponsor) confirmed |
eswak marked the issue as disagree with severity |
I agree that this issue should be a med. |
Trumpero changed the severity to 2 (Med Risk) |
Trumpero marked the issue as satisfactory |
Trumpero marked the issue as selected for report |
Dear @Trumpero, I would like to raise two appeals. Please find the Appeal #2 in the comment below. Appeal #1 (Please find the Appeal #2 in the comment below)As the sponsor said,
I disagree with the sponsor's statement. Point #1 - argument about: "the unlikely situation of re-onboarding a term that just has been offboarded"The attack scenario described in this report does not rely on the situation that "the term must be re-onboarded within only a few days after it has been offboarded". Precisely, as long as the The attacker can then wait for a long period (e.g., a couple of months) before attacking. The coded PoC proves that the target term can be re-onboarded after being off-boarded for 12 days (or even later), and the attacker can launch the attack operation (immediately offboard the target term) after the target term has re-onboarded for 30 days (or even later). Please consider the following excerpt from the
Point #2 - argument about: "no user funds are at risk"After re-triggering the Once the attacker launches the attack operation, the target term will be forced to immediately offboard, bypassing the DAO vote offboarding. Please consider the following excerpt from the
Clearly, the loan borrowers' funds and the stakers' funds are at risk. In other words, the attack will impact both borrowers (whose loans are forced to be called and closed maliciously) and stakers (who vote for the term via the The vulnerability also impacts the protocol by breaking the governance decision, which is a core feature of the protocol. For this reason, the HIGH severity is proper for this report. |
Dear @Trumpero, I would like to raise two appeals. Please find the Appeal #1 in the comment above. Appeal #2 (Please find the Appeal #1 in the comment above)As the sponsor said in #1147's comment,
And what the judge said,
I disagree with the sponsor's and judge's statements. Note that I wrote both issues #1147 and #1141 (this report). And they have different attack scenarios. The issue #1141 (this report) explains the attack steps to re-trigger the Whereas the issue #1147 explains another attack scenario in which the target term has been off-boarded but never been explicitly terminated by the Hence, fixing either issue may not fix another issue because they have different attack initiation scenarios and attack vectors (different root causes). For this reason, #1147 (the root cause resides in the |
@serial-coder I agree with appeal 2 that this issue is different from #1147, as it mentions another vulnerability where Guild holders are still able to call supportOffboard for an offboarded lending term after cleanup and set |
Trumpero marked issue #1147 as primary and marked this issue as a duplicate of 1147 |
Trumpero marked the issue as not a duplicate |
Trumpero marked the issue as primary issue |
Trumpero marked the issue as selected for report |
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L197
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L120-L123
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L138-L140
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L154
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/LendingTerm.sol#L797
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/SurplusGuildMinter.sol#L228-L231
Vulnerability details
The
LendingTermOffboarding
contract allows guild holders to poll to remove a lending term. If the voting weight is enough, the lending term can be offboarded without delay. Further, the offboarded term can be re-onboarded to become an active term through theLendingTermOnboarding::proposeOnboard()
following up with the voting mechanism.The following briefly describes the steps for offboarding the lending term through the
LendingTermOffboarding
contract:proposeOffboard()
to create a poll for offboarding the term. The poll has an age of ~7 days.supportOffboard()
.canOffboard[term]
flag will be set.canOffboard[term]
flag is set; anyone can execute theoffboard()
to offboard the term.cleanup()
can be invoked to explicitly terminate the term and reset thecanOffboard[term]
flag.The following roughly describes the steps for re-onboarding the offboarded lending term through the
LendingTermOnboarding
contract:proposeOnboard()
.Vulnerability Details
This report describes the vulnerability in the
LendingTermOffboarding
contract, allowing an attacker to force the re-onboarded lending term to offboard by overriding the DAO vote offboarding mechanism. In other words, the attacker is not required to create an offboarding poll and wait for the vote to succeed in offboarding the target term.The following explains the attack steps:
offboard()
) and cleaned up (via thecleanup()
). Thecleanup()
will reset thecanOffboard[term]
flag so that no one can execute theoffboard()
orcleanup()
on the terminated term again.supportOffboard()
to cast a vote to re-trigger thecanOffboard[term]
flag.offboard()
since thecanOffboard[term]
flag has been re-triggered in step 2.After successfully re-triggering the
canOffboard[term]
flag in step 2, the attacker can suddenly offboard the target re-onboarded term whenever they will, regardless of how long the target term has been re-onboarded, how long the offboarding poll has expired, or how long thecanOffboard[term]
flag has been re-triggered (please refer to theProof of Concept
section for the coded PoC).@1 -- After all offboarded term's loans have been closed, the cleanup() can be executed to explicitly clean up the term and reset the canOffboard[term] flag
: https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L197@2 -- The lending term offboarding poll has an age of ~7 days
: https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L120-L123@3 -- Attacker can cast a vote to re-trigger the canOffboard[term] flag
: https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L138-L140@4 -- Attacker can force offboarding the re-onboarded term, overriding the DAO vote offboarding mechanism
: https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOffboarding.sol#L154Impact
The active re-onboarded lending term can be forced to immediately offboard, bypassing the DAO vote offboarding, which is the protocol's core mechanism. Subsequently, the attacked lending term will block all new loans from being issued and prevent guild holders from voting for the term.
Moreover, all loans previously issued by the attacked term can be called putting the loans for bidding silently (since the attacker bypasses the DAO vote offboarding mechanism). If one of the loans fails on bidding to fill up the loan's principal, the term's loss will be notified. As a result, all users who stake credit tokens through the
SurplusGuildMinter
contract to vote for the attacked term will be slashed with all their credit principal and guild rewards.Proof of Concept
This section provides a coded PoC.
Place the
testPoCBreakingDaoVoteOffboarding()
in the.test/unit/governance/LendingTermOffboarding.t.sol
file and run the test using theforge test --match-test testPoCBreakingDaoVoteOffboarding -vvv
command.The PoC explains the attack steps described in the
Vulnerability Details
section.Tools Used
Manual Review
Recommended Mitigation Steps
Implement a proper mechanism for preventing the (active) lending term offboarding poll from re-triggering the
canOffboard[term]
flag or deprecating the poll from further voting if the associated lending term has been cleaned up (via thecleanup()
).Assessed type
Other
The text was updated successfully, but these errors were encountered: