Incorrect checking in _assertUserHasEnoughGiantLPToClaimVaultLP
The batch withdrawal functions check the wrong token's last-interaction timestamp, so after the first withdrawal the shared token's timestamp is updated and any further withdrawals in the same batch fail. An attacker could not gain funds, but legitimate users could not withdraw several LP tokens in one transaction, forcing one withdrawal per day.
Submitted by hihen, also found by Trust and Lambda
The batch operations of withdrawDETH() in GiantSavETHVaultPool.sol and withdrawLPTokens() in GiantPoolBase.sol are meaningless because they will fail whenever more than one lpToken is passed.
Each user can perform withdrawDETH() or withdrawLPTokens() with one LPToken only once a day.
Proof of Concept
Both the withdrawDETH() in GiantSavETHVaultPool.sol and withdrawLPTokens() in GiantPoolBase.sol will call GiantPoolBase._assertUserHasEnoughGiantLPToClaimVaultLP(lpToken, amount) and lpTokenETH.burn(msg.sender, amount):
There is a require in _assertUserHasEnoughGiantLPToClaimVaultLP():
require(lpTokenETH.lastInteractedTimestamp(msg.sender) + 1 days < block.timestamp, "Too new");
At the same time, lpTokenETH.burn(msg.sender, amount) will update lastInteractedTimestamp[msg.sender] to latest block timestamp in _afterTokenTransfer() of GiantLP.sol.
So, a user can perform withdrawDETH or withdrawLPTokens of one LPToken only once a day, others more will fail by _assertUserHasEnoughGiantLPToClaimVaultLP().
Tools Used
VS Code
Recommended Mitigation Steps
The LPToken being operated on should be checked for lastInteractedTimestamp rather than lpTokenETH.
diff --git a/contracts/liquid-staking/GiantPoolBase.sol b/contracts/liquid-staking/GiantPoolBase.sol
index 8a8ff70..5c009d9 100644
--- a/contracts/liquid-staking/GiantPoolBase.sol
+++ b/contracts/liquid-staking/GiantPoolBase.sol
@@ -93,7 +93,7 @@ contract GiantPoolBase is ReentrancyGuard {
function _assertUserHasEnoughGiantLPToClaimVaultLP(LPToken _token, uint256 _amount) internal view {
require(_amount >= MIN_STAKING_AMOUNT, "Invalid amount");
require(_token.balanceOf(address(this)) >= _amount, "Pool does not own specified LP");
- require(lpTokenETH.lastInteractedTimestamp(msg.sender) + 1 days < block.timestamp, "Too new");
+ require(_token.lastInteractedTimestamp(msg.sender) + 1 days < block.timestamp, "Too new");
}
/// @dev Allow an inheriting contract to have a hook for performing operations post depositing ETH
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
The check reads the timestamp from the shared lpTokenETH contract instead of the specific LPToken being withdrawn, while the burn updates the shared timestamp.
Impact
Batch withdrawals of more than one LP token always revert, so users can only withdraw one token per day; no funds are lost.
What the attacker needed
Holds LP tokens in the pool; waits a day between withdrawals
How it was found
- Call withdrawDETH or withdrawLPTokens with more than one LP token in the batch.
- The function checks the shared lpTokenETH last-interaction timestamp for the caller.
- The first burn updates that shared timestamp to the current block.
- The next item in the batch fails the 'Too new' require and the whole call reverts.
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 lets people withdraw several tokens at once, but it checks a shared record of when the user last acted instead of the record for each token. The first withdrawal updates that shared record, so the rest of the batch is rejected as 'too new'. This is a logic bug that breaks a feature rather than letting someone steal money.
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.