Thewithdraw()function is intended to allow the contract owner to withdraw remaining funds after all treasures have been claimed (whenclaimsCount >= MAX_TREASURES)
The function completely lacks access control, allowing any external address to trigger the withdrawal once the hunt is complete, even though the funds are sent to the hardcoded owner address
Likelihood:MEDIUM
This will occur when any malicious actor or bot monitors the contract and callswithdraw()after the 10th treasure is claimed
Front-running bots will likely call this function before the owner can
Impact:MEDIUM
Allows unauthorized triggering of owner withdrawal, violating principle of least privilege
Creates griefing vector through front-running the owner's intended withdrawal timing
Could cause issues if owner is a smart contract with conditional receive() logic
EmitsWithdrawnevent with unauthorized caller's context, potentially corrupting off-chain monitoring systems
While funds go to correct address, this breaks administrative control expectations
The vulnerability allows any external address to trigger the withdrawal function after all treasures are claimed. While the funds are sent to the correct owner address, this breaks the expected access control pattern and can cause operational issues.
Add access control to match all other administrative functions:
function withdraw() external {
require(msg.sender == owner, "ONLY_OWNER"); // @> Add this line
.....}
Alternative: Use the existing but unused onlyOwner modifier
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.
The contest is complete and the rewards are being distributed.