Skip to content
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

User can keep claiming fees in the profit manager even with a loss in the gauge. #647

Closed
c4-bot-5 opened this issue Dec 27, 2023 · 6 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-262 grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sufficient quality report This report is of sufficient quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@c4-bot-5
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/ProfitManager.sol#L409

Vulnerability details

Users are presented with two options to vote for a gauge: through staking credit tokens in the SurplusGuildMinter or directly in the guild token using the incrementGauge function. Users possessing guild tokens have the flexibility to decide and vote for a gauge directly, earning fees from the interest paid by borrowers.

In the event of a gauge incurring a loss, users who voted for that gauge may face slashing. However, if no one takes the necessary action to slash these users, they can continue claiming fees in the profit manager. Note that this is not the same behavior if a user stake credit in the SurplusGuildMinter.

Impact

Users can continue claiming fees in the profit manager, even in the event of a loss in the associated gauge as long as they are not slashed by anyone.

Proof of Concept

Run the next test function in file:

 function testClaimingFeesWithLosses() public {
        vm.prank(governor);
        profitManager.setProfitSharingConfig(
            0.1e18, // surplusBufferSplit
            0.8e18, // creditSplit
            0.1e18, // guildSplit
            0.0e18, // otherSplit
            address(0) // otherRecipient
        );

        _setupAliceLossInGauge1();

        uint256 Balance1 = credit.balanceOf(alice);

        credit.mint(address(profitManager), 100e18);
        profitManager.notifyPnL(gauge1, 100e18);

        vm.prank(alice);
        profitManager.claimGaugeRewards(alice, gauge1);

        vm.roll(block.number + 1);

        uint256 Balance2 = credit.balanceOf(alice);
 
        assert(Balance2 > Balance1);
    }

Tools Used

Manual, Foundry

Recommended Mitigation Steps

Consider implementing a check to determine whether a user has already applied a loss or not in cases where a gauge is slashed.

Assessed type

Other

@c4-bot-5 c4-bot-5 added 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 labels Dec 27, 2023
c4-bot-7 added a commit that referenced this issue Dec 27, 2023
@c4-pre-sort
Copy link

0xSorryNotSorry marked the issue as sufficient quality report

@c4-pre-sort c4-pre-sort added the sufficient quality report This report is of sufficient quality label Jan 5, 2024
@c4-pre-sort
Copy link

0xSorryNotSorry marked the issue as duplicate of #956

@c4-judge
Copy link
Contributor

Trumpero marked the issue as duplicate of #262

@c4-judge
Copy link
Contributor

Trumpero changed the severity to QA (Quality Assurance)

@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jan 28, 2024
@c4-judge
Copy link
Contributor

Trumpero marked the issue as grade-b

@c4-judge c4-judge added grade-b grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards and removed grade-b labels Jan 28, 2024
@c4-judge
Copy link
Contributor

Trumpero marked the issue as grade-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-262 grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sufficient quality report This report is of sufficient quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants