In normal behavior, a winner can call withdrawWinnings()
to transfer their pending ETH winnings from the contract to their own address.
However, when the currentKing
is a smart contract with no receive()
or fallback()
function, the low-level call in withdrawWinnings()
will fail, making it impossible to withdraw the funds. There is also no alternative withdrawTo(address)
method that would allow redirecting winnings to an externally owned account (EOA), potentially causing ETH to become permanently stuck.
Likelihood:
This occurs when a contract becomes king and later wins the game.
The winning contract lacks a receive()
or fallback()
function and cannot accept plain ETH transfers.
Impact:
Winnings cannot be withdrawn, leaving ETH permanently stuck in the contract.
Neither the owner nor the winner can recover or redirect the funds unless the winning contract self-destructs or is upgraded.
The test demonstrates that a non-receivable contract (lacking a receive or fallback function) can claim the throne but fails to withdraw winnings due to a revert in withdrawWinnings, as the ETH transfer to msg.sender fails, leaving funds locked.
Add a withdrawWinningsTo(address payable to) function to allow winners to specify an alternate recipient address for their winnings, enabling successful withdrawals even if the winner is a contract without a receive or fallback function.
The only party affected is the "attacker". Info at best.
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.