The withdrawFunds
function in the MysteryBox contract has the potential to permanently lock funds if the owner address becomes a contract that cannot receive ETH or if the owner loses access to their account.
The vulnerable code is in the withdrawFunds
function:
The issues with this implementation are:
It assumes the owner is always able to receive ETH.
It sends the entire balance of the contract in one transaction.
There's no way to partially withdraw funds or change the withdrawal address.
The impact of this vulnerability is medium:
Fund Lockup: If the owner address becomes a contract that cannot receive ETH (e.g., a contract without a receive()
or fallback()
function), all funds in the MysteryBox contract could become permanently locked.
Single Point of Failure: If the owner loses access to their account (e.g., lost private key), there's no way to recover or withdraw the funds.
Inflexibility: The inability to partially withdraw funds or change the withdrawal address limits the contract's adaptability to different scenarios.
Manual code review.
To address this vulnerability, consider implementing the following improvement:
Add a safety check to ensure the withdrawal address can receive ETH:
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.