The inherit() function allows any address to call it after the 90-day inactivity period, potentially leading to unauthorized ownership transfer. If only one beneficiary exists, an attacker can call inherit() first and take ownership of the contract, bypassing the rightful heir. This completely breaks the inheritance mechanism, allowing malicious actors to seize control of the contract and its assets.
The inherit() function does not check if msg.sender is a valid beneficiary before assigning ownership. This means that anyone can call the function after 90 days and take control of the contract.
If there is only one beneficiary, the function blindly assigns ownership to the first caller, allowing an attacker to steal the entire estate.
If there are multiple beneficiaries, the function sets isInherited = true without verifying the caller, which, while less severe, still allows unauthorized users to initiate inheritance improperly.
Vulnerable Code:
The flaw in inherit()
allows anyone to claim ownership after 90 days, bypassing the intended beneficiaries. If there is only one beneficiary, an attacker can steal the entire estate, resulting in permanent fund loss. Even with multiple beneficiaries, unauthorized users could disrupt the inheritance process. If the original owner later regains access, they may find their contract and assets already stolen, making recovery impossible.
Deploy the InheritanceManager contract.
Add one beneficiary (e.g., 0xBeneficiary).
Wait 90 days for the inactivity period to expire.
Attacker (e.g., 0xAttacker) calls inherit() before the rightful beneficiary.
The contract assigns ownership to 0xAttacker, not 0xBeneficiary.
Rightful heir loses control, and the attacker gains access to all assets.
Manual review
Modify the inherit() function to verify that msg.sender
is a listed beneficiary before allowing inheritance:
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.