Core Contracts

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

The `BaseGauge::_getBaseWeight` function returns incorrect or wrong base weight

Summary

The BaseGauge::_getBaseWeight function incorrectly retrieves the gauge weight for the contract's address address(this) instead of the user's address account. This results in an incorrect base weight value in BaseGauge::getUserWeight, which is directly passed to the BaseGauge::_applyBoost` function and affect it. As a consequence, the boosted weight calculation for users is incorrect, potentially leading to unfair rewards or penalties.

Vulnerability Details

The vulnerability lies in the _getBaseWeight function:

function _getBaseWeight(address account) internal view virtual returns (uint256) {
return IGaugeController(controller).getGaugeWeight(address(this));
}

Here, getGaugeWeight is called with address(this) (the contract's address) instead of the user's address account. This means that the base weight returned is the weight of the contract itself, not the user's weight. This incorrect base weight is then passed to _applyBoost in the getUserWeight function:

function getUserWeight(address account) public view virtual returns (uint256) {
uint256 baseWeight = _getBaseWeight(account);
return _applyBoost(account, baseWeight);
}

As a result, the boosted weight calculation is based on an incorrect base weight, leading to inaccurate results.

Impact

  • The incorrect base weight affects the calculation of boosted weights, which are likely used for reward distribution.

  • Users may receive incorrect rewards due to the miscalculation of their boosted weights.

  • The issue is easily exploitable, as it directly affects the calculation of user weights and can be triggered by any user interacting with the protocol.

Tools Used

Manual code review

Recommendations

Update the _getBaseWeight function to retrieve the gauge weight for the user's address account instead of the contract's address address(this). The corrected function should look like this:

function _getBaseWeight(address account) internal view virtual returns (uint256) {
- return IGaugeController(controller).getGaugeWeight(address(this));
+ return IGaugeController(controller).getGaugeWeight(account);
}
Updates

Lead Judging Commences

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

BaseGauge._getBaseWeight ignores account parameter and returns gauge's total weight, allowing users to claim rewards from gauges they never voted for or staked in

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

BaseGauge._getBaseWeight ignores account parameter and returns gauge's total weight, allowing users to claim rewards from gauges they never voted for or staked in

Support

FAQs

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