Malicious validators can flood stake/unstake requests to DoS confirmChange preventing other validators from claiming their collateral
Malicious validators can flood stake and unstake requests with tiny amounts, causing the confirmChange loop to run out of gas during checkpoint submission. This prevents other validators from claiming their collateral after the subnet is bootstrapped.
kodyvim Follow with hecker_trieu_tien
Originally disclosed on Code4rena
Submitted by kodyvim, also found by hecker_trieu_tien
Subnets using permissionMode.collateral uses staked collateral to determine validators power. Validators can stake and unstake their collateral.
When a subnet gets bootstrapped (i.e. reached the minActivationCollateral to activate the subnet) validators unstaking requires the request to be recorded which would later be confirmed by submission of checkpoint.
function unstake(uint256 amount) external nonReentrant whenNotPaused notKilled {
...snipped for brevity..
@> if (!s.bootstrapped) {
LibStaking.withdrawWithConfirm(msg.sender, amount);
s.collateralSource.transferFunds(payable(msg.sender), amount);
} else {
@> LibStaking.withdraw(msg.sender, amount);
}
}
function submitCheckpoint(
BottomUpCheckpoint calldata checkpoint,
address[] calldata signatories,
bytes[] calldata signatures
) external whenNotPaused {
...snipped for brevity...
// confirming the changes in membership in the child
@> LibStaking.confirmChange(checkpoint.nextConfigurationNumber);
// Propagate cross messages from checkpoint to other subnets
IGateway(s.ipcGatewayAddr).propagateAll();
}
https://github.com/code-423n4/2025-02-recall/blob/main/contracts/contracts/lib/LibStaking.sol#L584
function confirmChange(uint64 configurationNumber) internal {
uint64 start = changeSet.startConfigurationNumber;
@> for (uint64 i = start; i <= configurationNumber; ) {//@audit-info
StakingChange storage change = changeSet.getChange(i);
address validator = change.validator;
if (change.op == StakingOperation.SetMetadata) {
s.validatorSet.validators[validator].metadata = change.payload;
} else if (change.op == StakingOperation.SetFederatedPower) {
(bytes memory metadata, uint256 power) = abi.decode(change.payload, (bytes, uint256));
s.validatorSet.validators[validator].metadata = metadata;
s.validatorSet.confirmFederatedPower(validator, power);
} else {
uint256 amount = abi.decode(change.payload, (uint256));
address gateway = s.ipcGatewayAddr;
if (change.op == StakingOperation.Withdraw) {
s.validatorSet.confirmWithdraw(validator, amount);
s.releaseQueue.addNewRelease(validator, amount);
IGateway(gateway).releaseStake(amount);
} else if (change.op == StakingOperation.Deposit) {
s.validatorSet.confirmDeposit(validator, amount);
uint256 msgValue = s.collateralSource.makeAvailable(gateway, amount);
IGateway(gateway).addStake{value: msgValue}(amount);
} else {
revert("Unknown staking operation");
}
}
...snipped for brevity...
}
}
The issue is that malicious validators can flood stake/unstake request with as little as amount of 1 wei, causing confirmChange to revert with OOG exception during checkpoint preventing other validators from ever claiming their collateral, as no collateral would be released.
Impact
Malicious validators can locked other validators funds post bootstrapped.
Recommended mitigation steps
Consider setting a minimum stake/unstake amount making DoS operation expensive or infeasible.
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 confirmChange function iterates over all pending staking changes without a cap, so an attacker can create many cheap changes that make the loop exceed the block gas limit.
Impact
Other validators' funds could be locked after the subnet is bootstrapped because confirmChange reverts with an out-of-gas error, preventing collateral release.
What the attacker needed
Subnet uses permissionMode.collateral; subnet is bootstrapped; attacker is a validator
The fix
A minimum stake or unstake amount should be enforced to make the denial-of-service attack expensive or infeasible.
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 subnet is a smaller blockchain that relies on validators who lock up money (collateral) to participate. When a validator wants their money back, they request a withdrawal, and later a checkpoint confirms it. Here, an attacker can make many tiny requests so that the confirmation step runs out of gas and fails, blocking everyone else's withdrawals.
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.