TwentyOne

First Flight #29
Beginner FriendlyGameFiFoundrySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

Using of the transfer function to send ethereum to the address.

Summary

The goal of the endGame function is to conclude a game for a specified player and handle the game's aftermath, particularly if the player has won.

But there is some bug, because is using transferfunction to send ethers.

Vulnerability Details

In the protocol, the transfer function is utilized to transfer funds to the winning address.

payable(player).transfer(2 ether);

transfer() sends 2300 gas, which is enough for most simple operations. However, if the recipient is a contract with complex logic in its fallback function, the transfer could fail, potentially causing your contract to misbehave.

Impact

The transfer could fail, potentially causing your contract to misbehave. And also it can be use for the reetrancy attacks.

Tools Used

manual review

Recommendations

Insted of transferplease use call

(bool success, ) = player.call{value: 2 ether}("");
require(success, "Transfer failed.");.
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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