# A malicious user may unlock instantly all the funds from the `FluidLocker` when no one is staking in the Tax pool

Missing zero-staker check in FluidLocker._instantUnlock lets users loop unlock(0) to withdraw all funds tax-free when the tax pool has no stakers.

- 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/24
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-superfluid-locking-contract%3AM-3
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:fee-bypass

**Target:** FluidLocker.sol _instantUnlock / unlock
**Root cause:** _instantUnlock computes a flow rate from tax pool stakers; with 0 stakers the rate is 0 and the call does not revert, so no tax is charged.
**Steps:**
1. Ensure tax pool has 0 stakers (flow rate resolves to 0).
2. Fund locker with tokens and upgrade locker.
3. Loop `aliceLocker.unlock(0, ALICE)` 30 times.
4. Observe full balance withdrawn to ALICE with no tax paid.
**How found:** Code review of _instantUnlock flow-rate computation; noticed no revert when tax pool unit count is zero, then wrote a PoC loop test.
**Exploitation:** Attacker repeatedly calls unlock with zero unlocking period; each call bypasses tax because flow rate is 0, draining the locker balance to themselves.
**Insight:** When a fee/flow rate is derived from staker counts, check the zero-staker edge case explicitly—division-free zero rates silently disable fees and can be looped.

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

**PoC test looping instant unlock without fees**

```
function test_POC_InstantUnlock_WithoutFees() external {
    _helperFundLocker(address(aliceLocker), 10_000e18);

    assertEq(_fluidSuperToken.balanceOf(address(ALICE)), 0, "incorrect Alice bal before op");
    assertEq(_fluidSuperToken.balanceOf(address(aliceLocker)), 10_000e18, "incorrect Locker bal before op");

    _helperUpgradeLocker();

    vm.startPrank(ALICE);
    for (uint i = 0; i < 30; i++) {
        aliceLocker.unlock(0, ALICE);
    }

    assertGt(_fluidSuperToken.balanceOf(address(ALICE)), 9.98e21, "incorrect Alice bal after op");
}
```

