_canRecoverFromCooldown is inconsistent when slash and cooldown maturity occur in the same block
The staking contract's cooldown recovery check uses a strict less-than comparison between the cooldown end time and the validator's slash timestamp. When a cooldown matures in the same block as a slash, users whose withdrawal is processed after the slash are permanently denied recovery of their stake, while those processed before it succeed.
- Disclosed after under an hour
52803 sc high canrecoverfromcooldown is inconsistent when slash and cooldown maturity occur in the same block
Submitted on Aug 13th 2025 at 09:38:07 UTC by @Paludo0x for Attackathon | Plume Network
- Report ID: #52803
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/StakingFacet.sol
- Impacts:
- Theft of unclaimed yield
Description
Vulnerability Details
The StakingFacet::_canRecoverFromCooldown() function determines if a user can recover their stake after a cooldown, with special handling when the validator has been slashed:
{% code title="vulnerable snippet" %}
if ($.validators[validatorId].slashed) {
// Validator is slashed - check if cooldown ended BEFORE the slash
uint256 slashTs = $.validators[validatorId].slashedAtTimestamp;
return (cooldownEntry.cooldownEndTime < slashTs && block.timestamp >= cooldownEntry.cooldownEndTime);
{% endcode %}
The condition cooldownEntry.cooldownEndTime < slashTs introduces a strict inequality.
This means that when both events (cooldown maturity and slashing) happen in the same block, the withdrawing transaction that is processed before slashing is approved, while the one that goes after is rejected.
Impact Details
- Yield loss for any user whose cooldown maturity happens in the same block as the slash, but whose transaction is processed after the slash.
- Inconsistent behavior: two users in identical cooldown states may get different results purely due to ordering in the same block.
The function _canRecoverFromCooldown is used by _processMaturedCooldowns, which is invoked by:
withdraw()restake()restakeRewards()
These functions calculate matured cooldowns and allow withdrawing or restaking funds. The bug causes some identical cooldowns to be rejected depending on ordering within the block.
Recommended fix
Use <= instead of < in the slash branch to ensure users whose cooldown matures exactly at the slash timestamp are treated consistently:
{% code title="fix suggestion" %}
return (cooldownEntry.cooldownEndTime <= slashTs && block.timestamp >= cooldownEntry.cooldownEndTime);
{% endcode %}
Proof of Concept
{% stepper %} {% step %}
Step
User A’s transaction is processed before the slash → their cooldown maturity check passes and they can recover. {% endstep %}
{% step %}
Step
Slash of the validator is approved. {% endstep %}
{% step %}
Step
User B’s transaction is processed after the slash → their cooldown maturity check fails and they permanently lose the ability to recover that cooldown. {% endstep %} {% endstepper %}
<details> <summary>Relevant function snippet</summary>function _canRecoverFromCooldown(
address user,
uint16 validatorId,
PlumeStakingStorage.CooldownEntry memory cooldownEntry
) internal view returns (bool canRecover) {
...
if ($.validators[validatorId].slashed) {
// Validator is slashed - check if cooldown ended BEFORE the slash
uint256 slashTs = $.validators[validatorId].slashedAtTimestamp;
return (cooldownEntry.cooldownEndTime < slashTs && block.timestamp >= cooldownEntry.cooldownEndTime);
} else {
...
}
}
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The slash branch uses a strict inequality (cooldownEndTime < slashTs) instead of a non-strict one, so a cooldown maturing exactly at the slash timestamp is treated as not matured.
Impact
Users whose cooldown matures in the same block as a slash but whose transaction is processed afterwards could permanently lose the ability to recover that cooldown, resulting in yield loss.
What the attacker needed
User has a matured cooldown; validator is slashed in the same block; user's tx processed after the slash
The fix
The comparison should use <= instead of < so that cooldowns maturing exactly at the slash timestamp are treated consistently.
How it was found
- User A's transaction is processed before the slash, so their cooldown maturity check passes and they can recover.
- The validator is slashed.
- User B's transaction is processed after the slash, so their cooldown maturity check fails and they permanently lose the ability to recover that cooldown.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you unstake, your funds sit in a cooldown period before you can take them out. If the validator you staked with gets punished (slashed) during that period, the contract checks whether your cooldown finished before the punishment. The check uses a strict 'before' comparison, so if both happen at the same moment, the result depends on which transaction the blockchain processes first, and some users lose access to their funds.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.