60069 sc high incorrect claimable period calculation leading to attacker keep claiming even after exiting the delegation
Description
Brief / Intro
1
Vulnerability detail β off-by-one when endPeriod equals nextClaimablePeriod
if (
endPeriod != type(uint32).max &&
endPeriod < currentValidatorPeriod &&
endPeriod > nextClaimablePeriod // β WRONG: Should be >=
) {
return (nextClaimablePeriod, endPeriod);
}
// If above check fails, falls through to:
if (nextClaimablePeriod < currentValidatorPeriod) {
return (nextClaimablePeriod, completedPeriods); // β Returns too many periods
}// Check 1: endPeriod > nextClaimablePeriod
if (10 > 10) // FALSE - skip
// Falls through to Check 2: nextClaimablePeriod < currentValidatorPeriod
if (10 < 13) // TRUE
return (10, 12) // β WRONG: Returns periods 10, 11, 12// Check 1: endPeriod >= nextClaimablePeriod
if (10 >= 10) // TRUE
return (10, 10) // β
Only period 102
Vulnerability detail β missing check when nextClaimablePeriod > endPeriod
if (
endPeriod != type(uint32).max && // -> true
endPeriod < currentValidatorPeriod && // -> true
endPeriod > nextClaimablePeriod // -> false
) {
return (nextClaimablePeriod, endPeriod);
}
if (nextClaimablePeriod < currentValidatorPeriod) {
return (nextClaimablePeriod, completedPeriods); // -> claim from nextClaimablePeriod to completedPeriods.
}// Check 1
if (10 != max32 && 10 < 16 && 10 > 11) // FALSE - skip
// Falls through to Check 2: nextClaimablePeriod < currentValidatorPeriod
if (11 < 16) // TRUE
return (11, 15) // β WRONG: Returns periods 11..15Impact Details
References
Proof of Concept
Suggested fix (summary)
Previous60049 sc high double effective stake decrement locks delegators unstake reverts due to duplicate effectivestake decrements in exit flowNext60079 sc low critical historical state corruption via stale checkpoints leads to permanent loss of future yield
Was this helpful?