Skip to content
Smart contracts Audit finding Intermediate

Approval logic can break on non-standard ERC-20s (USDT-style) and leave allowances loose

The contract calls safeApprove without first resetting the allowance to zero, which breaks deposits for tokens like USDT that require a zero-first approval and leaves residual allowances after partial fills. A malicious or compromised spender could then use transferFrom to drain the leftover tokens from the wrapper contract.

jpmendes Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

53048 sc medium approval logic can break on non standard erc 20s usdt style and leave allowances loose

Submitted on Aug 14th 2025 at 18:05:29 UTC by @jpmendes for Attackathon | Plume Network

Brief / Intro

{% hint style="warning" %} The contract uses direct safeApprove calls without resetting to zero first. This can both break deposits for non-standard ERC-20 tokens (like USDT) and leave residual allowances that a malicious or compromised spender could later exploit to drain tokens directly from the wrapper contract. {% endhint %}

Vulnerability Details

The following allowance updates are performed without first zeroing the current allowance:

Solidity
depositAsset.safeApprove(address(aggregator), depositAmount);
depositAsset.safeApprove(okxApprover, fromTokenAmount);
supportedAsset.safeApprove(vaultAddress, supportedAssetAmount);
  • Some ERC-20 tokens (e.g., USDT) revert when updating an allowance directly from a non-zero value to another non-zero value; they require the allowance be set to zero first. This will cause deposits to revert for those tokens.
  • If the approved spender (router/approver) spends less than the approved amount, the remaining allowance remains. If that spender is later compromised or malicious, they can call transferFrom to withdraw the leftover tokens from the wrapper contract.

Impact

{% hint style="danger" %}

  • Direct theft: Leftover allowances can be exploited by a malicious/compromised spender to steal tokens directly from the contract after a partial fill.
  • Permanent DoS for certain assets: Deposits with zero-first-approval tokens (e.g., USDT) will fail, effectively blocking those assets. {% endhint %}

Proof of Concept

Scenario: a user deposits 100 tokens via the 1inch path. The 1inch aggregator only needs 50 tokens for the swap (partial fill). Because the contract did not reset allowance, 50 tokens remain approved and can be stolen later.

{% stepper %} {% step %}

User deposit and partial fill

  1. Contract approves 100 tokens to the aggregator:
Solidity
depositAsset.safeApprove(aggregator, 100);
  1. Aggregator.swap() uses 50 tokens to perform the swap (partial fill). 50 tokens remain in the wrapper contract and are still approved for the aggregator. {% endstep %}

{% step %}

Attacker later drains leftover allowance

  1. Attacker (or compromised aggregator) calls:
Solidity
depositAsset.transferFrom(wrapperAddress, attackerAddress, 50);
  1. Attacker receives 50 tokens without interacting with vault share logic. {% endstep %} {% endstepper %}

References

<details> <summary>Relevant references</summary> </details>

The original report as published on Immunefi, by jpmendes. 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 contract updates ERC-20 allowances directly without first setting them to zero, which non-standard tokens reject and which leaves stale approvals after partial spends.

Impact

Leftover allowances could be exploited by a malicious or compromised spender to steal tokens after a partial fill, and deposits with zero-first-approval tokens such as USDT will fail, blocking those assets.

What the attacker needed

A token that requires zero-first approval; a partial fill leaving residual allowance; a malicious or compromised spender

How it was found

  1. The contract approves the full deposit amount to the aggregator.
  2. The aggregator performs a partial swap, using only part of the approved amount.
  3. The remaining tokens stay in the wrapper contract and remain approved for the aggregator.
  4. A malicious or compromised aggregator calls transferFrom to move the leftover tokens to itself.

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, such as USDT, refuse to change an allowance from one non-zero number straight to another; you must set it to zero first. Because this contract skips that reset, deposits with those tokens fail, and any allowance left over after a partial swap stays available for the approved spender to take later.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.