Not handling return value of transferFrom command can create inconsistency
The contract calls transferFrom on a token but does not check its return value, so a failed transfer still emits an event. This can cause downstream applications to record a wrong transaction or protocol state.
Submitted by hubble
Vulnerability details
The below transferFrom command is called at two places in the core contracts, followed by an emit event
payableToken.transferFrom(msg.sender,recipient,_amount)
emit ...(...);
The return value is not checked during the payableToken.transferFrom
Impact
In the event of failure of payableToken.transferFrom(…), the emit event is still generated causing the downstream applications to capture wrong transaction / state of the protocol.
Proof of Concept
- Contract CoreCollection.sol function withdraw()
- Contract ERC721Payable.sol function _handlePayment
Recommended Mitigation Steps
Add a require statement as being used in the RoyaltyVault.sol
require( payableToken.transferFrom(msg.sender,recipient,_amount) == true,
"Failed to transfer amount to recipient" );
sofianeOuafir (Joyn) confirmed, disagreed with severity and commented:
In my opinion, the severity level should be 3 (High Risk) instead of 2 (Med Risk) duplicate of #52
deluca-mike (judge) commented:
No longer a duplicate because this issue pertains specifically to the false emission of events when an underlying call would have failed.
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 token transfer fails, an event is still emitted, which could mislead downstream applications about the transaction or protocol state.
What the attacker needed
A token whose transferFrom returns false on failure
The fix
The code should check the return value of transferFrom with a require statement, as done in RoyaltyVault.sol.
How it was found
- Call the withdraw function in CoreCollection.sol.
- Call the _handlePayment function in ERC721Payable.sol.
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 moves tokens by calling a function that returns true or false to say if it worked. Here the code ignores that answer and always announces success, so other programs listening may believe a transfer happened when it did not.
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.