getContractBalance
To Return An Unintended ValueThe getContractBalance
function is intended to return the value of the pot
plus platformFees
unless payouts are pending. In its logic it returns the balance of the game contract.
The receive
function accepts ETH without any restrictions or logic to allocate it to the pot
or platformFeesBalance
, meaning funds sent accidentally or maliciously are not accounted for in the game mechanics and could become locked in the contract, as there is no mechanism to refund or redirect these funds. The getContractBalance
function would also return a value not representative of the sum of the pot
and platformFeesBalance
.
Likelihood:
Users or external contracts send ETH directly to the contract's address without invoking the claimThrone
function, such as through a direct transfer or a contract's fallback mechanism.
Malicious actors intentionally send ETH to the contract to exploit the lack of handling, aiming to lock funds or disrupt game accounting.
Impact:
Funds sent to the contract outside of the claimThrone
function become unallocated and inaccessible, as they are not added to the pot
or platformFeesBalance
, potentially locking them in the contract indefinitely.
Players or the owner lose trust in the contract's integrity due to untracked funds, leading to reduced participation or disputes over missing ETH.
Add this test to Game.t.sol
and run with forge test --mt testUnprotectedReceiveLocksFunds
Have the receive
function revert when anyone attempts to send ETH directly to the contract
There is no reason for a user to directly send ETH or anything to this contract. Basic user mistake, info, invalid according to CH Docs.
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.