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

Attacker frontruns FluidLocker::claim() by calling EPProgramManager.updateUserUnits() directly with the same signature, consuming the nonce and DoSing the victim's Fluid balance increase.

- Payout: Audit contest
- Severity: medium
- Program: Superfluid
- Found by: 0x73696d616f
- Disclosed: 2024-11-13
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-superfluid-locking-contract-judging/issues/19
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-superfluid-locking-contract%3AM-1
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** FluidLocker / EPProgramManager smart contracts
**Root cause:** updateUserUnits() is callable directly by anyone, so an attacker can consume the signature nonce before FluidLocker::claim() uses it, causing the claim to revert.
**Steps:**
1. Observe a pending FluidLocker::claim(programId, totalProgramUnits, nonce, stackSignature) tx.
2. Frontrun by calling EP_PROGRAM_MANAGER.batchUpdateUserUnits(lockerOwner, programId, totalProgramUnits, nonce, stackSignature) directly with the same signature.
3. Victim's claim() reverts because the nonce is consumed; locker never connects to pool and balance stays 0.
**How found:** Code reading: noticed claim() bundles pool connection with a signature-gated batchUpdateUserUnits() call, and that updateUserUnits() has no caller restriction, so the signature can be spent by anyone.
**Exploitation:** Attacker monitors mempool for claim() calls, replays the signature via direct batchUpdateUserUnits() call to consume the nonce, denying the victim's Fluid balance increase and points, thereby capturing a larger pro-rata share of incoming TAX distributions.
**Insight:** When a privileged action is gated only by a signature/nonce, check whether the underlying function is externally callable by anyone — the signature becomes a griefing vector to DoS the wrapper that also performs side effects (like connectPool).

## Proof of concept (copied exactly from the original report)

**FluidLocker claim() function vulnerable to frontrun**

```
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);
}
```

