Off-by-one error in exit window check allows users to avoid the withdrawal fee
A boundary check in the withdrawal escrow contract uses a strict greater-than comparison, so a user who renews their withdrawal exactly at the start of their exit window is charged the fee only on the newly queued amount rather than the full outstanding amount. An attacker could repeatedly renew at the exact start timestamp to avoid the intended withdrawal fee entirely.
Source: https://github.com/sherlock-audit/2025-11-inverse-finance-junior-tranche-judging/issues/318
Found by
000000, 0xAlipede, 0xAlix2, 0xv1bh4, 7, Colin, MaratCerby, OxSath404, deucefury, klaus, maigadoh, silver_eth
Summary
A boundary check in WithdrawalEscrow.queueWithdrawal allows a user to avoid the intended full withdrawal fee by renewing exactly at the start of their exit window. Because the code checks block.timestamp > exitWindowStart (strict) instead of block.timestamp >= exitWindowStart, a renewal at the exact start timestamp charges the fee only on the newly queued amount, instead of the whole withdrawal amount.
Root Cause
In queueWithdrawal https://github.com/sherlock-audit/2025-11-inverse-finance-junior-tranche/blob/main/InverseFinance__JuniorDola/src/WithdrawalEscrow.sol#L91-L97:
if(withdrawFeeBps > 0){
//If user has had a chance to withdraw, we apply full fee, otherwise only apply fee on new amount
fee = totalWithdrawAmount > amount && block.timestamp > exitWindowStart ?
totalWithdrawAmount * withdrawFeeBps / 10000 :
amount * withdrawFeeBps / 10000;
totalWithdrawAmount -= fee;
}
At equality (block.timestamp == exitWindowStart), the “full-fee” branch is not taken.
Internal Pre-conditions
withdrawFeeBps > 0.- Caller already has a queued withdrawal (
withdrawAmounts[msg.sender] > 0and a nonzeroexitWindows[msg.sender].start).
External Pre-conditions
None.
Attack Path
- User queues an initial withdrawal
Aand receives a window[start = S, end]. - At
t = S, callqueueWithdrawal(0, maxWithdrawDelay)to renew. - Because
block.timestamp > Sis false att = S, the fee is applied to amount (0) instead oftotalWithdrawAmount, resulting in zero fee. - A new later window is set while the outstanding amount remains intact and uncharged. Repeat as needed.
Note that the amount in the above attack path example does not need to be 0; it can also be non-zero. Following the above attack path, fees are only charged on the new amount.
Though "likelihood is not considered when identifying the severity and the validity of the report" as per Sherlock rules, it's still worth mentioning that likelihood can be increased by some methods:
- The renew call can be reliably targeted with a guard (e.g., a contract requiring
block.timestamp == Sand reverting otherwise), so an inclusion with the wrong timestamp reverts and does not accidentally trigger the full-fee branch. - The start timestamp
Sis also predictable and targets the timestamp boundary on PoS Ethereum, which uses fixed 12‑second slots.
Impact
- The intended withdrawal fee on the full outstanding amount is not collected, reducing the donation to the vault and harming remaining shareholders’ yield.
- The attack can be repeated for each new withdrawal window to continuously avoid fees.
A concrete example:
withdrawFeeBps = 100(1%), vault TVL ≈ $10,000,000.- User already has withdrawAmounts = 5,000,000 shares at $1/share (≈ $5,000,000 assets), which was initialized previously.
- User renews withdrawal with an additional 0 amount at the start timestamp of the withdrawal window.
- Intended fee in the renewal: 5,000,000 × 1% = 50,000 shares ≈ $50,000 donated to the vault.
- Actual fee charged is $0, so the remaining stakers lose ≈ $50,000 in expected fee‑derived yield (which is a 100% loss of the intended fee on this renewal).
PoC
No response
Mitigation
Replace block.timestamp > exitWindowStart with block.timestamp >= exitWindowStart.
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 fee logic uses a strict greater-than comparison (`block.timestamp > exitWindowStart`) instead of greater-than-or-equal, so at the exact start timestamp the full-fee branch is skipped.
Impact
The intended withdrawal fee on the full outstanding amount is not collected, reducing the donation to the vault and harming remaining shareholders’ yield; the attack can be repeated for each new withdrawal window.
What the attacker needed
WithdrawFeeBps > 0; caller already has a queued withdrawal
The fix
The comparison should be changed to use greater-than-or-equal so that the full fee applies at the exact start of the exit window.
How it was found
- Queue an initial withdrawal and receive an exit window with a known start timestamp.
- At the exact start timestamp, call the renewal function with a zero or small amount.
- Because the timestamp is not strictly greater than the start, the fee is applied only to the new amount, resulting in zero or minimal fee.
- A new later window is set while the outstanding amount remains uncharged; repeat as needed.
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.
When you withdraw money from this contract, you pay a fee on the total amount you are taking out. The contract tries to charge the full fee once your withdrawal window has started, but it uses a comparison that misses the exact first moment of the window. By renewing at that precise moment, a user can make the contract think the window has not started yet, so it charges a fee only on the tiny new amount instead of the whole withdrawal.
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.