The withdrawFunds function allows the owner to withdraw the entire contract balance without considering pending rewards owed to winners. This creates a risk where the owner can withdraw all funds, leaving the winners without the ability to claim their prizes.
The current implementation of the withdrawFunds function enables the owner to transfer all funds from the contract, as shown below:
This function does not account for the rewards owed to users (winners). As a result, the owner could drain all funds, even if there are outstanding rewards to be claimed by users. This creates a serious vulnerability where users could be defrauded.
The owner could potentially perform a "rug pull" by withdrawing all the funds from the contract, leaving winners unable to claim their rewards. This could lead to loss of trust and financial harm to the participants.
Manual Review
Implement a mechanism that ensures the contract always retains enough funds to cover outstanding rewards. For example, keep track of the total pending rewards and ensure that the owner can only withdraw the amount that exceeds the pending payouts.
Suggested modification:
This implementation ensures that the owner can only withdraw funds that are not reserved for winners' rewards, preventing any possibility of rug-pulling users.
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.