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:
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:
- Minimum Deposit: retrieved via
SUPERTOKEN_MINIMUM_DEPOSIT_KEY - Liquidation Period: retrieved via
CFAV1_PPP_CONFIG_KEYand decoded
The buffer amount flows through this call chain:
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
- The program needs to be cancelled
External Pre-conditions
- Superfluid governance changes either the minimum deposit or liquidation period parameters after program funding via:
setSuperTokenMinimumDeposit()for minimum deposit changessetPPPConfig()for liquidation period changes
Attack Path
-
Program is created and funded with
initialDepositcalculated using current governance parameters -
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} -
When
cancelProgram()is called, it recalculatesinitialDepositusing new parameters -
If parameters increased: transaction attempts to return more funds
-
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:
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.
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
- A program is created and funded, with the deposit calculated from the governance parameters in force at that time.
- Superfluid governance changes the minimum deposit or liquidation period.
- cancelProgram is called and recalculates the deposit using the new parameters.
- 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.