You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uninitialized Leverage and Bond Amounts Leading to Stuck Funds
Summary
The initialize function in the provided Solidity code does not initialize the leverage amount and bond amount in the PreDeposit phase. This can lead to stuck funds as the createPool function expects these amounts to be greater than zero.
Root Cause
The root cause of this issue is the missing initialization of leverageAmount and bondAmount in the initialize function. Without these initializations, the createPool function will revert due to zero values for these amounts..
The create pool function however requires that leverage and bond amounts are greater than zero , if not pool creation fails. Although the admin can still set bond and leverage amount through separate function an oversight can occur an hamper this from taking place, networks downtimes can also lead to cases where the leverage and bond amount are not set
function createPool() external nonReentrant whenNotPaused checkDepositEnded {
if (reserveAmount ==0) revertNoReserveAmount();
if (bondAmount ==0|| leverageAmount ==0) revertInvalidBondOrLeverageAmount();
if (poolCreated) revertPoolAlreadyCreated();
IERC20(params.reserveToken).approve(address(factory), reserveAmount);
pool = factory.createPool(params, reserveAmount, bondAmount, leverageAmount, bondName, bondSymbol, leverageName, leverageSymbol, true);
emitPoolCreated(pool);
poolCreated =true;
}
Internal Pre-conditions
-Users have deposited their tokens in Predeposit and can not no longer withdraw because deposits have ended.
the checkDepositEnded modifier ensures this
modifier checkDepositEnded() {
if (block.timestamp< depositEndTime) revertDepositNotEnded();
_;
}
External Pre-conditions
No response
Attack Path
-The initialize function is called without initializing leverageAmount and bondAmount.
-The createPool function is called, which checks if reserveAmount, bondAmount, and leverageAmount are greater than zero.
-Since bondAmount and leverageAmount are not initialized, the function reverts, leading to stuck funds in user funds which cannot be retrieved since deposits have ended.
Impact
User funds are permanently stuck in predeposit.. funds stuck; high Likelihood is low so medium.
PoC
Mitigation
Modify the initialize function to set the initial values for leverageAmount and bondAmount.
Set the leverage amount and bond immediately instead of waiting to set on a different call.
Urban Daffodil Elk
Medium
Uninitialized Leverage and Bond Amounts Leading to Stuck Funds
Summary
The initialize function in the provided Solidity code does not initialize the leverage amount and bond amount in the PreDeposit phase. This can lead to stuck funds as the createPool function expects these amounts to be greater than zero.
Root Cause
The root cause of this issue is the missing initialization of leverageAmount and bondAmount in the initialize function. Without these initializations, the createPool function will revert due to zero values for these amounts..
The create pool function however requires that leverage and bond amounts are greater than zero , if not pool creation fails. Although the admin can still set bond and leverage amount through separate function an oversight can occur an hamper this from taking place, networks downtimes can also lead to cases where the leverage and bond amount are not set
https://github.com/sherlock-audit/2024-12-plaza-finance/blob/main/plaza-evm/src/PreDeposit.sol#L84-L107
Internal Pre-conditions
-Users have deposited their tokens in Predeposit and can not no longer withdraw because deposits have ended.
External Pre-conditions
No response
Attack Path
-The initialize function is called without initializing leverageAmount and bondAmount.
-The createPool function is called, which checks if reserveAmount, bondAmount, and leverageAmount are greater than zero.
-Since bondAmount and leverageAmount are not initialized, the function reverts, leading to stuck funds in user funds which cannot be retrieved since deposits have ended.
Impact
User funds are permanently stuck in predeposit.. funds stuck; high Likelihood is low so medium.
PoC
Mitigation
Modify the initialize function to set the initial values for leverageAmount and bondAmount.
Set the leverage amount and bond immediately instead of waiting to set on a different call.
The text was updated successfully, but these errors were encountered: