Skip to content
Business logic Audit finding Intermediate

Maxdeposit can advertise an amount that deposit always rejects

The vault's maxDeposit function can return a positive amount even when depositing that exact amount would revert because it converts to zero shares. An attacker could cause integrations that deposit the advertised maximum to fail, though no funds are stolen.

qed Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

88835 sc low maxdeposit can advertise an amount that deposit always rejects

Submitted on Aug 15th 2026 at 05:52:22 UTC by @QED for Audit Comp | Firelight

Description

Brief/Intro

FirelightVault can return a positive ERC-4626 maxDeposit quote even when depositing that exact amount deterministically reverts, causing maximum-amount integrations to fail.

Vulnerability Details

Affected target: FirelightVault at commit 42f9ea5e43d88b35197b901acc2a8c24b314fa62

Severity: Low

Asset: contracts/core/FirelightVault.sol

Root Cause

maxDeposit returns the unused asset capacity without checking whether it converts to a nonzero number of shares, but deposit floor-converts the assets and reverts with InvalidAmount when the result is zero shares. The conversion includes virtual terms in _convertToSharesTotals, so a positive remaining capacity can legitimately convert to zero.

Attack Path

{% stepper %} {% step %}

Transfer underlying units

An unprivileged account transfers 10 underlying units directly to an empty vault whose deposit limit is 11. {% endstep %}

{% step %}

Leave one unit of capacity

The vault has totalAssets = 10, totalSupply = 0, and one unit of remaining capacity. {% endstep %}

{% step %}

Receive an invalid quote

maxDeposit(receiver) returns 1, while previewDeposit(1) returns zero shares. {% endstep %}

{% step %}

Deposit the advertised maximum

A router or user follows the advertised maximum and calls deposit(1, receiver). {% endstep %}

{% step %}

Transaction reverts

The zero-share guard reverts with InvalidAmount before any asset transfer. {% endstep %} {% endstepper %}

Impact Details

ERC-4626 routers, frontends, or batched operations that deposit the advertised maximum can reliably revert and deposits can remain unavailable until the cap or vault state changes, although no assets are stolen.

References

Recommended Fix

After calculating remaining capacity, return zero whenever previewDeposit(remaining) is zero and add regression tests for donated empty vaults and high share-price rounding edges.

Link to Proof of Concept

https://gist.github.com/w-qedaudit/91f523cdc78670872597603aeb7742de

Proof of Concept

PoC gist: https://gist.github.com/w-qedaudit/91f523cdc78670872597603aeb7742de

Prerequisite: Git, Node.js, and npm must be installed with network access available for cloning and dependency installation.

The supplied poc.js is a temporary focused reproducer copied into the checked-out repository at runtime; it is not an in-tree project test or modification.

Shell
cd firelight/qhf6dkc3-maxdeposit-unexecutable
chmod +x run.sh
./run.sh

Expected successful output includes:

state totalAssets=10 totalSupply=0 depositLimit=11
maxDeposit(receiver)=1
previewDeposit(maxDeposit)=0
deposit(maxDeposit, receiver)=reverted InvalidAmount; transaction=rejected by eth_sendTransaction
after depositorAssets=1 depositorShares=0

The complete output from the verified execution is included in poc_output.txt.

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

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

Impact

ERC-4626 routers, frontends, or batched operations that deposit the advertised maximum can reliably revert, and deposits may remain unavailable until the cap or vault state changes, although no assets are stolen.

What the attacker needed

Vault has remaining capacity that converts to zero shares; attacker can transfer underlying tokens directly to the…

The fix

After calculating remaining capacity, return zero whenever previewDeposit(remaining) is zero and add regression tests for donated empty vaults and high share-price rounding edges.

How it was found

  1. Transfer 10 underlying units directly to an empty vault with a deposit limit of 11.
  2. Observe the vault now has totalAssets 10, totalSupply 0, and one unit of remaining capacity.
  3. Call maxDeposit for a receiver and see it returns 1, while previewDeposit(1) returns zero shares.
  4. Call deposit with that advertised maximum of 1.
  5. The transaction reverts with InvalidAmount before any asset transfer.

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 vault contract tells other programs the largest amount they can deposit. Here it sometimes says a number is fine, but if you try to deposit exactly that number, the vault refuses because the deposit would give you zero shares. This can break automated tools that trust the vault's answer, but nobody loses 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.

More by qed

View all

13 more disclosed reports, best first.

More from Firelight

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.