Skip to content
Business logic Audit finding Intermediate

Delayed slashing window and lack of transparency for pending slashes could lead to loss of funds

The two-day veto window before a slashing is finalised means users who deposit after a slash request but before execution are also slashed, and the protocol provides no way to check for pending slashes. An attacker or unaware user could deposit into a vault with a pending slash and lose funds immediately.

0xCiphky Follow with Takarez, lanrebayode77 and 1 other

Originally disclosed on Code4rena

Submitted by 0xCiphky, also found by Takarez, lanrebayode77, and KupiaSec

Stakers can provide liquidity by choosing an operator and vault to deposit their assets with. In return, they receive shares based on their deposited amount relative to the total assets in the vault.

DSSs have the right to slash vaults if it feels that an operator has failed to perform its tasks adequately. DSSs are subjected to a delay of 2 days (represented by VETO_WINDOW) before a slashing can be finalized. This allows the slashing committee to veto a slashing event if it feels that the slashing was unfair.

The handleSlashing function transfers the slashed assets from the vault, effectively reducing the total assets in the vault, which slashes each shareholder relative to the number of shares they own.

    function handleSlashing(IERC20 token, uint256 amount) external {
        if (amount == 0) revert ZeroAmount();
        if (!_config().supportedAssets[token]) revert UnsupportedAsset();

        SafeTransferLib.safeTransferFrom(address(token), msg.sender, address(this), amount);
        // Below is where custom logic for each asset lives
        SafeTransferLib.safeTransfer(address(token), address(0), amount);
    }

The problem with the current system is that the two-day veto window introduces a time gap between when a slash is confirmed and when it is finalized. The slash request records the amount that should be slashed depending on the slash percentage and total assets in the fetchEarmarkedStakes function. Therefore, it is fair to assume that the shareholders at that timestamp should be slashed. However, currently, users who deposit between the slash request and when it is executed will also be slashed and lose value.

Furthermore, the protocol currently lacks any getter methods to warn users of pending slashes for vaults, meaning users could unknowingly deposit into such vaults and lose value in a short period.

In the worst-case scenario, if a vault is fully slashed and the total assets become zero, since the total supply will still be non-zero and previous users will still own shares, any new deposits will instantly lose value, and some funds will be incorrectly allocated to previous users.

Impact

The current implementation can lead to unfair slashing of users who deposit between the slashing request and its finalization. Users unknowingly depositing into vaults with pending slashes will lose value. With no getter methods available, there is no way for users to identify such vaults and avoid potential losses.

Recommendation

  • Implement getter methods to allow users to check for pending slashes on vaults before making deposits.
  • If a vault is fully slashed, consider disabling deposits to avoid users from losing value. If disabling deposits is not feasible, make sure users are warned of a slashing event or that the vault is empty with shares still in it, which could cause losses.

devdks25 (Karak) commented:

We plan on running indexers for operator related metrics.

If a vault is fully slashed, consider disabling deposits to avoid users from losing value. If disabling deposits is not feasible, make sure users are warned of a slashing event or that the vault is empty with shares still in it, which could cause losses.

Ideally no staker should deposit in such vault, but still the vault’s deposit can be paused. cc: @dewpe

dewpe (Karak) commented:

Would reclassify to a non-issue.

This is more of a frontend and indexer issue instead of a contract/protocol issue. Operators are already performing due diligence prior to delegating to an DSS. Part of their DD would be if there is any pending slashings. The frontend would make it obvious that there are pending slashings that could affect a users share price.

We could add helper functions on the querier to help protocols building on top have the same observability.

dewpe (Karak) disputed

MiloTruck (judge) commented:

The warden has demonstrated how stakers that deposit while a slash is ongoing will lose funds.

Although it is technically the responsibility of stakers to ensure the vault’s current state does not cause them to lose funds when depositing, it isn’t apparent to the regular user that an ongoing slash will cause a loss of funds for new deposits. I also believe it isn’t documented anywhere that users must check if a slash is ongoing before depositing into vaults prior to the audit.

As such, I am inclined to award this as medium severity.

devdks25 (Karak) commented:

To mitigate this the vault deposits will be paused by the core during a queued slashing event and will be unpaused post finalizeSlashing/cancelSlashing. Additionally a deposit_OVERRIDE_SLASH_PROTECTION method will be exposed to prevent griefing.

Karak mitigated:

This mitigation exposes a getter to determine if a vault’s queued for slashing.

Status: Mitigation confirmed. Full details in reports from 0xCiphky, KupiaSec and sl1.


The original report as published on Code4rena, by 0xCiphky. 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

Impact

Users who deposit during the veto window lose value, and in the worst case a fully slashed vault with non-zero share supply causes new deposits to instantly lose value and funds to be misallocated to previous users.

What the attacker needed

A vault with a pending slash; user deposits during the 2-day veto window

The fix

The protocol mitigated by pausing vault deposits during a queued slashing event and exposing a getter to determine if a vault is queued for slashing.

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.

When a vault is going to be slashed, there is a two-day waiting period before the slash happens. If you deposit during that waiting period, you share the loss even though you did nothing wrong. The protocol also gives no warning that a slash is pending, so you cannot know to avoid that vault.

What is Business logic?

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

More by 0xCiphky

View all

11 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.

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.