Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Valid

Incorrect reward tracking in FeeCollector#claimRewards()

Summary

The claimRewards() incorrectly resets the user's claimed rewards to totalDistributed rather than incrementing it by the actual amount claimed. This allows users to double-claim or repeatedly claim rewards, leading to an unauthorized loss of protocol funds.

Vulnerability Details

Currently, the function updates userRewards[user] as: userRewards[user] = totalDistributed;

After a claim, only the claimed amount (pendingReward) should be added to userRewards[user], not the entire totalDistributed value.

Setting userRewards[user] = totalDistributed; overwrites all past claims instead of adding only the newly claimed rewards.

Attack scenario:

  1. Assume totalDistributed = 1000 and User A is eligible for pendingReward = 100.

  2. User A calls claimRewards(), receiving 100 tokens.

  3. userRewards[A] is set to totalDistributed = 1000, which is incorrect.

  4. Later, when new rewards are distributed, totalDistributed increases to 1200, and User A appears to have never claimed (since 1000 is incorrect).

  5. User A can claim again, receiving extra rewards they shouldn't have.

Impact

Users can claim more than they should.

Governance token rewards are improperly distributed.

Tools Used

manual

Recommendations

Instead of resetting to totalDistributed, increment it by pendingReward

function claimRewards(address user) external override nonReentrant whenNotPaused returns (uint256) {
if (user == address(0)) revert InvalidAddress();
uint256 pendingReward = _calculatePendingRewards(user);
if (pendingReward == 0) revert InsufficientBalance();
- // Reset user rewards before transfer
- userRewards[user] = totalDistributed;
+ userRewards[user] += pendingReward;
// Transfer rewards
raacToken.safeTransfer(user, pendingReward);
emit RewardClaimed(user, pendingReward);
return pendingReward;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

FeeCollector::claimRewards sets `userRewards[user]` to `totalDistributed` seriously grieving users from rewards

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.