Core Contracts

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

Attacker can drain `FeeCollector` contract

Summary

Attacker can lock raac token for maximum period (4 years) to get more voting power and veToken, then call claimRewards() function to claim more rewards. the issue is claimRewards() function calculates rewards based on current voting power.

Vulnerability Details

The claimRewards() function:

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;
// Transfer rewards
raacToken.safeTransfer(user, pendingReward);
emit RewardClaimed(user, pendingReward);
return pendingReward;
}
function _calculatePendingRewards(address user) internal view returns (uint256) {
uint256 userVotingPower = veRAACToken.getVotingPower(user);
if (userVotingPower == 0) return 0;
uint256 totalVotingPower = veRAACToken.getTotalVotingPower();
if (totalVotingPower == 0) return 0;
uint256 share = (totalDistributed * userVotingPower) / totalVotingPower;
return share > userRewards[user] ? share - userRewards[user] : 0;
}

as we can see the reward calculation is based on current voting power instead of historical voting power at the time of distribution.

this issue can lead to:

  • attacker locks 1000 raac token for max duration(4 years) to get voting power

  • attacker calls claimRewards() function to get rewards based on his current power

  • attacker calls emergencyWithdraw() function to get his raac tokens back

  • repeats this action until fully drains the FeeCollector contract

Impact

Attacker can drain FeeCollector contract

Tools Used

Manual Review

Recommendations

Consider calculating rewards based on historical voting power.

Updates

Lead Judging Commences

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

Time-Weighted Average Logic is Not Applied to Reward Distribution in `FeeCollector`

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

Time-Weighted Average Logic is Not Applied to Reward Distribution in `FeeCollector`

Support

FAQs

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