If the InheritanceManager contract has just one beneficiary, an attacker can call InheritanceManager::inherit and become owner. This can lead to multiple issues, with the most important among them being stolen funds.
According to the docs, the owner of InheritanceManager can list his backup wallet as the only beneficiary. If the owner has lost access to his wallet and 90 days have passed, he can reclaim his funds via InheritanceManager::inherit(). However, upon deadline expiration, nothing prevents an attacker from calling inherit and become owner of the contract.
Assuming the deadline has passed ([1]) and the number of beneficiaries is one ([2]), msg.sender becomes the contract's owner ([3]). Finally, the attacker can call InheritanceManager::sendETH and steal InheritanceManager contract's funds.
Consider the following scenario:
owner lists his backup wallet as beneficiary (works with one legitimate beneficiary as well)
deadline expires
attacker calls inherit
beneficiaries.length is 1, making attacker the owner
attacker calls sendETH and steals InheritanceManager's contract funds
Add test_inheritUnauthorizedOwnershipTransfer in InheritanceManagerTest.t.sol,
as well as the Attacker contract:
Run the test:
A wallet backup is a core feature of the InheritanceManager contract. Without proper authorization, funds and assets can be stolen.
Manual review
Foundry
Since inherit expects the backup wallet to be in slot0 of beneficiaries, add the following patch:
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.