The PuppyRaffle contract has a function withdrawFees which lacks necessary access restrictions, allowing any external actor to potentially withdraw the accumulated fees. This poses a severe financial risk as malicious actors can drain funds meant for the owner.
In the PuppyRaffle contract, the withdrawFees function allows for the withdrawal of all accumulated fees. However, the function doesn't have an onlyOwner modifier or equivalent access control mechanism, permitting anyone to trigger the function and redirect the fees to an address of their choosing.
This vulnerability can result in financial loss for the contract owner as accumulated fees can be withdrawn by any unauthorized actor. Depending on the popularity and usage of the PuppyRaffle contract, this could represent significant amounts of Ether.
Deploy the PuppyRaffle and Attack contracts.
Interact with the PuppyRaffle contract to accumulate some fees.
Call the changeFeeAddress
function of the PuppyRaffle contract to set the fee address to the address of the Attack contract (or any malicious address).
Trigger the attack to withdraw the accumulated fees.
Attack
Test
Foundry
Introduce the onlyOwner
modifier or an equivalent access control mechanism to the withdrawFees
function to restrict the withdrawal capability to only the contract owner.
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.