Skip to content
Business logic Audit finding Intermediate

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.

000000 Follow with 0xAlipede, 0xAlix2 and 9 others

Originally disclosed on Sherlock

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:

Solidity
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

  1. withdrawFeeBps > 0.
  2. Caller already has a queued withdrawal (withdrawAmounts[msg.sender] > 0 and a nonzero exitWindows[msg.sender].start).

External Pre-conditions

None.

Attack Path

  1. User queues an initial withdrawal A and receives a window [start = S, end].
  2. At t = S, call queueWithdrawal(0, maxWithdrawDelay) to renew.
  3. Because block.timestamp > S is false at t = S, the fee is applied to amount (0) instead of totalWithdrawAmount, resulting in zero fee.
  4. 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 == S and reverting otherwise), so an inclusion with the wrong timestamp reverts and does not accidentally trigger the full-fee branch.
  • The start timestamp S is 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.

The original report as published on Sherlock, by 000000. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

  1. Queue an initial withdrawal and receive an exit window with a known start timestamp.
  2. At the exact start timestamp, call the renewal function with a zero or small amount.
  3. 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.
  4. 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.

More by 000000

View all

32 more disclosed reports, best first.

More from Inverse Finance - Junior Tranche

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.