GiantPool should not check ETH amount on withdrawal
The GiantPoolBase.withdrawETH function requires the withdrawal amount to be at least MIN_STAKING_AMOUNT, which prevents users from withdrawing smaller remaining balances. An attacker could not exploit this, but a user could be forced to deposit more funds to withdraw their own ETH, incurring extra fees.
Submitted by aphak5010, also found by Trust, Jeiwan, yixxas, and HE1M
The GiantPoolBase.withdrawETH function requires that the amount to withdraw is at least as big as the MIN_STAKING_AMOUNT (https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantPoolBase.sol#L53).
This check does not serve any purpose and can actually cause the user problems when withdrawing his ETH.
Proof of Concept
- Bob deposits ETH into the GiantPool with the
GiantPoolBase.depositETHfunction. The amount is equal toMIN_STAKING_AMOUNT + 0.99 * MIN_STAKING_AMOUNT. - Bob witdraws
MIN_STAKING_AMOUNTETH from the GiantPool. - Bob has
0.99 * MIN_STAKING_AMOUNTETH left in the GiantPool. This is a problem since he cannot withdraw this amount of ETH since it is smaller thanMIN_STAKING_AMOUNT. In order to withdraw his funds, Bob needs to first add funds to the GiantPool such that the deposited amount is big enough for withdrawal. However this causes extra transaction fees to be paid (loss of funds) and causes a bad user experience.
Tools Used
VSCode
Recommended Mitigation Steps
The require(_amount >= MIN_STAKING_AMOUNT, "Invalid amount"); statement should just be removed. It does not serve any purpose anyway.
vince0656 (Stakehouse) confirmed
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 withdrawal function incorrectly enforces a minimum amount check that is only relevant for staking, not for withdrawals.
Impact
Users may be unable to withdraw small remaining balances without depositing more ETH, leading to extra transaction fees and a poor user experience.
What the attacker needed
User has deposited ETH into GiantPool; User attempts to withdraw less than MIN_STAKING_AMOUNT
The fix
The require statement enforcing the minimum amount should be removed.
How it was found
- Bob deposits ETH into the GiantPool with the GiantPoolBase.depositETH function, using an amount equal to MIN_STAKING_AMOUNT + 0.99 * MIN_STAKING_AMOUNT.
- Bob withdraws MIN_STAKING_AMOUNT ETH from the GiantPool.
- Bob has 0.99 * MIN_STAKING_AMOUNT ETH left in the GiantPool, which he cannot withdraw because it is smaller than MIN_STAKING_AMOUNT.
- To withdraw his funds, Bob must first add more funds to the GiantPool, causing extra transaction fees and a bad user experience.
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.
This is a smart contract bug where a withdrawal function has an unnecessary minimum amount check. If you deposit a bit more than the minimum and then withdraw the minimum, the leftover amount is too small to withdraw, so you have to deposit more money just to get your own funds out, which costs extra fees.
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.