Skip to content
DoS Audit finding Intermediate

Dos via dust leftover in erc 20 approvals

The contract uses safeApprove to set token allowances, but partial fills, rounding, or fee-on-transfer tokens leave a small residual allowance. Because tokens like USDT forbid changing a non-zero allowance to another non-zero value, subsequent approvals revert, permanently blocking deposits and withdrawals for that asset.

BeastBoy Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

51847 sc critical dos via dust leftover in erc 20 approvals

Submitted on Aug 6th 2025 at 07:52:55 UTC by @BeastBoy for Attackathon | Plume Network

Description

The _oneInchHelper does:

Solidity
depositAsset.safeApprove(address(aggregator), depositAmount);
(supportedAssetAmount,) = aggregator.swap(executor, desc, data);

Because 1inch supports partial fills, it may pull only 995 of 1,000 USDT and return 5 USDT to the wrapper. The allowance is decremented by only the 995 consumed, leaving 5 units of non-zero allowance behind, so the next safeApprove(..., newAmount) becomes a forbidden non-zero→non-zero change and reverts.

In the vault deposit path the code calculates shares via:

Solidity
uint256 shares = depositAmount.mulDivDown(ONE_SHARE, rate);
vault.enter(msg.sender, asset, depositAmount, to, shares);

ERC-4626–style math rounds down, so depositing 1,000 units might mint only 999 shares, leaving 1 unit of asset stuck in the vault. That residual asset can combine with other dust vectors to block future approvals or withdrawals.

When interacting with a fee-on-transfer token the proxy calls:

Solidity
asset.safeApprove(spender, 100);
spender.transferFrom(proxy, target, 100);
// token charges 1% fee, net = 99
_allowances[proxy][spender] -= 99; // leaves 1 unit of allowance

That 1-unit dust makes the next approve(…,50) a non-zero→non-zero change and permanently DoSes that token’s flow.

This issue also exists in other functions like TellerWithMultiAssetSupportPredicateProxy:deposit & TellerWithMultiAssetSupportPredicateProxy:depositAndBridge.

Impact

Any of these tiny “dust” scenarios—partial fills, rounding, or fees—leaves a residual allowance or balance that blocks all future safeApprove calls, causing an irreversible denial of service for that asset.

{% hint style="warning" %} Residual non-zero allowances caused by partial token consumption, rounding, or fees can permanently prevent subsequent non-zero allowance updates for tokens that forbid non-zero → non-zero transitions (e.g., USDT). This results in a DoS that can freeze deposits/withdrawals or cause protocol insolvency. {% endhint %}

Recommendation

Always reset the existing allowance to zero before setting a new one:

Solidity
token.safeApprove(spender, 0);
token.safeApprove(spender, desiredAmount);

or perform a one-time infinite approval (type(uint256).max) to eliminate all non-zero→non-zero transitions.

{% hint style="info" %} Either zero-then-set or use infinite approval are acceptable mitigations. Choose infinite approval only if trust and security considerations for that spender are acceptable. {% endhint %}

Proof of Concept

{% stepper %} {% step %}

Setup and initial approval

Solidity
// Setup USDT (assuming it's available in MainnetAddresses)
ERC20 USDT = ERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);

// Add USDT as supported asset
teller.addAsset(USDT);
accountant.setRateProviderData(USDT, true, address(0)); // Pegged to base

// Deal USDT to test contract (USDT has 6 decimals)
uint256 usdtAmount = 1000e6; // 1000 USDT
deal(address(USDT), address(this), usdtAmount);

// First approval - this should work fine
USDT.safeApprove(address(boringVault), usdtAmount);

console.log("First approval successful");
console.log("USDT allowance:", USDT.allowance(address(this), address(boringVault)));

{% endstep %}

{% step %}

Simulate partial consumption

Solidity
// Simulate partial consumption by manually transferring some USDT
// This simulates what happens when DEX aggregators or vaults don't consume the full allowance
uint256 partialAmount = 999e6; // Transfer slightly less than approved amount
USDT.safeTransferFrom(address(this), address(boringVault), partialAmount);

console.log("After partial transfer:");
console.log("USDT allowance remaining:", USDT.allowance(address(this), address(boringVault)));

{% endstep %}

{% step %}

Attempt to set a new non-zero allowance (reverts)

Solidity
// Try to approve again - this should REVERT with USDT
uint256 newApprovalAmount = 500e6;

// This will revert because USDT doesn't allow changing non-zero allowance to another non-zero value
vm.expectRevert();
USDT.safeApprove(address(boringVault), newApprovalAmount);

console.log("Second approval reverted as expected - VULNERABILITY CONFIRMED");

{% endstep %}

{% step %}

Demonstrate the fix: reset to zero then approve

Solidity
// Reset to zero first, then approve
USDT.safeApprove(address(boringVault), 0);
console.log("Reset allowance to zero");

USDT.safeApprove(address(boringVault), newApprovalAmount);
console.log("New approval successful after reset:", USDT.allowance(address(this), address(boringVault)));

{% endstep %} {% endstepper %}

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

The code calls safeApprove with a new non-zero amount without first resetting any leftover non-zero allowance to zero, which tokens like USDT reject.

Impact

A residual allowance from partial fills, rounding, or fees can permanently block future approvals for that asset, causing a denial of service that may freeze deposits and withdrawals or lead to protocol insolvency.

What the attacker needed

Token forbids non-zero to non-zero approval; partial fill, rounding, or fee leaves dust

The fix

The allowance should be reset to zero before setting a new non-zero value, or a one-time infinite approval should be used.

How it was found

  1. Set up USDT as a supported asset and give the test contract 1000 USDT.
  2. Approve the vault to spend 1000 USDT; this first approval succeeds.
  3. Simulate partial consumption by transferring 999 USDT to the vault, leaving a small residual allowance.
  4. Attempt to approve a new non-zero amount (500 USDT); the call reverts.
  5. Reset the allowance to zero, then approve the new amount; this succeeds.

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 a smart contract lets another contract spend its tokens, it first sets an allowance. Some tokens, such as USDT, only allow setting an allowance from zero to a new value; they refuse to change an existing non-zero allowance to another non-zero value. If a tiny amount of the old allowance is left over, every future attempt to set a new allowance fails, so the contract can no longer move that token.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by BeastBoy

View all

6 more disclosed reports, best first.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.