ThePredictor::ThePredicter__NotEligibleForWithdraw()
error checks if the user is eligible to withdraw funds or not. However, the sending of funds to the user could fail if there is no CEI pattern check. msg.sender.call{value:reward)("")
transfers the valid amount, the fallback function calls ThePredicter::withdraw
function repeatedly, transferring all the funds before the transfer is terminated. This continues until all the funds are exploited.ThePredictor::withdraw
function. The Change, Effect, Interactions (CEI) pattern should be followed to prevent such attacks. Changes done as below to handle the CEI pattern checks in the ThePredictor::withdrawPrediction
function.msg.sender.call{value:fees)("")
.The expolits to the call by an attacker can be prevented by calling the balances[msg.sender=0]
before the transfer of funds. 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.