Validator List Griefing: Unrestricted stakeOnBehalf allows User Asset freeze permanently
The stakeOnBehalf function lets anyone stake on behalf of another user without their consent, allowing an attacker to add many validators to the victim's userValidators array. When the victim later tries to withdraw or restake, the contract iterates over this bloated array and the transaction reverts due to gas limits, permanently freezing the victim's funds.
Originally disclosed on Immunefi
- Disclosed after under an hour
50433 sc high validator list griefing unrestricted stakeonbehalf allows user asset freeze permanently
Submitted on Jul 24th 2025 at 15:24:20 UTC by @farman1094 for Attackathon | Plume Network
- Report ID: #50433
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/StakingFacet.sol
- Impacts: Permanent freezing of funds
Description
Brief/Intro
The StakingFacet::stakeOnBehalf allows any user to stake on behalf of another user without requiring any form of authorization or consent. A malicious actor can grief victims by associating their accounts with a large number of validators, potentially causing the victim's funds to be locked permanently.
Vulnerability Details
The stakeOnBehalf function in the StakingFacet contract does not check if the staker has authorized the caller to stake on their behalf by any signature verification or delegation verification.
function stakeOnBehalf(uint16 validatorId, address staker) external payable returns (uint256) {
if (staker == address(0)) {
revert ZeroRecipientAddress();
}
uint256 stakeAmount = msg.value;
// Perform all common staking setup for the beneficiary
bool isNewStake = _performStakeSetup(staker, validatorId, stakeAmount);
...
}
As a result, any malicious address can use this function for any user, causing the user's userValidators array to be populated with many validators:
mapping(address => uint16[]) userValidators; // user => list of validators they've staked with
Functions like withdraw, restakeRewards, and restake later iterate over this array within _processMaturedCooldowns and _cleanupValidatorRelationships multiple times. When the victim address attempts to restake or withdraw tokens, the transaction can revert due to a denial-of-service (DoS) caused by exceeding the gas limit.
Impact Details
A malicious attacker can lock a victim’s staked funds and rewards by preventing them from calling withdraw, restakeRewards, or restake, as these functions will revert due to gas/iteration limits when iterating over an inflated userValidators array. This denial-of-service attack can result in permanent loss of access to funds, effectively freezing the victim’s assets within the staking contract.
Proof of Concept
{% stepper %} {% step %}
Step
The attacker selects any user address ("victim") who has staked significant funds in the contract. {% endstep %}
{% step %}
Step
The attacker calls the stakeOnBehalf function (which does not require any signature, approval, or explicit permission from the victim), passing the victim's address as the staker parameter and choosing a validator ID.
Relevant code:
function stakeOnBehalf(uint16 validatorId, address staker) external payable returns (uint256) {
if (staker == address(0)) {
revert ZeroRecipientAddress();
}
uint256 stakeAmount = msg.value;
// Perform all common staking setup for the beneficiary
bool isNewStake = _performStakeSetup(staker, validatorId,
....
}
function _performStakeSetup(
...
PlumeValidatorLogic.addStakerToValidator($, user, validatorId);
}
{% endstep %}
{% step %}
Step
Repeat the call many times, each time with a different validator ID. Each call appends that validator to the victim's userValidators mapping array:
mapping(address => uint16[]) userValidators; // user => list of validators they've staked with
{% endstep %}
{% step %}
Step
The victim’s userValidators array becomes bloated with many entries. When the victim later calls withdraw, restakeRewards, or restake, the contract iterates over the entire userValidators array.
Example iteration in _processMaturedCooldowns:
// StakingFacet::_processMaturedCooldowns
uint16[] memory userAssociatedValidators = $.userValidators[user];
for (uint256 i = 0; i < userAssociatedValidators.length; i++) {
uint16 validatorId = userAssociatedValidators[i];
PlumeStakingStorage.CooldownEntry memory cooldownEntry = $.userValidatorCooldowns[user][validatorId];
...
}
And again in _cleanupValidatorRelationships -> removeStakerFromAllValidators:
// PlumeValidatorLogic::removeStakerFromAllValidators
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);
}
}
{% endstep %}
{% step %}
Step
With enough entries, these iterations hit gas limits and cause transactions to revert. As a result, the victim is unable to withdraw or restake their funds. {% endstep %}
{% step %}
Step
The victim cannot recover or restake their funds, resulting in a permanent denial-of-service unless the contract logic is fixed. {% endstep %} {% endstepper %}
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 stakeOnBehalf function lacks any authorisation check, allowing anyone to modify another user's validator list, which is later iterated over in withdrawal and restaking functions without a bound.
Impact
The victim's staked funds and rewards are permanently frozen because they cannot call withdraw, restakeRewards, or restake without the transaction reverting due to gas limits.
What the attacker needed
Victim has staked funds; attacker can call stakeOnBehalf repeatedly
How it was found
- The attacker selects a victim address that has staked significant funds.
- The attacker calls stakeOnBehalf with the victim's address as the staker parameter and a chosen validator ID.
- The attacker repeats the call many times with different validator IDs, each time appending to the victim's userValidators array.
- The victim's userValidators array becomes bloated, and when the victim calls withdraw, restakeRewards, or restake, the contract iterates over the entire array.
- With enough entries, the iterations hit gas limits and the transactions revert, preventing the victim from withdrawing or restaking.
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.
A staking contract lets you add validators to someone else's account without asking them. If an attacker adds lots of validators to your account, the contract has to loop through all of them when you try to take your money out. That loop uses too much gas (the fee for computation), so your withdrawal always fails and your money is stuck.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.