Core Contracts

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

Incorrect user reward reset leads to potential reward manipulation

Description

The claimRewards function in the FeeCollector contract incorrectly resets the user's reward balance to totalDistributed instead of the pendingReward. This miscalculation can lead to users claiming rewards multiple times without accurately reflecting their actual earned rewards, allowing for potential exploitation.

claimRewards

Proof of Concept:

  1. User calls FeeCollector::claimRewards with their address.

  2. The function calculates pendingReward correctly.

  3. Instead of setting userRewards[user] to pendingReward, it sets it to totalDistributed.

  4. The user can then call claimRewards again, potentially receiving rewards they have not actually earned.

Relevant code snippet:

function claimRewards(address user) external override nonReentrant whenNotPaused returns (uint256) {
// ...
userRewards[user] = totalDistributed; // Incorrect assignment
// ...
}

Recommendation

  1. Correct the reward assignment: Update the line to set the user's rewards to the correct pendingReward.

    - userRewards[user] = totalDistributed;
    + userRewards[user] = pendingReward; // Corrected line
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 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.

Give us feedback!