Skip to content
Business logic Audit finding Intermediate

Incorrect initial deposit calculation may cause cancelProgram to revert

The cancelProgram function recalculates a program's initial deposit using current governance parameters rather than the values used when the program was funded. If those parameters change, cancellation can revert or return the wrong amount to the treasury.

0x73696d616f Follow with zxriptor

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-06-superfluid-locker-system-judging/issues/96

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

0x73696d616f, zxriptor

Summary

The FluidEPProgramManager.cancelProgram() function incorrectly assumes that governance parameters (minimum deposit and liquidation period) remain constant throughout a program's lifecycle. When these parameters change after program creation, the calculated initialDeposit for treasury return will be incorrect, potentially causing transaction reverts or wrong accounting.

Root Cause

The vulnerability lies in the cancelProgram() function, where it recalculates the initial deposit amount using current governance parameters instead of the original values from when the program was funded:

Solidity
uint256 buffer =
    program.token.getBufferAmountByFlowRate(programDetails.fundingFlowRate + programDetails.subsidyFlowRate);
uint256 initialDeposit =
    buffer + uint96(programDetails.fundingFlowRate + programDetails.subsidyFlowRate) * EARLY_PROGRAM_END;

The buffer calculation depends on two governance-controlled parameters that can be changed at any time:

  1. Minimum Deposit: retrieved via SUPERTOKEN_MINIMUM_DEPOSIT_KEY
  2. Liquidation Period: retrieved via CFAV1_PPP_CONFIG_KEY and decoded

The buffer amount flows through this call chain:

Text
cancelProgram()
├── program.token.getBufferAmountByFlowRate(totalFlowRate)
    ├── SuperTokenV1Library.getBufferAmountByFlowRate()
        ├── cfa.getDepositRequiredForFlowRate(token, flowRate)
            ├── gov.getConfigAsUint256(host, token, SUPERTOKEN_MINIMUM_DEPOSIT_KEY)
            ├── gov.getConfigAsUint256(host, token, CFAV1_PPP_CONFIG_KEY)
            ├── SuperfluidGovernanceConfigs.decodePPPConfig(pppConfig)
            └── _getDepositRequiredForFlowRatePure(minimumDeposit, liquidationPeriod, flowRate)
                └── max(minimumDeposit, _clipDepositNumberRoundingUp(flowRate * liquidationPeriod))

Internal Pre-conditions

  1. The program needs to be cancelled

External Pre-conditions

  1. Superfluid governance changes either the minimum deposit or liquidation period parameters after program funding via:

Attack Path

  1. Program is created and funded with initialDeposit calculated using current governance parameters

  2. Superfluid governance changes minimum deposit or liquidation period via:

    Text
    npx truffle exec ops-scripts/gov-set-token-min-deposit.js : {TOKEN_ADDRESS} {MINIMUM_DEPOSIT}
    npx truffle exec ops-scripts/gov-set-3Ps-config.js : {TOKEN_ADDRESS} {LIQUIDATION_PERIOD} {PATRICIAN_PERIOD}
    
  3. When cancelProgram() is called, it recalculates initialDeposit using new parameters

  4. If parameters increased: transaction attempts to return more funds

  5. If parameters decreased: excess funds remain in contract rather than sent back to treasury

Impact

When governance parameters increase after program creation, cancelProgram() calculates higher buffer requirement than originally deposited, returning more funds to treasury than expected which may cause transaction revert due to insufficient fund balance. This cause inability to cancel the program.

When governance parameters decrease after program creation, cancelProgram() calculates lower buffer requirement than originally deposited, causing excess funds to remain in the contract while treasury receives less than the original deposit amount.

PoC

No response

Mitigation

Store the original initialDeposit amount in the program struct and use it during cancellation:

Solidity
struct EPProgram {
    // ... existing fields ...
    uint256 initialDeposit;
}

// In fundProgram():
programs[programId].initialDeposit = initialDeposit;

// In cancelProgram():
token.transfer(TREASURY, programs[programId].initialDeposit);

This ensures the exact deposited amount is returned regardless of governance parameter changes.

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 cancellation logic recomputes the deposit from live governance parameters instead of storing the deposit amount recorded at funding time.

Impact

A parameter increase may make cancellation revert, leaving the program uncancellable, while a decrease leaves excess funds stranded in the contract and returns less to the treasury.

What the attacker needed

Program must be cancelled; governance changes deposit parameters

The fix

The original deposit should be stored in the program struct at funding time and that stored value used when cancelling; the team acknowledged the issue but has not fixed it.

How it was found

  1. A program is created and funded, with the deposit calculated from the governance parameters in force at that time.
  2. Superfluid governance changes the minimum deposit or liquidation period.
  3. cancelProgram is called and recalculates the deposit using the new parameters.
  4. If the parameters rose, the contract tries to return more than it holds and the transaction reverts; if they fell, excess funds stay in the contract.

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 smart contract holds a deposit for a payment stream, and the size of that deposit depends on settings the platform can change. When a program is cancelled, the contract works out the deposit again using today's settings instead of the ones used when the money went in. If the settings moved, the refund is wrong and the cancellation can fail.

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

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.