Skip to content
Business logic Audit finding Intermediate

StakingFacet.unstake(uint16 validatorId, uint256 amount) can be abused to bypass $.minStakeAmount

The unstake function does not check that the remaining staked amount is at least the minimum stake amount, allowing a user to leave a tiny amount staked. An attacker can manipulate the total staked value to cause subsequent stake operations to fail, effectively denying service to legitimate stakers.

Plume Network

Originally disclosed on Immunefi

52113 sc low stakingfacet unstake uint16 validatorid uint256 amount can be abused to bypass minstakeamount

Description

The amount parameter in unstake(uint16 validatorId, uint256 amount) represents the amount of PLUME to unstake.

In the current implementation, unstake does not check that the remaining staked PLUME for the user/validator is greater than $.minStakeAmount before returning. A malicious user can exploit this to leave a tiny amount (e.g., 1 wei) staked and thereby bypass the $.minStakeAmount restriction.

Vulnerability details

{% stepper %} {% step %}

Overview of relevant logic (summary)

  • $.minStakeAmount is enforced by StakingFacet.stake and StakingFacet.restake via _validateStaking called in _performStakeSetup.
  • _unstake validates the validator and amount, updates rewards, updates stake amounts, processes cooldown, and performs cleanup — but it does not validate that the remaining stake >= $.minStakeAmount. {% endstep %}

{% step %}

Key code excerpt (from _unstake)

Solidity
366     function _unstake(uint16 validatorId, uint256 amount) internal returns (uint256 amountToUnstake) {
367         PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
368 
369         // Validate unstaking conditions
370         _validateValidatorForUnstaking(validatorId);
371         if (amount == 0) {
372             revert InvalidAmount(amount);
373         }
374         if ($s.userValidatorStakes[msg.sender][validatorId].staked < amount) {
375             revert InsufficientFunds($s.userValidatorStakes[msg.sender][validatorId].staked, amount);
376         }
377 
378         // Update rewards before balance changes
379         PlumeRewardLogic.updateRewardsForValidator($s, msg.sender, validatorId);
380 
381         // Update stake amounts
382         _updateUnstakeAmounts(msg.sender, validatorId, amount);
383 
384         // Process cooldown logic and cleanup
385         uint256 newCooldownEndTimestamp = _processCooldownLogic(msg.sender, validatorId, amount);
386         _handlePostUnstakeCleanup(msg.sender, validatorId);
387 
388         emit CooldownStarted(msg.sender, validatorId, amount, newCooldownEndTimestamp);
389         return amount;
390     }

This flow lacks a check that the post-unstake staked amount is >= $.minStakeAmount. {% endstep %}

{% step %}

How the missing check can be abused

A malicious staker can:

  1. Stake a large amount (e.g., 1000e18 PLUME) on a validator.
  2. Call unstake(validatorId, 1000e18 - 1) (in the same transaction if desired) leaving only 1 wei staked.
  3. The remaining stake (1 wei) is less than $.minStakeAmount, but no check prevents this in _unstake.

This bypasses $.minStakeAmount which is otherwise enforced during stake/restake operations. {% endstep %} {% endstepper %}

Impact

By bypassing $.minStakeAmount, an attacker can manipulate $.totalStaked to be extremely small (e.g., 1). This can be used to cause subsequent stake operations to fail due to validator percentage checks, effectively DoS-ing legitimate stakers.

Example scenario provided in the report:

{% stepper %} {% step %}

  1. $.maxValidatorPercentage is set — capped at 10_000 by setMaxValidatorPercentage. Assume it is set to 5_000.
  2. Alice stakes 1000e18 PLUME on validator X, then calls unstake(validatorX, 1000e18 - 1) within the same transaction, leaving $.totalStaked = 1. {% endstep %}

{% step %} 3. Bob attempts to stake 500e18 PLUME. During _performStakeSetup, _validateValidatorPercentage runs. Because previousTotalStaked will be computed relative to the small $.totalStaked, the validator percentage calculation yields a very large percentage and the txn will revert.

Relevant code:

Solidity
147     function _validateValidatorPercentage(
148         uint16 validatorId, uint256 stakeAmount
149     ) internal view {
150         PlumeStakingStorage.Layout storage $ = PlumeStakingStorage.layout();
151 
152         uint256 previousTotalStaked = $.totalStaked - stakeAmount;
153 
154         // Check if exceeding validator percentage limit
155         if (previousTotalStaked > 0 && $.maxValidatorPercentage > 0) {
156             uint256 newDelegatedAmount = $.validators[validatorId].delegatedAmount;
157             uint256 validatorPercentage = (newDelegatedAmount * 10_000) / $.totalStaked;
158             if (validatorPercentage > $.maxValidatorPercentage) {
159                 revert ValidatorPercentageExceeded();
160             }
161         }
162     }

Result: Bob's stake will revert due to the manipulated $.totalStaked. {% endstep %} {% endstepper %}

Proof of Concept

(Described in the report — repeated here succinctly)

  1. Alice stakes 1000e18 PLUME for validatorIdX.
  2. In the same transaction, she calls unstake(validatorIdX, 1000e18 - 1), leaving 1 wei staked.
  3. $.totalStaked becomes 1.
  4. Bob attempts to stake 500e18 PLUME; _validateValidatorPercentage computes validator percentage ~= 9999 and reverts because it exceeds $.maxValidatorPercentage (e.g., 5000). This results in a DoS for new stakers.

Suggested mitigation (note: not prescriptive code)

(Left to maintainers to implement) The unstake flow should validate that after the unstake operation, the remaining staked amount for that user-validator pair is either zero (if allowed) or >= $.minStakeAmount. If the protocol intends that the minimum must always be respected, enforce the same $.minStakeAmount check in _unstake (or in _updateUnstakeAmounts / _handlePostUnstakeCleanup) before completing state changes.

References

(End of report)

The original report as published on Immunefi. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Plume Network is a staking protocol whose staking logic lives in a facet contract, StakingFacet.sol, in the plume/src/facets/ directory of the attackathon repository. The facet exposes stake, restake and unstake operations over PLUME, keyed by a uint16 validatorId. The function at the centre of this report is:

Solidity
unstake(uint16 validatorId, uint256 amount)

where amount is the quantity of PLUME to unstake. The protocol enforces a minimum stake, $.minStakeAmount, and a maximum share of total stake that a single validator may hold, $.maxValidatorPercentage. The minimum is applied when a user stakes or restakes. The maximum percentage is checked when a user stakes. The report argues that the unstake path skips the minimum check, and that this omission can be chained into a denial of service against other stakers.

Setup

The report does not describe any accounts, tooling, versions or deployment used to reproduce the issue. It is a code review finding against the linked StakingFacet.sol, with the reasoning carried out against the source and a described scenario rather than a recorded transaction. The preconditions that matter are configuration and state:

  1. $.minStakeAmount is set to a non-zero value, so that a stake below it is normally rejected.
  2. $.maxValidatorPercentage is set, capped at 10_000 by setMaxValidatorPercentage. The report's example assumes 5_000.
  3. A user holds enough PLUME to stake a large amount on a validator.

Finding it

The researcher compared the paths that write stake state. $.minStakeAmount is enforced by StakingFacet.stake and StakingFacet.restake through _validateStaking, which is called from _performStakeSetup. The unstake path, _unstake, validates the validator and the amount, updates rewards, updates stake amounts, processes cooldown and performs cleanup, but never checks that the remaining stake is at least $.minStakeAmount. That asymmetry is the bug: a user can enter staking only above the minimum, but can leave staking with an arbitrarily small residue still counted as stake.

The relevant excerpt from _unstake is:

Solidity
366     function _unstake(uint16 validatorId, uint256 amount) internal returns (uint256 amountToUnstake) {
367         PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
368
369         // Validate unstaking conditions
370         _validateValidatorForUnstaking(validatorId);
371         if (amount == 0) {
372             revert InvalidAmount(amount);
373         }
374         if ($s.userValidatorStakes[msg.sender][validatorId].staked < amount) {
375             revert InsufficientFunds($s.userValidatorStakes[msg.sender][validatorId].staked, amount);
376         }
377
378         // Update rewards before balance changes
379         PlumeRewardLogic.updateRewardsForValidator($s, msg.sender, validatorId);
380
381         // Update stake amounts
382         _updateUnstakeAmounts(msg.sender, validatorId, amount);
383
384         // Process cooldown logic and cleanup
385         uint256 newCooldownEndTimestamp = _processCooldownLogic(msg.sender, validatorId, amount);
386         _handlePostUnstakeCleanup(msg.sender, validatorId);
387
388         emit CooldownStarted(msg.sender, validatorId, amount, newCooldownEndTimestamp);
389         return amount;
390     }

The only amount checks are that amount is non-zero and that it does not exceed the caller's staked balance for that validator. Nothing constrains what is left behind.

Exploitation

Step 1: stake a large amount

A malicious staker stakes a large amount, for example 1000e18 PLUME, on a validator. This passes the normal _validateStaking check because it is far above $.minStakeAmount.

Step 2: unstake all but one wei

The attacker calls:

Solidity
unstake(validatorId, 1000e18 - 1)

leaving only 1 wei staked. The report notes this can be done in the same transaction as the stake if desired. The call passes _validateValidatorForUnstaking, passes the non-zero check, and passes the balance check because the requested amount is below the staked balance. _updateUnstakeAmounts reduces the stake, cooldown is processed, cleanup runs, and CooldownStarted is emitted. The remaining 1 wei is below $.minStakeAmount, but _unstake never looks at the remainder, so nothing reverts.

Step 3: shrink total staked and block other stakers

The impact section walks through a concrete scenario. $.maxValidatorPercentage is capped at 10_000 by setMaxValidatorPercentage; assume it is set to 5_000. Alice stakes 1000e18 PLUME on validator X and, within the same transaction, calls unstake(validatorX, 1000e18 - 1), leaving $.totalStaked equal to 1. Bob then attempts to stake 500e18 PLUME. During _performStakeSetup, _validateValidatorPercentage runs:

Solidity
147     function _validateValidatorPercentage(
148         uint16 validatorId, uint256 stakeAmount
149     ) internal view {
150         PlumeStakingStorage.Layout storage $ = PlumeStakingStorage.layout();
151
152         uint256 previousTotalStaked = $.totalStaked - stakeAmount;
153
154         // Check if exceeding validator percentage limit
155         if (previousTotalStaked > 0 && $.maxValidatorPercentage > 0) {
156             uint256 newDelegatedAmount = $.validators[validatorId].delegatedAmount;
157             uint256 validatorPercentage = (newDelegatedAmount * 10_000) / $.totalStaked;
158             if (validatorPercentage > $.maxValidatorPercentage) {
159                 revert ValidatorPercentageExceeded();
160             }
161         }
162     }

Because previousTotalStaked is computed relative to the manipulated, tiny $.totalStaked, the validator percentage comes out very large and the transaction reverts with ValidatorPercentageExceeded. In the proof of concept summary the report puts the computed percentage at roughly 9999 against a limit of 5000, so Bob's stake fails.

Root cause

The minimum stake invariant is enforced on entry to staking but not on exit. stake and restake route through _validateStaking via _performStakeSetup, while _unstake performs its own validation and never compares the post-unstake balance with $.minStakeAmount. Because $.totalStaked is derived from the sum of user stakes, leaving a 1 wei residue also drives the global total down to 1, and _validateValidatorPercentage divides by that total. The percentage check therefore becomes trivially easy to trip for anyone else staking on the same validator. The existing defences, the non-zero amount check and the insufficient-funds check, both concern the amount being removed, not the amount that remains, so neither stops the abuse.

Impact

By bypassing $.minStakeAmount, an attacker can manipulate $.totalStaked to be extremely small, for example 1. This can cause subsequent stake operations to fail through the validator percentage check, effectively denying service to legitimate stakers. The report lists protocol insolvency as the impact and rates the severity low. The denial depends on $.maxValidatorPercentage being set to a non-zero value and on the attacker being able to drive the total stake low enough that the percentage calculation for another staker exceeds the cap; the report's example uses 5_000 as the cap and a 500e18 stake by the victim.

Fix

The report leaves implementation to the maintainers and offers no prescriptive code. It states that the unstake flow should validate that, after the unstake, the remaining staked amount for that user-validator pair is either zero (if that is allowed) or at least $.minStakeAmount. If the protocol intends the minimum to always hold, the same $.minStakeAmount check should be enforced in _unstake, or in _updateUnstakeAmounts or _handlePostUnstakeCleanup, before state changes complete.

Variants to test

  1. Partial unstake to exactly the minimum: check whether a remainder equal to $.minStakeAmount is accepted and whether the boundary is inclusive or exclusive. A positive result is a remainder below the minimum that still succeeds.
  2. Unstake to zero versus a residue: if the protocol allows a full exit, confirm that the zero case is handled separately from the residue case, so a fix does not lock users into a minimum they cannot withdraw.
  3. Multiple validators: leave a 1 wei residue on several validators and observe whether $.totalStaked and the per-validator delegated amounts diverge in a way that affects percentage checks on other validators.
  4. Restake after a residue: try to restake from the 1 wei position and see whether _validateStaking rejects it, which would confirm the entry and exit rules are inconsistent.
  5. Cooldown interaction: check whether the cooldown started by the residue-producing unstake can be used to time a second unstake or a restake around the percentage check.

Hunting notes

This kind of bug hides where a protocol enforces an invariant on one direction of a state transition and forgets the reverse. Look for a validation helper called from deposit or entry functions and then grep every exit, withdraw or unstake path for the same helper. A quick signal is a global total that is recomputed from user balances and then used as a divisor or denominator in a limit check: if any path can shrink the total without a floor, the limit becomes attacker-controlled. During review, compare the checks in _unstake with those in _performStakeSetup and note which invariants are missing on the way out. The report establishes impact by walking a concrete two-actor scenario, attacker and victim, through the exact arithmetic of the percentage check, which is what turns a missing validation into an accepted low-severity denial of service.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

Plume Network is a system where people lock up a digital currency called PLUME with a validator (a kind of operator that helps run the network) and earn rewards for doing so. The rules of this system live in a piece of code called a smart contract. A smart contract is a program that runs on a blockchain: once it is deployed, it runs exactly as written, and anyone can call its functions.

The contract in question, StakingFacet.sol, has a rule that says you must keep at least a certain minimum amount staked, called $.minStakeAmount. The contract checks this minimum when you put money in (stake or restake). The report says it does not check the minimum when you take money out (unstake). So a user can put in a large amount, then take almost all of it back out, leaving a tiny residue such as 1 wei (the smallest unit of the currency) still counted as staked.

That tiny residue matters because the contract also keeps a running total of everything staked, $.totalStaked, and uses that total in a percentage check when other people try to stake. If the total is driven down to 1, the percentage calculation for the next person who stakes comes out enormous, the check fails, and their stake is rejected. In other words, one user can make another user's stake on that validator fail. The report rates this as a low-severity denial of service.

Context

The staking logic lives in a facet contract. A facet is a module of a larger contract system: the main contract forwards calls to smaller pieces, each handling one area of functionality. This one handles staking. It exposes three operations over PLUME, each identified by a uint16 validatorId (a small number that names which validator you are dealing with):

  • stake: put PLUME in.
  • restake: put rewards or existing stake back in.
  • unstake: take PLUME out.

The function at the centre of the report is:

Solidity
unstake(uint16 validatorId, uint256 amount)

Here amount is how much PLUME you want to take out. uint256 means a whole, non-negative number of up to 256 bits, which is how token amounts are usually stored.

Two configuration values matter throughout:

  • $.minStakeAmount: the smallest stake the protocol allows. The $ prefix is a naming convention for a storage structure that holds the contract's settings and balances.
  • $.maxValidatorPercentage: the largest share of the total stake that a single validator may hold, expressed in basis points out of 10,000 (so 5,000 means 50 per cent).

The minimum is applied when a user stakes or restakes. The maximum percentage is checked when a user stakes. The report argues that the unstake path skips the minimum check, and that this omission can be chained into a denial of service against other stakers. A denial of service (DoS) means making a service unusable for its intended users without necessarily stealing anything.

Setup

The report does not describe any accounts, tooling, versions or deployment used to reproduce the issue. It is a code review finding against the linked StakingFacet.sol: the reasoning is carried out against the source code and a described scenario, not a recorded transaction on a live network.

The preconditions that matter are configuration and state:

  1. $.minStakeAmount is set to a non-zero value, so that a stake below it is normally rejected.
  2. $.maxValidatorPercentage is set, capped at 10,000 by setMaxValidatorPercentage. The report's example assumes 5,000.
  3. A user holds enough PLUME to stake a large amount on a validator.

Finding it

The researcher compared the paths that write stake state, that is, the functions that change how much is recorded as staked. $.minStakeAmount is enforced by StakingFacet.stake and StakingFacet.restake through a helper called _validateStaking, which is called from _performStakeSetup. A helper is just a smaller function used by the main ones to avoid repeating the same checks.

The unstake path, _unstake, does several things: it validates the validator and the amount, updates rewards, updates stake amounts, processes cooldown and performs cleanup. A cooldown is a waiting period before withdrawn funds become available. But it never checks that the remaining stake is at least $.minStakeAmount.

That asymmetry is the bug: a user can enter staking only above the minimum, but can leave staking with an arbitrarily small residue still counted as stake.

The relevant excerpt from _unstake is:

Solidity
366     function _unstake(uint16 validatorId, uint256 amount) internal returns (uint256 amountToUnstake) {
367         PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
368
369         // Validate unstaking conditions
370         _validateValidatorForUnstaking(validatorId);
371         if (amount == 0) {
372             revert InvalidAmount(amount);
373         }
374         if ($s.userValidatorStakes[msg.sender][validatorId].staked < amount) {
375             revert InsufficientFunds($s.userValidatorStakes[msg.sender][validatorId].staked, amount);
376         }
377
378         // Update rewards before balance changes
379         PlumeRewardLogic.updateRewardsForValidator($s, msg.sender, validatorId);
380
381         // Update stake amounts
382         _updateUnstakeAmounts(msg.sender, validatorId, amount);
383
384         // Process cooldown logic and cleanup
385         uint256 newCooldownEndTimestamp = _processCooldownLogic(msg.sender, validatorId, amount);
386         _handlePostUnstakeCleanup(msg.sender, validatorId);
387
388         emit CooldownStarted(msg.sender, validatorId, amount, newCooldownEndTimestamp);
389         return amount;
390     }

Line by line, in plain words:

  • Line 366 declares the function. It takes a validator number and an amount, and returns how much was unstaked. internal means only other functions in the same contract can call it.
  • Line 367 loads the contract's storage, the place where all balances and settings are kept, into a variable named $s.
  • Line 370 checks that this validator is currently allowed to be unstaked from.
  • Lines 371 to 373 reject an amount of zero. revert means cancel the whole transaction and undo any changes.
  • Lines 374 to 376 reject an amount larger than what the caller has staked on that validator. msg.sender is the address of whoever called the function.
  • Line 379 updates the caller's reward accounting before balances change, so rewards are calculated on the old balance.
  • Line 382 reduces the recorded stake by the amount.
  • Line 385 starts or extends the cooldown and returns when it ends.
  • Line 386 cleans up any leftover state for this user and validator.
  • Line 388 writes an event to the blockchain log, a permanent record that the cooldown started.
  • Line 389 returns the amount.

The only amount checks are that amount is non-zero and that it does not exceed the caller's staked balance for that validator. Nothing constrains what is left behind.

Exploitation

Step 1: stake a large amount

A malicious staker stakes a large amount, for example 1000e18 PLUME, on a validator. The notation 1000e18 means 1000 followed by 18 zeros, which is how token amounts are written when the token has 18 decimal places. This passes the normal _validateStaking check because it is far above $.minStakeAmount.

Step 2: unstake all but one wei

The attacker calls:

Solidity
unstake(validatorId, 1000e18 - 1)

leaving only 1 wei staked. A wei is the smallest indivisible unit of the currency, so 1 wei is the tiniest possible residue. The report notes this can be done in the same transaction as the stake if desired. A transaction is a single bundle of actions that either all succeed or all fail together.

The call passes _validateValidatorForUnstaking, passes the non-zero check, and passes the balance check because the requested amount is below the staked balance. _updateUnstakeAmounts reduces the stake, cooldown is processed, cleanup runs, and CooldownStarted is emitted. The remaining 1 wei is below $.minStakeAmount, but _unstake never looks at the remainder, so nothing reverts.

Step 3: shrink total staked and block other stakers

The impact section walks through a concrete scenario. $.maxValidatorPercentage is capped at 10,000 by setMaxValidatorPercentage; assume it is set to 5,000. Alice stakes 1000e18 PLUME on validator X and, within the same transaction, calls unstake(validatorX, 1000e18 - 1), leaving $.totalStaked equal to 1. Bob then attempts to stake 500e18 PLUME. During _performStakeSetup, _validateValidatorPercentage runs:

Solidity
147     function _validateValidatorPercentage(
148         uint16 validatorId, uint256 stakeAmount
149     ) internal view {
150         PlumeStakingStorage.Layout storage $ = PlumeStakingStorage.layout();
151
152         uint256 previousTotalStaked = $.totalStaked - stakeAmount;
153
154         // Check if exceeding validator percentage limit
155         if (previousTotalStaked > 0 && $.maxValidatorPercentage > 0) {
156             uint256 newDelegatedAmount = $.validators[validatorId].delegatedAmount;
157             uint256 validatorPercentage = (newDelegatedAmount * 10_000) / $.totalStaked;
158             if (validatorPercentage > $.maxValidatorPercentage) {
159                 revert ValidatorPercentageExceeded();
160             }
161         }
162     }

Line by line:

  • Lines 147 to 149 declare the function. It takes a validator number and the amount being staked, and view means it only reads state, it does not change it.
  • Line 150 loads the contract's storage.
  • Line 152 computes what the total staked would have been before this new stake, by subtracting the new amount from the current total.
  • Line 155 only runs the check if that previous total is above zero and the percentage limit is enabled.
  • Line 156 reads how much is currently delegated to this validator.
  • Line 157 computes the validator's share of the total in basis points: delegated amount times 10,000, divided by the total staked.
  • Lines 158 to 160 reject the transaction if that share exceeds the configured maximum.

Because previousTotalStaked is computed relative to the manipulated, tiny $.totalStaked, the validator percentage comes out very large and the transaction reverts with ValidatorPercentageExceeded. In the proof of concept summary the report puts the computed percentage at roughly 9999 against a limit of 5000, so Bob's stake fails.

Root cause

The minimum stake invariant is enforced on entry to staking but not on exit. An invariant is a rule that is supposed to hold at all times. stake and restake route through _validateStaking via _performStakeSetup, while _unstake performs its own validation and never compares the post-unstake balance with $.minStakeAmount.

Because $.totalStaked is derived from the sum of user stakes, leaving a 1 wei residue also drives the global total down to 1, and _validateValidatorPercentage divides by that total. The percentage check therefore becomes trivially easy to trip for anyone else staking on the same validator. The existing defences, the non-zero amount check and the insufficient-funds check, both concern the amount being removed, not the amount that remains, so neither stops the abuse.

Impact

By bypassing $.minStakeAmount, an attacker can manipulate $.totalStaked to be extremely small, for example 1. This can cause subsequent stake operations to fail through the validator percentage check, effectively denying service to legitimate stakers. The report lists protocol insolvency as the impact and rates the severity low.

The denial depends on $.maxValidatorPercentage being set to a non-zero value and on the attacker being able to drive the total stake low enough that the percentage calculation for another staker exceeds the cap; the report's example uses 5,000 as the cap and a 500e18 stake by the victim.

Fix

The report leaves implementation to the maintainers and offers no prescriptive code. It states that the unstake flow should validate that, after the unstake, the remaining staked amount for that user-validator pair is either zero (if that is allowed) or at least $.minStakeAmount. If the protocol intends the minimum to always hold, the same $.minStakeAmount check should be enforced in _unstake, or in _updateUnstakeAmounts or _handlePostUnstakeCleanup, before state changes complete.

Variants to test

  1. Partial unstake to exactly the minimum: check whether a remainder equal to $.minStakeAmount is accepted and whether the boundary is inclusive or exclusive. A positive result is a remainder below the minimum that still succeeds.
  2. Unstake to zero versus a residue: if the protocol allows a full exit, confirm that the zero case is handled separately from the residue case, so a fix does not lock users into a minimum they cannot withdraw.
  3. Multiple validators: leave a 1 wei residue on several validators and observe whether $.totalStaked and the per-validator delegated amounts diverge in a way that affects percentage checks on other validators.
  4. Restake after a residue: try to restake from the 1 wei position and see whether _validateStaking rejects it, which would confirm the entry and exit rules are inconsistent.
  5. Cooldown interaction: check whether the cooldown started by the residue-producing unstake can be used to time a second unstake or a restake around the percentage check.

Hunting notes

This kind of bug hides where a protocol enforces an invariant on one direction of a state transition and forgets the reverse. Look for a validation helper called from deposit or entry functions and then search every exit, withdraw or unstake path for the same helper. A quick signal is a global total that is recomputed from user balances and then used as a divisor or denominator in a limit check: if any path can shrink the total without a floor, the limit becomes attacker-controlled. During review, compare the checks in _unstake with those in _performStakeSetup and note which invariants are missing on the way out. The report establishes impact by walking a concrete two-actor scenario, attacker and victim, through the exact arithmetic of the percentage check, which is what turns a missing validation into an accepted low-severity denial of service.

Glossary

  • Smart contract: a program deployed on a blockchain that runs exactly as written and can be called by anyone.
  • Blockchain: a shared, append-only record of transactions maintained by many computers.
  • PLUME: the digital currency used in this staking protocol.
  • Staking: locking up currency with a validator to help secure the network and earn rewards.
  • Validator: an operator that participates in running the network and to whom users delegate stake.
  • Facet: a module of a larger contract system that handles one area of functionality.
  • Function: a named block of code in a program that can be called with inputs and may return an output.
  • Parameter: an input value a function accepts.
  • uint16 / uint256: whole-number types of 16 and 256 bits respectively; uint256 is commonly used for token amounts.
  • Wei: the smallest indivisible unit of a cryptocurrency.
  • 1000e18: shorthand for 1000 followed by 18 zeros, matching a token with 18 decimal places.
  • Storage: the persistent area where a contract keeps its settings and balances.
  • msg.sender: the address of whoever called the current function.
  • revert: cancel the transaction and undo all its changes.
  • Event: a permanent log entry written to the blockchain when something happens.
  • Transaction: a bundle of actions that either all succeed or all fail together.
  • Cooldown: a waiting period before withdrawn funds become available.
  • Invariant: a rule that is supposed to hold at all times.
  • Helper function: a smaller function used by main functions to avoid repeating checks.
  • Basis points: a way of writing percentages where 10,000 equals 100 per cent, so 5,000 equals 50 per cent.
  • Denial of service (DoS): making a service unusable for its intended users without necessarily stealing anything.
  • Protocol insolvency: a state where the protocol's accounting is pushed outside what it was designed to handle.
  • Code review: reading source code to find bugs, as opposed to running attacks against a live system.
  • Severity: a rating of how serious a finding is, here low.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.