ERC20 transferFrom return values not checked
The contract called transferFrom() but did not check its boolean return value, so tokens that return false instead of reverting were treated as a successful payment. An attacker could use such a token to mint NFTs without paying the mint fee.
Submitted by hickuphh3, also found by 0xDjango, kirk-baird, leastwood, m9800, minhquanym, and pedroais
The transferFrom() function returns a boolean value indicating success. This parameter needs to be checked to see if the transfer has been successful. Oddly, transfer() function calls were checked.
Some tokens like EURS and BAT will 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.
Impact
Users would be able to mint NFTs for free regardless of mint fee if tokens that don’t revert on failed transfers were used.
Recommended Mitigation Steps
Check the success boolean of all transferFrom() calls. Alternatively, use OZ’s SafeERC20’s safeTransferFrom() function.
sofianeOuafir (Joyn) confirmed, disagreed with severity and commented:
In my opinion, the severity level should be 3 (High Risk) instead of 2 (Med Risk)
This is clearly an issue that needs to be fixed and represents a high risk. Currently, the current state of the code would allow users to mint tokens even if the payment isn’t successful.
deluca-mike (judge) increased severity to High and commented:
payableTokenseems to be defined by whomever defines theCollectionincreateProject, so it would be possible for that person to define a payable token that, unbeknownst to them, behaves unexpectedly. I agree with high risk (unless there is some person/committee that is curates and validates thepaybaleTokens ahead of time). Need to handle return fromtransferandtransferFrom, as well as erc20s that do not return anything from fromtransferandtransferFrom.
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 did not check the boolean returned by transferFrom(), so a false result was treated as success.
Impact
Users could mint NFTs for free if a token that returns false on failed transfers was used as the payment token.
What the attacker needed
A payable token that returns false on failure; ability to create a project with that token
The fix
The contract should check the success boolean of every transferFrom() call, or use a safe transfer helper such as OpenZeppelin's SafeERC20.
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 rather than stopping with an error. The contract ignored that returned value, so it believed the payment had gone through when it had not. This let someone create NFTs without actually paying.
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.