An attacker can take over the rights of the contract owner by calling the InheritanceManager::inherit function.
If the only beneficiary of the contract's funds is the owner's backup wallet, then after 90 days of inactivity, any user can take over the contract owner's rights and reset the timer by calling InheritanceManager::inherit.
The attacker gains full control over all funds stored in the contract, including ETH and ERC-20 tokens, and can transfer them to any address.
Add the following code to the InheritanceManagerTest.t.sol file within the InheritanceManagerTest contract.
Manual Review
Foundry
To prevent unauthorized ownership transfer, the InheritanceManager::inherit function should include the onlyBeneficiaryWithIsInherited modifier. This ensures that only designated beneficiaries or the owner's backup wallet can execute the function, preventing the described attack.
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.