Skip to content
DoS Audit finding Intermediate

Changing the slashingHandler for NativeVaults will DoS slashing

NativeVault's slashAssets function requires the slashingHandler argument to equal the vault's stored slashStore, but the Core allowlist can be updated to a new handler, so existing NativeVaults then always revert when slashed. An attacker or admin action of changing the handler could block slashing for all previously deployed NativeVaults until they are individually upgraded or the old handler is restored.

givn Follow with sl1

Originally disclosed on Code4rena

Submitted by givn, also found by sl1

Relevant code: NativeVault::slashAssets

Description

Core’s state contains a mapping between assets and slashingHandlers - assetSlashingHandlers. Assets that are assigned a slashing handler are considered whitelisted and vaults containing this asset can be deployed.

When a slash is performed on a vault, the following function is called:

function slashAssets(
	uint256 slashPercentageWad, address slashingHandler
) external returns (uint256 transferAmount);

Inside NativeVault’s implementation of the function, the following check is performed:

if (slashingHandler != self.slashStore) revert NotSlashStore();

This check can be problematic in the case where some number of native vaults have been deployed and the assetSlashingHandlers mapping gets updated with a new slashHandler. Then, the slashAssets function will always revert.

Root Cause

Unsynchronized state update causes DoS of slashing functionality inside NativeVault.

Impact

If the slashingHandler for restaking gets changed at some point it will cause DoS of the slashing functionality for NativeVaults. It will be blocked until contracts get updated with new implementation or old slashing handler is restored.

The issue could be exacerbated if some new NativeVaults get deployed with the new slash handler. Then, reverting to the old slash handler will break the newly deployed NativeVaults, making update implementation the only option to fix this issue. But this is also troublesome because only normal Vaults can have they’re implementation updated for all deployments with one call. NativeVaults would have to be updated one by one.

Proof of Concept

Let’s suppose the following scenario:

  1. SlashHandler A is set for key Constants.DEAD_BEEF in assetSlashingHandlers.
  2. 5 NativeVaults get deployed with this slash handler.
  3. SlashHandler B is set for Constants.DEAD_BEEF.
  4. These 5 NativeVaults would not be slashable until some measures are taken - either A restored or the vault’s implementations are updated.

Both approaches to fix this issue once it has occurred have their drawbacks:

  • If after step 3, more NativeVaults are created updating the allowlist will always cause some group of native vaults to be unslashable.
  • Changing the NativeVault implementations can only be done only 1 by 1, since the default vault implementation is for normal Vault.

Suggested Mitigation

There are multiple ways to prevent this issue:

  • Function only callable by Manager to change slashStore
  • Function in Core that is callable by anyone which changes the underlying slashStore of a NativeVault if there is a difference. Allowing users to unDoS themselves.
  • Remove the check causing the revert in slashAssets and allow NativeVaults to have different slashHandlers if this is acceptable.

MiloTruck (judge) commented:

While technically valid, will need to confirm with the sponsor if slashing handlers are meant to be changed or if allowlistAssets() is just meant to set the slashing handler once.

karan-andalusia (Karak) confirmed


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

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 vault stores its own slashStore at deployment while Core's assetSlashingHandlers mapping can be changed independently, and slashAssets requires the two to match.

Impact

Slashing for affected NativeVaults is blocked until the old handler is restored or each vault is upgraded, and if new vaults are deployed with the new handler, reverting breaks those instead.

What the attacker needed

Slashing handler is changed in Core allowlist; NativeVaults already deployed with old handler

The fix

The report suggests restricting slashStore changes to the Manager, adding a Core function anyone can call to sync a NativeVault's slashStore, or removing the equality check.

How it was found

  1. A slashing handler A is set for an asset key in the Core allowlist.
  2. Five NativeVaults are deployed with that handler.
  3. The allowlist is updated to a new slashing handler B for the same asset.
  4. The five NativeVaults can no longer be slashed until handler A is restored or each vault's implementation is updated.

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 vault is a contract that holds users' funds and can be penalised (slashed) if the operator misbehaves. The vault checks that the penalty is applied by the exact handler contract it was set up with, but a central list can later point to a different handler, so the check fails and no penalty can be applied. This means the slashing feature stops working for those vaults.

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.

More by givn

View all

2 more disclosed reports, best first.

More from Karak Restaking

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.