50350 sc high stakingfacet stakeonbehalf allows to prevent withdraws

  • Submitted on Jul 23rd 2025 at 23:00:56 UTC by @max10afternoon for Attackathon | Plume Network

  • Report ID: #50350

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/StakingFacet.sol

  • Impact: Temporary freezing of funds for at least 24 hours

Description

Brief/Intro

It is possible to halt withdraws for a particular user by gifting them plume via the stakeOnBehalf function.

Vulnerability Details

The withdraw function internally calls _cleanupValidatorRelationships which calls removeStakerFromAllValidators in the PlumeValidatorLogic library:

function removeStakerFromAllValidators(PlumeStakingStorage.Layout storage $, address staker) internal {
    // Make a copy to avoid iteration issues when removeStakerFromValidator is called
    uint16[] memory userAssociatedValidators = $.userValidators[staker];

    for (uint256 i = 0; i < userAssociatedValidators.length; i++) {
        uint16 validatorId = userAssociatedValidators[i];
        if ($.userValidatorStakes[staker][validatorId].staked == 0) {
            removeStakerFromValidator($, staker, validatorId);
        }
    }
}

This function iterates over each registered validator for a user.

The stakeOnBehalf function allows any user to stake on behalf of another user, registering new validators to that user's list if not already present:

Therefore, a malicious user can gift the minimum amount of PLUME necessary to register many validators in a victim's userValidators array, increasing the gas cost of the victim's withdraw transaction. This can push the gas cost beyond the block gas limit (unbounded gas consumption). Depending on PLUME and chain gas parameters, this can be achieved with relatively low cost for the attacker.

Impact Details

A malicious user can prevent withdraws for a target user by inflating that user's registered validators list, effectively freezing assets in the contract until the contract is updated.

Proof of Concept

Step-by-Step
  • A malicious user can frontrun any withdraw call with one or multiple transactions that call stakeOnBehalf for many validators, registering them on the victim's account. This increases the iteration in removeStakerFromAllValidators and can push withdraw gas usage beyond the block limit.

Coded PoC

Place the following test in the /attackathon-plume-network/plume/test folder to reproduce gas increase caused by stakeOnBehalf. The test demonstrates that registering many validators on behalf of a user increases the gas used by withdraw.

Notes:

  • The PoC shows gas usage increase; with enough validator registrations on behalf of a victim, withdraw gas can grow large enough to be unexecutable in a block.

  • The attack is possible because stakeOnBehalf can modify a victim's userValidators list without the victim's consent.

Was this helpful?