Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

Ignores a return value

Summary

The function createGameWithToken performs a token transfer using transferFrom() without validating its return value. This violates the ERC-20 specification and introduces a logic flaw where the function may proceed without successfully receiving the required token.

Vulnerability Details

Function:
createGameWithToken(uint256 _totalTurns, uint256 _timeoutInterval) external payable returns (uint256)

Code Affected:

winningToken.transferFrom(msg.sender, address(this), 1);

This call to transferFrom() ignores its return value (bool), which may lead to false assumptions that the token transfer succeeded when it may have failed silently. According to the ERC-20 standard, a compliant implementation must return true on success not all tokens revert on failure.

Impact

A malicious or non-compliant ERC-20 token could return false without reverting.

The contract would continue execution and create a game even if the token was not successfully transferred.

This can break trust assumptions, cause game state corruption, and potentially allow users to play without paying the entry token.

If game logic later tries to use the token assuming it's held, this could lead to unexpected errors or token imbalances.

Tools Used

Manual review

slither

Recommendations

Update the transfer call to explicitly check the return value:

require(winningToken.transferFrom(msg.sender, address(this), 1), "Token transfer failed");
Updates

Appeal created

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Missing Check on External Call Return Value

ERC20 implementation typically reverts on transfer failures

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Missing Check on External Call Return Value

ERC20 implementation typically reverts on transfer failures

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.