User and Gauge Profit Index aren't Handled Rightly In the Profit Manager #572
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1194
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/ProfitManager.sol#L409-L436
Vulnerability details
Impact
When users with
GUILD
participate in voting by allocating weights to gauges in the system, they subsequently qualify for a reward. The reward is a percentage of the profit/interest realized from the gauge they added weight to.The system uses index to evenly allocate rewards to gauge stakers.
There are currently several issues with how the system currently uses this:
when users allocate weight to a gauge for the first time, the user gauge index isn't set to the current index. i.e. the user is exposed to more reward than he should be liable for.
When a gauge staker removes their weight from a gauge, the staker index isn't removed, such that when the staker eventually allocates weight to this gauge later on, their index will be their previously recorded index and not the index as of when they allocated votes
I have added a runnable POC below to best showcase this issue
Proof of Concept
Please add the below test to
test/unit/governance/ProfitManager.t.sol
, then run:Here are the logs:
Tools Used
Manual Review
Recommended Mitigation Steps
Assessed type
Context
The text was updated successfully, but these errors were encountered: