Skip to content
DoS Audit finding Intermediate

An attacker may DoS user Fluid balance increases by frontrunning `FluidLocker::claim()` calls and calling `EP_PROGRAM_MANAGER::batchUpdateUserUnits()` directly

The claim function in FluidLocker calls a program manager function that can be invoked directly by anyone, allowing an attacker to frontrun and consume the signature nonce, causing the claim to revert. This prevents users from connecting to the pool and increasing their Fluid balance, so they miss out on tax distributions while the attacker gains a larger share.

0x73696d616f Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-11-superfluid-locking-contract-judging/issues/19

Found by

0x73696d616f

Summary

FluidLocker::claim() connects to the fluid pool and then calls EPProgramManager::batchUpdateUserUnits() to verify the signature and update user points.

However, any attacker may frontrun this call and call directly EPProgramManager::batchUpdateUserUnits(), spending the signature (nonce) and making the claim transaction revert.

As the Fluid balances only increase whenever the user connects to the pool, the user balance will be 0.

An attacker will profit from this because a large tax amount may be coming from a user instantly unlocking or a program being stopped, which transfer immediately funds to the stakers by calling FLUID.distributeToPool(address(this), TAX_DISTRIBUTION_POOL, amount);.

As the user wanted to stake, they needed Fluid balance to do so, but as the attacker DoSed their claim transaction, they will not have balance to stake and will completely miss these large instant funds. Even if users had already staked before, this claim transaction could be increasing their points (by increasing their program points, they could get more Fluid and stake more Fluid to get more staker points), so an attacker profits from not allowing the user to do so just before the tax is distributed.

Note1: the tax is distributed pro-rata to the units of each user, so if the attacker denies a user increasing their funds, the attacker will receive a larger share of the funds.

Root Cause

EP_PROGRAM_MANAGER::updateUserUnits() may be called directly allowing attackers to DoS FluidLocker::claim().

Internal pre-conditions

None.

External pre-conditions

None.

Attack Path

  1. Attacker spots that a user is unlocking or a program is coming to an end and a large sum of tax is coming.
  2. Attacker frontruns users that are going to increase their Fluid balance in the Locker by calling FluidLocker::claim() so that the Locker connects to the program pool and receives the corresponding Fluid tokens.
  3. Due to the FluidLocker::claim() call reverting, users will have less Fluid in the Locker and will stake less funds, getting less points, which means the attacker will get a bigger share of the incoming TAX distribution.

Impact

Attacker profits from having a bigger share of the TAX distributions and users lose this share.

PoC

The only way to collect the Locker to the program pool is by calling FluidLocker::claim() which may be DoSed by calling EP_PROGRAM_MANAGER.updateUserUnits()` directly using the same signature.

Solidity
function claim(uint256 programId, uint256 totalProgramUnits, uint256 nonce, bytes memory stackSignature)
    external
    nonReentrant
{
    // Get the corresponding program pool
    ISuperfluidPool programPool = EP_PROGRAM_MANAGER.getProgramPool(programId);

    if (!FLUID.isMemberConnected(address(programPool), address(this))) {
        // Connect this locker to the Program Pool
        FLUID.connectPool(programPool);
    }

    // Request program manager to update this locker's units
    EP_PROGRAM_MANAGER.updateUserUnits(lockerOwner, programId, totalProgramUnits, nonce, stackSignature);

    emit IFluidLocker.FluidStreamClaimed(programId, totalProgramUnits);
}

Mitigation

The locker should have a separate method to connect to the pool.

Discussion

0xPilou

Fix for this issue is included in the following PR : https://github.com/superfluid-finance/fluid/pull/9

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/superfluid-finance/fluid/pull/9

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

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 claim function relies on a signature that can be consumed by anyone calling the program manager directly, without restricting who can trigger the update.

Impact

The attacker could gain a larger share of tax distributions while affected users lose that share, as their claim transactions are blocked.

What the attacker needed

None

The fix

The locker should have a separate method to connect to the pool, so that the claim function does not depend on a signature that can be consumed by anyone.

How it was found

  1. Attacker spots that a user is unlocking or a program is ending, with a large tax distribution coming.
  2. Attacker frontruns the user's claim transaction by calling the program manager's update function directly with the same signature.
  3. The user's claim transaction reverts because the signature nonce is already used.
  4. The user's Fluid balance remains low, so they stake less and earn fewer points, giving the attacker a larger share of the tax.

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 user tries to claim rewards, their transaction includes a one-time code (a signature) that can only be used once. An attacker can copy that code and use it first, so the user's transaction fails. As a result, the user cannot update their balance and loses out on rewards that are shared among participants.

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 0x73696d616f

View all

172 more disclosed reports, best first.

More from Superfluid Locker System

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.