InheritanceManager::inherit()
does not have any authentication checks. If there's an item in the beneficiaries
array and if the inheritance deadline has passed, anyone can call the function and become the owner of the contract. According to natspec, this functionality exists for account recovery in case the owner loses access to the contract. This is based on the beneficiaries.length == 1
check. Presumably, the owner will have set their address as beneficiaries[0]
at some point to allow for this functionality. Even so, the function should set beneficiaries[0]
as the owner, and not msg.sender
. An attacker could call this function if the current owner forgets to, or they can try to frontrun the owner's transaction.
Anyone can take ownership of the contract by calling the inherit function under certain circumstances.
Copy the following into InheritanceManager.t.sol
and run the test.
Expected result:
Add authentication check on inherit()
. Owner can add a backup address to a list of whitelisted address for account recovery. Additionally, instead of transferring ownership to the msg.sender, the function should transfer ownership to either a beneficiary, or a whitelisted address.
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.