Unstaking partially will extend the cooldown time for previously unstaked amount too
The staking contract's partial unstake function resets the cooldown timer for all previously unstaked tokens, so users must wait longer than intended to withdraw their funds. An attacker cannot steal funds, but users suffer extended lockup and lost opportunity.
- Disclosed after under an hour
50922 sc low unstaking partially will extend the cooldown time for previously unstaked amount too
Submitted on Jul 29th 2025 at 17:33:27 UTC by @WinSec for Attackathon | Plume Network
- Report ID: #50922
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/StakingFacet.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The unstaking mechanism contains a flaw where partial unstaking operations reset the cooldown timer for all previously cooling tokens, forcing users to wait additional time beyond the intended cooldown period. This violates the expected behavior of the cooldown system and potentially prevents users from accessing their funds when legitimately expected.
Vulnerability Details
When user calls Unstake() it internally calls and processes cooldown logic and updates the cooldown end time after which user can withdraw the unstaked amount.
Relevant snippets:
function _unstake(uint16 validatorId, uint256 amount) internal returns (uint256 amountToUnstake) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
********************SNIP******************
// Process cooldown logic and cleanup
uint256 newCooldownEndTimestamp = _processCooldownLogic(msg.sender, validatorId, amount); <@
_handlePostUnstakeCleanup(msg.sender, validatorId);
emit CooldownStarted(msg.sender, validatorId, amount, newCooldownEndTimestamp);
return amount;
}
function _processCooldownLogic(
address user,
uint16 validatorId,
uint256 amount
) internal returns (uint256 newCooldownEndTime) {
********************SNIP******************
newCooldownEndTime = block.timestamp + $.cooldownInterval;//@audit whenever the cooldown is updated the cooldown end time is updated.
********************SNIP******************
_updateCoolingAmounts(user, validatorId, amount);
finalNewCooledAmountForSlot = currentCooledAmountInSlot + amount;
}
********************SNIP******************
cooldownEntrySlot.cooldownEndTime = newCooldownEndTime; //@audit the cooldown time is updated
return newCooldownEndTime;
}
When a user unstakes multiple times partially:
- First unstake: Sets
cooldownEndTime = block.timestamp + cooldownInterval - Second unstake: RESETS
cooldownEndTime = block.timestamp + cooldownInterval(ignoring previous timeline)
This means previously cooling tokens lose their accumulated cooldown progress and must restart the entire cooldown period.
Expected execution should be:
- User unstakes 100 tokens → available after 7 days
- User unstakes 50 more tokens after 5 days → original 100 available in 2 more days, new 50 available in 7 more days
Current code executes:
- User unstakes 100 tokens → available after 7 days
- User unstakes 50 more tokens after 5 days → ALL 150 tokens now available in 7 more days (original 100 lost 5 days of progress)
Impact Details
- Extended Capital Lockup: Users experience longer-than-intended fund lockup periods
- Lost Opportunity Costs: Users cannot access funds for DeFi strategies, arbitrage, or emergency needs
References
plume/src/facets/StakingFacet.sol - _processCooldownLogic function
Proof of Concept
{% stepper %} {% step %}
Initial Setup
Alice stakes 1000 PLUME tokens to Validator A
Current timestamp: Day 0
Cooldown interval: 7 days {% endstep %}
{% step %}
Step 1: First Unstake (Day 0)
Alice unstakes 300 PLUME.
System creates cooldown entry:
- amount = 300
- cooldownEndTime = Day 0 + 7 days = Day 7
Alice expects to withdraw 300 PLUME on Day 7. {% endstep %}
{% step %}
Step 2: Time Passes (Day 5)
5 days pass (now Day 5).
Alice's 300 PLUME should be withdrawable in 2 more days (Day 7). Alice decides she needs more liquidity. {% endstep %}
{% step %}
Step 3: Second Unstake (Bug Trigger, Day 5)
Alice unstakes another 200 PLUME.
BUG: System recalculates cooldown:
- New cooldownEndTime = Day 5 + 7 days = Day 12
- Total cooling amount: 300 + 200 = 500 PLUME
Impact: Original 300 PLUME that should be available on Day 7 now locked until Day 12. {% endstep %}
{% step %}
Step 4: Attempted Withdrawal (Day 7) and Further Exploitation
Alice tries to withdraw 300 PLUME on Day 7 — transaction fails (funds still in cooldown).
Alice must wait until Day 12 for ALL 500 PLUME.
If Alice unstakes again on Day 10, cooldown resets to Day 17, further extending lockup. {% endstep %} {% endstepper %}
If you want, I can suggest specific code fixes or a patch approach to make cooldown entries preserve previous progress (for example: set per-entry cooldown end times instead of overwriting a shared slot, or set newEntry.cooldownEndTime = max(existingEndTime, block.timestamp + cooldownInterval)).
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
Likely the cooldown end time is stored in a single shared slot and overwritten on each unstake instead of being tracked per unstake entry.
Impact
Users experience longer-than-intended fund lockup periods and cannot access funds for DeFi strategies, arbitrage, or emergency needs.
What the attacker needed
User has staked tokens; user unstakes partially more than once
The fix
The cooldown should preserve previous progress, for example by setting per-entry cooldown end times or using the maximum of the existing end time and the new end time.
How it was found
- Alice stakes 1000 PLUME tokens to Validator A on Day 0 with a 7-day cooldown.
- On Day 0 Alice unstakes 300 PLUME, creating a cooldown entry ending on Day 7.
- On Day 5 Alice unstakes another 200 PLUME.
- The contract sets a new cooldown end time of Day 12 for the total 500 PLUME, resetting the original 300 PLUME's cooldown.
- On Day 7 Alice tries to withdraw the original 300 PLUME but the transaction fails because the cooldown now ends on Day 12.
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 tokens, the contract makes you wait a set time (a cooldown) before you can withdraw them. This report shows that if you unstake a second time, the contract restarts the waiting period for the first batch too, so you wait longer than you should. It is a logic mistake, not a way to steal money.
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.