Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

0x52 - Pending CRV rewards are not accounted for and can cause unfair liquidations #136

Open
sherlock-admin opened this issue Apr 30, 2023 · 2 comments
Labels
High A valid High severity issue Reward A payout will be made for this issue Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed

Comments

@sherlock-admin
Copy link
Contributor

0x52

high

Pending CRV rewards are not accounted for and can cause unfair liquidations

Summary

pendingRewards are factored into the health of a position so that the position collateral is fairly assessed. However WCurveGauge#pendingRewards doesn't return the proper reward tokens/amounts meaning that positions aren't valued correctly and users can be unfairly liquidated.

Vulnerability Detail

BlueBerryBank.sol#L408-L413

        (address[] memory tokens, uint256[] memory rewards) = IERC20Wrapper(
            pos.collToken
        ).pendingRewards(pos.collId, pos.collateralSize);
        for (uint256 i; i < tokens.length; i++) {
            rewardsValue += oracle.getTokenValue(tokens[i], rewards[i]);
        }

When BlueBerryBank is valuing a position it also values the pending rewards since they also have value.

WCurveGauge.sol#L106-L114

function pendingRewards(
    uint256 tokenId,
    uint256 amount
)
    public
    view
    override
    returns (address[] memory tokens, uint256[] memory rewards)
{}

Above we see that WCurveGauge#pendingRewards returns empty arrays when called. This means that pending rewards are not factored in correctly and users can be liquidated when even when they should be safe.

Impact

User is liquidated when they shouldn't be

Code Snippet

WCurveGauge.sol#L106-L114

Tool used

Manual Review

Recommendation

Change WCurveGauge#pendingRewards to correctly return the pending rewards

@github-actions github-actions bot added the High A valid High severity issue label May 3, 2023
@Gornutz Gornutz added Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed labels May 10, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label May 20, 2023
@Gornutz
Copy link

Gornutz commented Jun 12, 2023

@IAm0x52
Copy link
Collaborator

IAm0x52 commented Jun 16, 2023

Linked PR does not address this issue. Though the WCurveGuage contract was not present in the second contest so it is presumably dropped. Waiting for sponsor comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
High A valid High severity issue Reward A payout will be made for this issue Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed
Projects
None yet
Development

No branches or pull requests

3 participants