Skip to content
Smart contracts Audit finding Intermediate

Failed transfer with low level call could be overlooked

The contract's internal AVAX transfer helper uses a low-level call and only checks the success flag, which the EVM sets to true even when the target address has no code. If the penalty collector address points to a self-destructed contract, the transfer silently fails without reverting, so funds may not reach the intended recipient.

harleythedog Follow

Originally disclosed on Code4rena

Submitted by harleythedog, also found by sirhashalot

In LaunchEvent.sol, the function _safeTransferAVAX is as follows:

function _safeTransferAVAX(address _to, uint256 _value) internal {
    (bool success, ) = _to.call{value: _value}(new bytes(0));
    require(success, "LaunchEvent: avax transfer failed");
}

This function is utilized in a few different places in the contract. According to the Solidity docs), “The low-level functions call, delegatecall and staticcall return true as their first return value if the account called is non-existent, as part of the design of the EVM. Account existence must be checked prior to calling if needed”.

As a result, it is possible that this call will fail, but _safeTransferAVAX will not notice anything went wrong. In particular, it is possible that the address rocketJoeFactory.penaltyCollector() is a deleted contract (perhaps a security flaw was found and selfdestruct was called so that users know to use an updated smart contract), but _safeTransferAVAX will not revert. If rocketJoeFactory.penaltyCollector() is indeed a non-existent contract, it would be better for _safeTransferAVAX to revert until an admin can manually correct the penaltyCollector in the factory.

For reference, see a similar high severity reported in a Uniswap audit here (report # 9): https://github.com/Uniswap/v3-core/blob/main/audits/tob/audit.pdf

Proof of Concept

See _safeTransferAVAX here. See how this function is called with _to as rocketJoeFactory.penaltyCollector() here, but this contract’s existence is not verified, which is a problem as described above.

Recommended Mitigation Steps

Check for contract existence on low-level calls, so that failures are not missed.

cryptofish7 (Trader Joe) acknowledged


The original report as published on Code4rena, by harleythedog. 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 low-level call's success flag is treated as proof of delivery, but the EVM returns true for calls to addresses with no code, so the helper does not verify that the recipient contract exists.

Impact

If the penalty collector contract has been self-destructed, AVAX transfers to it could silently fail without reverting, leaving funds stuck or misdirected until an admin corrects the address.

What the attacker needed

PenaltyCollector points to a deleted contract

The fix

The helper should check that the destination address has code before making the low-level call, so that a missing contract causes a revert.

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.

A smart contract can send cryptocurrency to another address using a low-level instruction. That instruction reports success even if the destination address no longer has any code, for example because the contract there was deleted. The helper function only checks that success flag, so a failed payment to a deleted contract goes unnoticed.

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 harleythedog

View all

14 more disclosed reports, best first.

More from Trader Joe 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.