ERC20 return values not checked
The contract does not check the boolean return value of ERC20 transfer and transferFrom calls. If a token returns false instead of reverting on failure, the contract treats the transfer as successful, potentially causing a loss of funds.
Submitted by cmichel, also found by Czar102, defsec, hack3r-0m, hyh, Ruhum, saian, Tomio, and WatchPug
The ERC20.transfer() and ERC20.transferFrom() functions return a boolean value indicating success. This parameter needs to be checked for success. Some tokens do not revert if the transfer failed but return false instead. Tokens that don’t actually perform the transfer and return false are still counted as a correct transfer.
Recommendation
As the Launch event token can be any token, all interactions with it should follow correct EIP20 checks. We recommend checking the success boolean of all .transfer and .transferFrom calls for the unknown token contract.
LaunchEvent.withdrawLiquidity:token.transfer(msg.sender, amount);LaunchEvent.withdrawIncentives:token.transfer(msg.sender, amount);LaunchEvent.emergencyWithdraw:token.transfer(msg.sender, amount);LaunchEvent.skim:token.transfer(msg.sender, amount);RocketJoeFactory.createRJLaunchEvent:IERC20(_token).transferFrom(msg.sender, launchEvent, _tokenAmount);
cryptofish7 (Trader Joe) confirmed and commented:
Fix: https://github.com/traderjoe-xyz/rocket-joe/commit/dbd19cc4
Given external factors, this could result in a loss of funds.
2 — Med (M): vulns have a risk of 2 and are considered “Medium” severity when assets are not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
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 contract ignores the boolean success value returned by ERC20 transfer and transferFrom calls.
Impact
This could result in a loss of funds if the token returns false on a failed transfer.
What the attacker needed
Token returns false on failure
The fix
The contract was fixed to check the success boolean of all transfer and transferFrom calls.
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 a failed transfer by returning false instead of stopping with an error. If the contract ignores that false value, it may think the transfer worked when it did not, which could lead to lost funds.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.