Core Contracts

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

Missing Access Control in `claimRewards` Function

Summary

Context: FeeCollector#L199

The claimRewards function in FeeCollector.sol allows any user to claim rewards on behalf of another address, leading to unauthorized withdrawals.

Vulnerability Details

The function accepts a user parameter and allows any caller to pass an arbitrary address, enabling them to claim rewards for another user. This lack of access control means an attacker can drain rewards from any account.

Impact

Malicious users can steal rewards from any user by calling claimRewards with their address. This could lead to significant loss of funds for legitimate users.

Tools Used

Manual code review

Recommendations

Restrict the claimRewards function so that only the user themselves can call it. Modify the function to check msg.sender == user before proceeding with the claim.

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

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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