Location: contracts/src/TreasureHunt.sol:236-241 (fund) vs contracts/src/TreasureHunt.sol:287-289 (receive)
fund() is owner-only:
But receive() accepts ETH from anyone and emits the same Funded event:
A non-owner can send ETH directly to the contract address, deposit any amount, and trigger a Funded event bypassing the ONLY_OWNER_CAN_FUND restriction.
Likelihood: High. Very easy to transfer ETH directly.
Impact: Low. No one can steal but anyone can send ETH to the contract.
Run:
The test passes stranger's fund() call reverts, but their direct ETH transfer succeeds.
Either restrict receive() with the same owner check, or delete it entirely and force all deposits through fund().
Or:
Although the explicit `fund()` function is restricted to the owner via `require(msg.sender == owner, "ONLY_OWNER_CAN_FUND")`, the contract also implements a permissive `receive()` function that accepts arbitrary ETH sent directly to the contract and emits the same Funded event without any sender check. This means a non-owner cannot use the `fund()` entrypoint itself, but can still increase the contract balance simply by transferring ETH to the contract address. This is an access-control inconsistency between the documented admin funding path and the actual fallback behavior.
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.