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

Upgraded Q -> 2 from #258 [1706642045293] #1278

Closed
c4-judge opened this issue Jan 30, 2024 · 3 comments
Closed

Upgraded Q -> 2 from #258 [1706642045293] #1278

c4-judge opened this issue Jan 30, 2024 · 3 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value duplicate-294 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%)

Comments

@c4-judge
Copy link
Contributor

Judge has assessed an item in Issue #258 as 2 risk. The relevant finding follows:

[L-10] There is a potential for underflow in the decreaseUnmintedRebaseRewards function within the ERC20RebaseDistributor token.

When updating shares, we adjust the share price accordingly.
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/tokens/ERC20RebaseDistributor.sol#L213-L217

function updateTotalRebasingShares() {
    uint256 delta = uint256(val.targetValue) - currentRebasingSharePrice;
    if (delta != 0) {
        uint256 percentChange = (sharesAfter * START_REBASING_SHARE_PRICE) / sharesBefore;
        uint256 targetNewSharePrice = currentRebasingSharePrice + (delta * START_REBASING_SHARE_PRICE) / percentChange;
}

No need to calculate percentChange; the updated price will be as follows:

targetNewSharePrice = currentRebasingSharePrice + delta * sharesBefore / sharesAfter```

Due to rounding, the calculated price may be slightly larger.
Consequently, when attempting to decrease unminted rewards, there is a risk of underflow.

function decreaseUnmintedRebaseRewards(uint256 amount) internal {
    lastValue: SafeCastLib.safeCastTo224(
        _unmintedRebaseRewards - amount
    ), // adjusted current
}
@c4-judge c4-judge added the 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value label Jan 30, 2024
@c4-judge
Copy link
Contributor Author

Trumpero marked the issue as duplicate of #294

@Trumpero
Copy link

This issue should receive only 50% partial credit due to its lack of quality and maximum impact

@c4-judge
Copy link
Contributor Author

Trumpero marked the issue as partial-50

@c4-judge c4-judge added the partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value duplicate-294 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%)
Projects
None yet
Development

No branches or pull requests

2 participants