Skip to content
Business logic Audit finding Intermediate

Vaults won't work with tokens that revert on a 0 value approval

The vault contract resets a token approval to zero after depositing, which breaks for tokens that revert on zero-value approvals such as BNB. As a result, vaults holding those tokens cannot complete deposits or transfers.

0x37 Follow with VCeb, holtzzx and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-09-ammplify-judging/issues/402

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

0x37, VCeb, holtzzx, makarov

Summary

;

Root Cause

The README says current contracts in-scope shouldn't have issues with tokens that revert on a zero value approval

Solidity
However, we are not expected to have issues with:
...
Revert on Zero Value Approvals
Solidity
The traits listed above are in scope and the contracts are expected to work correctly with them. Users will be able to create pools with tokens with other weird traits, but if they malfunction, it’s considered an acceptable risk.

The contract is expected to work with tokens that revert on zero value approvals, but that doesn't appear the case, as the following function on E4626

Solidity
    function commit(VaultE4626 storage self, VaultTemp memory temp) internal {
        uint256 assetsToDeposit = temp.vars[1];
        uint256 assetsToWithdraw = temp.vars[2];

        if (assetsToDeposit > 0 && assetsToWithdraw > 0) {
            // We can net out and save ourselves some fees.
            if (assetsToDeposit > assetsToWithdraw) {
                assetsToDeposit -= assetsToWithdraw;
                assetsToWithdraw = 0;
            } else if (assetsToWithdraw > assetsToDeposit) {
                assetsToWithdraw -= assetsToDeposit;
                assetsToDeposit = 0;
            } else {
                // Perfect net!
                return;
            }
        }

        if (assetsToDeposit > 0) {
            // Temporary approve the deposit.
            SafeERC20.forceApprove(self.token, address(self.vault), assetsToDeposit);
            self.totalVaultShares += self.vault.deposit(assetsToDeposit, address(this));
            SafeERC20.forceApprove(self.token, address(self.vault), 0);
        } else if (assetsToWithdraw > 0) {
            // We don't need to hyper-optimize the receiver.
            self.totalVaultShares -= self.vault.withdraw(assetsToWithdraw, address(this), address(this));
        }
    }

We don't handle the case where the token registered on the VaultE4626 revert on a 0 approval, and we do

Solidity
            SafeERC20.forceApprove(self.token, address(self.vault), 0);

One example of this sort of tokens is the BNB token, if you take a look here

https://etherscan.io/token/0xB8c77482e45F1F44dE1745F52C74426C631bDD52#code#L94

We throw in case the value of the approval is 0 when the token is BNB, therefore current E4626 vaults, or at most every function that calls commit, which is pretty much:

Vault.transfer

Solidity
   function transfer(address fromVault, address toVault, uint256 userId, uint256 amount) internal {
        VaultPointer memory from = getVault(fromVault);
        from.withdraw(userId, amount);
        from.commit();
        VaultPointer memory to = getVault(toVault);
        to.deposit(userId, amount);
        to.commit();
        emit VaultTransfer(fromVault, toVault);
    }

As a consequence, BNB vaults won't work.

Internal Pre-conditions

;

External Pre-conditions

;

Attack Path

;

Impact

BNB vaults won't work, and so does other tokens that revert on a zero value approval

https://github.com/d-xo/weird-erc20?tab=readme-ov-file#revert-on-zero-value-approvals

PoC

;

Mitigation

No response

The original report as published on Sherlock, by 0x37. 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 commit function unconditionally resets the token allowance to zero after depositing, without accounting for tokens that revert on zero-value approvals.

Impact

Vaults holding BNB or other tokens that revert on zero-value approvals will not work, blocking deposits and vault transfers; the text does not describe an attacker gaining anything.

What the attacker needed

Vault uses a token that reverts on zero approval

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.

Some tokens refuse to accept an approval of zero, which is unusual but real. The vault code always sets the approval back to zero after a deposit, so with such a token the deposit step fails and the vault stops working. This is a compatibility bug rather than something an attacker exploits.

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 0x37

View all

79 more disclosed reports, best first.

More from Ammplify

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.