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

Lack of Access Control in `withdrawFees` Function -Anyone can withdraw funds to the feeAdress

Summary

The withdrawFees function in the PuppyRaffle contract lacks proper access control, allowing any address to withdraw the fees. This could lead to unauthorized withdrawals and potential loss of funds.

Vulnerability Details

The withdrawFees function is designed to allow the owner of the contract to withdraw the accumulated fees. However, the function does not have any access control mechanisms in place. This means that any address can call the function and withdraw the fees.

PoC

An attacker could simply call the withdrawFees function to withdraw the fees:

raffle.withdrawFees();

Impact

Unauthorized withdrawals could lead to loss of funds. This could disrupt the operation of the contract and potentially lead to a loss of trust in the contract.

Recommendations

To mitigate this risk, add an access control mechanism to the withdrawFees function to ensure that only authorized addresses can withdraw the fees. This could be done using the onlyOwner modifier provided by the OpenZeppelin Ownable contract:

This will ensure that only the owner of the contract can withdraw the fees, preventing unauthorized withdrawals.```

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: User experience and design improvement

Support

FAQs

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

Give us feedback!