59358 sc high off by one error in reward claim logic allows delegators to steal vtho for periods after delegation ended
Description
Brief / Intro
Vulnerability Details
function _claimableDelegationPeriods(
StargateStorage storage $,
uint256 _tokenId,
uint256 _delegationId
) internal view returns (uint32 firstClaimablePeriod, uint32 lastClaimablePeriod) {
// ... [code to calculate nextClaimablePeriod] ...
// Attempt to clamp to endPeriod
if (
endPeriod != type(uint32).max &&
endPeriod < currentValidatorPeriod &&
endPeriod > nextClaimablePeriod // BUG: Should be >=
) {
return (nextClaimablePeriod, endPeriod);
}
// Falls through when endPeriod == nextClaimablePeriod
if (nextClaimablePeriod < currentValidatorPeriod) {
return (nextClaimablePeriod, completedPeriods); // Returns beyond endPeriod!
}
// ...
}Impact Details
References
Proof of Concept
Prerequisites
Running the Proof of Concept
Full PoC (test file)
Recommended Fix
Notes
Previous59316 sc high off by one unlocks infinite vtho reward drain from ghost stakesNext59361 sc high off by one in claimabledelegationperiods allows claimrewards to pay for periods after delegation end over claim theft of unclaimed yield
Was this helpful?