TwentyOne

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

No Withdrawal Function: Ethers Permanently Locked in TwentyOne Contract

Summary

TwentyOne contract can collect ethers, but lacks a withdraw function, causing all collected ethers to be permanently locked in the contract.

Vulnerability Details

TwentyOne::StartGame()is payable allowing players to send ethers. However, there is no withdrawal method for the deployer or admin to retrieve ethers from the contract, resulting in permanent fund lockup.

Impact

Ethers will remain locked in the contract, inaccessible to any party.

Tools Used

Manual Review

Recommendations

Include a withdrawal function or owner-controlled transfer function, such as:

address owner;
constructor() {
owner = msg.sender;
}
function withdraw(uint amount, address payable to) external {
require(msg.sender == owner, "Only Owner can withdraw");
require(amount <= address(this).balance, "Insufficient balance");
(bool success, ) = to.call{value : amount}("");
require(success, "Fail to withdraw");
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Owner has no method to withdraw

Support

FAQs

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