DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: high
Invalid

Unauthorized Access via distributePoints()

Summary

The distributePoints() function is called indirectly through the checkDistribution modifier on various functions, including setPointsPerEpoch and claimPoints. This function updates the pointsPerToken and totalPoints based on the amount of time that has passed since the last distribution.

Vulnerability Details

  • Manipulation of pointsPerToken: The pointsPerToken variable is updated based on the duration since the last distribution and the total staked tokens. If a malicious actor could manipulate this function's behavior, they could potentially issue excessive points to themselves or others, leading to unauthorized rewards.

Impact

If an attacker can manipulate the point distribution

Tools Used

Recommendations

function distributePoints() public onlyOwner {
if (block.timestamp < lastDistribution + EPOCH_DURATION) {
return;
}
if (totalStaked == 0) {
return;
}
uint256 weeksPending = (block.timestamp - lastDistribution) / EPOCH_DURATION;
pointsPerToken =
pointsPerToken.add(weeksPending * (pointsPerEpoch.mul(PRECISION_18).div(totalStaked)));
totalPoints = totalPoints.add(pointsPerEpoch * weeksPending);
lastDistribution = lastDistribution + (weeksPending * 1 weeks);
emit PointsDistributed(pointsPerEpoch, pointsPerToken);
}

OR

Change the visibility of the distributePoints() function from public to internal or use another access control mechanism to ensure it can only be called under appropriate conditions, such as through an authorized function or by specific roles.

function distributePoints() internal {
if (block.timestamp < lastDistribution + EPOCH_DURATION) {
return;
}
if (totalStaked == 0) {
return;
}
uint256 weeksPending = (block.timestamp - lastDistribution) / EPOCH_DURATION;
pointsPerToken =
pointsPerToken.add(weeksPending * (pointsPerEpoch.mul(PRECISION_18).div(totalStaked)));
totalPoints = totalPoints.add(pointsPerEpoch * weeksPending);
lastDistribution = lastDistribution + (weeksPending * 1 weeks);
emit PointsDistributed(pointsPerEpoch, pointsPerToken);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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