Skip to content
Business logic Audit finding Intermediate

Attacker can dos deposits by hitting the deposit cap

The deposit function enforces a deposit cap, but withdrawals have no fees or lockups. An attacker can front-run legitimate deposits by depositing up to the cap, causing the victim's transaction to revert, then immediately withdraw and repeat.

PotEater Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

57606 sc insight attacker can dos deposits by hitting the deposit cap

Submitted on Oct 27th 2025 at 14:57:03 UTC by @PotEater for Audit Comp | Alchemix V3

Description

Brief/Intro

The function deposit implements a check that ensures the amount user is trying to deposit does not exceed the deposit cap.

However, the withdraw mechanism does not enforce any fees or lockdowns. Meaning attacker can front-run deposits, depositing huge amount and hitting the deposit cap, causing legitimate txs to revert by the depositCap check. The attacker can then immediately withdraw and repeat the process.

Vulnerability Details

The function deposit implements the following check:

Solidity
_checkState(_mytSharesDeposited + amount <= depositCap);

This check ensures the amount does not exceed the depositCap. However, on withdraw there are no fees or lockdowns, meaning a malicious actor can front-run transactions, hitting the deposit cap, making legitimate txs revert and withdraw immediately after that, discouraging users from interacting with this protocol.

This is a direct griefing. The attack cost is low as the only price for the attacker are the gas fees.

Impact Details

This is a direct griefing attack, users transactions will fail unexpectedly. This would discourage users from interacting with this protocol.

References

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistV3.sol#L369

Proof of Concept

Proof of Concept

Add this function in the AlchemistV3.t.sol test file:

This PoC demonstrates how the attacker front-runs a user, making user tx fail and then withdraws his funds immediately after that, preparing for another front-run.

PoC:

Solidity
function test_legendary_poc() external {
    // Set deposit cap on the Alchemist (not on the Transmuter)
    vm.prank(alOwner); // admin of the Alchemist proxy
    alchemist.setDepositCap(100e18);

    // Verify new cap
    uint256 amount = alchemist.depositCap(); // 100e18

    // ---- [BEEF deposits up to cap + buffer] ----
    vm.startPrank(address(0xbeef));
    SafeERC20.safeApprove(address(vault), address(alchemist), amount + 100e18);
    alchemist.deposit(amount, address(0xbeef), 0);
    vm.stopPrank();

    // ---- [DEAD tries to deposit and fails due to cap] ----
    uint256 amount2 = 10e18;
    vm.startPrank(address(0xdead));
    SafeERC20.safeApprove(address(vault), address(alchemist), amount2);
    vm.expectRevert();
    alchemist.deposit(amount2, address(0xdead), 0);
    vm.stopPrank();

    // ---- [BEEF withdraws successfully] ----
    vm.startPrank(address(0xbeef));
    uint256 tokenId = AlchemistNFTHelper.getFirstTokenId(address(0xbeef), address(alchemistNFT));
    alchemist.withdraw(amount, address(0xbeef), tokenId);
    vm.stopPrank();
}

I set the cap to low amount for testing purposes.

The original report as published on Immunefi, by PotEater. 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

Root cause

Likely the deposit cap check can be temporarily saturated because withdrawals are unrestricted and immediate, allowing a griefing attack.

Impact

Legitimate users' deposit transactions fail unexpectedly, which could discourage them from using the protocol; the attack costs the attacker only gas fees.

What the attacker needed

Attacker can front-run transactions; attacker has enough funds to reach the deposit cap; deposit cap is set

How it was found

  1. Set the deposit cap to a low value for testing.
  2. Attacker deposits an amount equal to the cap plus a buffer.
  3. Victim attempts to deposit but the transaction reverts due to the cap.
  4. Attacker withdraws the deposited amount successfully.

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 deposit cap is a limit on how much can be deposited. The attacker fills that limit just before a real user tries to deposit, so the user's deposit fails. The attacker then takes their money back out and can do it again.

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 PotEater

View all

13 more disclosed reports, best first.

More from Alchemix V3

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.