GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Locked Ether Without Withdrawal Mechanism

Root Cause and Impact

  • Root Cause: The contract can receive Ether but lacks a function to withdraw it, resulting in Ether being permanently locked.

  • Impact: Any Ether sent directly to the contract (e.g., via selfdestruct or mistaken transfers) cannot be recovered.

Vulnerability Details

  • Absence of Withdrawal Function:

    • No function allows the contract owner to withdraw Ether.

    • Ether sent to the contract remains inaccessible.

Recommendations

  • Implement a Withdrawal Function:

    function withdraw() external onlyOwner {
    uint256 balance = address(this).balance;
    require(balance > 0, "No Ether to withdraw");
    payable(owner).transfer(balance);
    }
  • Prevent Direct Ether Transfers:

    • Implement a fallback function that reverts any direct Ether transfers:

      receive() external payable {
      revert("Direct transfers not allowed");
      }
Updates

Lead Judging Commences

n0kto Lead Judge 12 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.