Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

Functions that send Ether to arbitrary destinations

Summary

The ThePredicter contract contains a critical vulnerability where an arbitrary user can withdraw unauthorized funds. The issue lies in the withdraw function, which uses msg.sender.call{value: reward}() to send Ether. This code may allow an attacker to exploit the withdrawal process and drain funds from the contract.

Vulnerability Details

  • Location: ThePredicter.withdraw (src/ThePredicter.sol#106-137)

  • Description: The withdraw function sends Ether to msg.sender using a low-level call, which could allow malicious users to initiate unauthorized Ether transfers.

  • Code Snippet:

(bool success,) = msg.sender.call{value: reward}("");
require(success, "Failed to withdraw");

Dangerous Calls:

  • Line: src/ThePredicter.sol#134

(bool success,) = msg.sender.call{value: reward}("");

Impact

The vulnerability allows an arbitrary user to withdraw unauthorized funds from the contract, posing a significant financial risk. An attacker can exploit this to drain the contract's balance, leading to loss of funds.

Tools Used

Manual code review

Recommendations

  • Use Safe Transfer Methods: Replace msg.sender.call{value: reward}() with msg.sender.transfer(reward) or use OpenZeppelin's Address.sendValue method to safely send Ether.

  • Implement Access Control: Ensure that only authorized users can withdraw funds. This may include checking the user's eligibility and maintaining robust access control mechanisms.

  • ERC20 Safeguards: Consider using ERC20 tokens for transactions instead of direct Ether transfers, which provide better security and logging features.

Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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