Skip to content
Smart contracts Audit finding Intermediate

Return values of approve() not checked

The code calls the ERC20 approve function but ignores its boolean return value, so a failed approval may go unnoticed. An attacker could potentially cause operations to proceed without the intended approval, though the judge notes the transaction would usually revert later.

IllIllI Follow

Originally disclosed on Code4rena

Submitted by IllIllI

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.

Not all IERC20 implementations revert() when there’s a failure in approve(). The function signature has a boolean return value and they indicate errors that way instead. By not checking the return value, operations that should have marked as failed, may potentially go through without actually approving anything.

There are 5 instances of this issue:

File: contracts/amo/UniV2LiquidityAmo.sol

134:     IERC20WithBurn(_token).approve(_spender, _amount);

GitHub: 134

File: contracts/amo/UniV3LiquidityAmo.sol

150:       IERC20WithBurn(_token).approve(_target, _amount);

169      IERC20WithBurn(params._tokenA).approve(
170        address(univ3_positions),
171        params._amount0Desired
172:     );

173      IERC20WithBurn(params._tokenB).approve(
174        address(univ3_positions),
175        params._amount1Desired
176:     );

GitHub: 150, 169, 173

File: contracts/core/RdpxV2Core.sol

411:     IERC20WithBurn(_token).approve(_spender, _amount);

GitHub: 411

psytama (Dopex) disputed

Alex the Entreprenerd (Judge) commented

This can be argued to be medium although in most circumnstances the tx would revert later.


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

The code does not check the boolean return value of the ERC20 approve call, which some token implementations use to signal failure instead of reverting.

Impact

Operations that should have failed may potentially proceed without actually approving anything, although in most circumstances the transaction would revert later.

What the attacker needed

A token that returns false on failed approve

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 signal failure by returning false instead of stopping the program with an error. This code ignores that false, so a failed approval might be treated as success. That could let later steps run without the permission they expect.

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 IllIllI

View all

119 more disclosed reports, best first.

More from Dopex

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.