Open c4-bot-2 opened 6 months ago
0xSorryNotSorry marked the issue as sufficient quality report
0xSorryNotSorry marked the issue as duplicate of #937
Trumpero changed the severity to QA (Quality Assurance)
Trumpero marked the issue as grade-b
Trumpero marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/SurplusGuildMinter.sol#L292-L315
Vulnerability details
Summary
When the
mintRatio
(the ratio how much guild is minted for the given amount of credit tokens staked) is updated by the governance. The changes need to be applied manually to every staking position of every user, which can be done by everyone. As these changes are not automatically applied to rewards on the unstaking process, unfair distribution conditions are created.Vulnerability Details
The governance is able to update the
mintRatio
the ratio how much guild is minted for the given amount of credit tokens:These changes are not automatically applied but can be manually applied by everyone and needs to be applied to every staking position of every user to distribute rewards fairly. This is done in the
updateMintRatio
function:Therefore, this can lead to unfair distributions of guild and credit tokens in the staking process. For example, if the
mintRatio
is updated, the user can choose to apply it to the own position if the new mintRatio is benificial for the user. Or if the newmintRatio
is not benificial for the user, the user can choose to not apply it to the own position and claim rewards and unstake with the oldmintRatio
before anyone else applies the newmintRatio
to the user's position. The user will then receive more guild and credit tokens than other stakers.The following POC can be implemented in
SurplusMinter.t.sol
test file:Impact
Unfair distribution of guild and credit tokens in the staking process.
Recommendations
Implement a unified reward system by automatically applying the new mintRatio before rewards are claimed or unstaking is done.
Assessed type
Math