Skip to content
Smart contracts Audit finding Intermediate

Low-level call return value not checked

The NFTXStakingZap.addLiquidity721ETHTo function makes a low-level call to refund excess ETH but does not check whether the call succeeded. If the refund call fails, the caller loses the refunded amount.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The NFTXStakingZap.addLiquidity721ETHTo function performs a low-level .call in payable(to).call{value: msg.value-amountEth} but does not check the return value if the call succeeded.

Impact

If the call fails, the refunds did not succeed and the caller will lose all refunds of msg.value - amountEth.

Recommended Mitigation Steps

Revert the entire transaction if the refund call fails by checking that the success return value of the payable(to).call(...) returns true.

0xKiwi (NFTX) confirmed and commented:

Nice catch, thank you. Confirmed.

0xKiwi (NFTX) resolved


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

Impact

If the refund call fails, the caller could lose the refund of msg.value minus amountEth.

What the attacker needed

Caller sends more ETH than needed; refund call fails

The fix

The refund call should be checked and the whole transaction reverted if it fails.

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 sends Ether to an address, it can use a low-level call that returns a success flag. If the contract ignores that flag, a failed send goes unnoticed and the Ether is effectively lost. Here the refund to the caller could fail silently.

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 cmichel

View all

196 more disclosed reports, best first.

More from NFTX contest

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.