-
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
New user is able to gain ALL rewards since protocol launch #1211
Comments
0xSorryNotSorry marked the issue as sufficient quality report |
0xSorryNotSorry marked the issue as primary issue |
#1194 (marked as duplicate to this issue) contains a test that can be run to confirm Disputing severity (think it's more fit for medium because there is no loss of user funds, just rewards) |
eswak (sponsor) confirmed |
eswak marked the issue as disagree with severity |
Trumpero marked the issue as satisfactory |
Trumpero marked issue #1194 as primary and marked this issue as a duplicate of 1194 |
I still consider this issue a high severity because the rewards in ProfitManager are matured yield, which should be distributed to the intended users, and the loss of matured yield is considered a high-severity issue based on C4's criteria. @eswak |
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/ProfitManager.sol#L409-L436
Vulnerability details
Gauge rewards in ECG are similar to Compound - there is a global ever-increasing profit index, and one profit index per user, synchronized by applying the delta between
gaugeProfitIndex
anduserGaugeProfitIndex
.When user profit index is not initialized, it's set to 1e18. This is an issue when the ProfitManager operates for some time and the gaugeProfitIndex grew to a new value. Then we have following situation:
gaugeProfitIndex = 1.2e18
User just joined, userGaugeProfitIndex is set to
1e18
. Hence He's elligible to all rewards since gauge started operating.The problem is even worse if the Guild token transfer are enabled. Then a malicious actor can use sybil accounts and claim all the rewards of other users to themselves.
Impact
All rewards are stolen by sybil accounts, able to claim all rewards since the protocol launch.
Proof of Concept
gaugeProfitIndex
to grow.GuildToken.incrementGauge()
. From a new account. This will internally callProfitManager.claimGaugeRewards()
.Tools Used
Manual analysis
Recommended Mitigation Steps
In case that the user doesn't have index assigned, assign it to current gauge profit index and return from the function early:
Assessed type
Math
The text was updated successfully, but these errors were encountered: