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.
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:
Dangerous Calls:
Line: src/ThePredicter.sol#134
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.
Manual code review
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.