Skip to content
Smart contracts Audit finding Intermediate

M-09 Approve zero first

The treasury contract calls approve() directly on tokens without first resetting an existing non-zero allowance to zero. For tokens such as USDT that revert when changing a non-zero allowance, the approval call would fail, so the treasury could not update that spender's allowance.

c4lanky Follow

Originally disclosed on Code4rena

Submitted by c4lanky

Note: this finding was reported via the winning Automated Findings report. It was declared out of scope for the audit, but is being included here for completeness.

Some ERC20 tokens (like USDT) do not work when changing the allowance from an existing non-zero allowance value. For example, Tether (USDT)‘s approve() function will revert if the current approval is not zero, to protect against front-running changes of approvals.

There are 1 instances of this issue: File: contracts/ArcadeTreasury.sol

384:     function _approve(address token, address spender, uint256 amount, uint256 limit) internal {
385:         // check that after processing this we will not have spent more than the block limit
386:         uint256 spentThisBlock = blockExpenditure[block.number];
387:         if (amount + spentThisBlock > limit) revert T_BlockSpendLimit();
388:         blockExpenditure[block.number] = amount + spentThisBlock;
389:
390:         // approve tokens
391:         IERC20(token).approve(spender, amount);
392:
393:         emit TreasuryApproval(token, spender, amount);
394:     }

https://github.com/code-423n4/2023-07-arcade/blob/main/contracts/ArcadeTreasury.sol#L384-L394

PowVT (Arcade) confirmed


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

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 calls approve() with a new amount without first approving zero, which breaks tokens that require a zero starting allowance.

Impact

Approvals for tokens that require a zero starting allowance would revert, so the treasury could not change those allowances.

What the attacker needed

Treasury holds a token like USDT; existing non-zero allowance for spender

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.

An allowance is how much of a token one address lets another address spend. Some tokens, like USDT, refuse to change that number unless it is first set to zero, to stop someone sneaking in a spend during the change. This contract skips that reset step, so with those tokens the approval simply fails.

What is Smart contracts?

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

More by c4lanky

View all

3 more disclosed reports, best first.

More from Arcade.xyz

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.