Given the right conditions, By calling inherit() , an attacker can gain ownership of the InheritanceManagercontract
If the deadline is passed and the InheritanceManagerhas only one beneficiary, the InheritanceManager::inherit()function becomes vulnerable to an attacker gaining ownership by calling the function.
The inherit()function logic lacks a check for if the msg.senderis a valid beneficiary and contains a condition that sets msg.senderas the owner of the contract if (and only if) there is ONE beneficiary
The test written below asserts that attacker can inherit and gain ownership of the contract:
Test output:
This vulnerability shows that ownership of the InheritanceManagercontract, the core contract of this entire application can be transferred to an attacker in a very likely scenario, given very likely circumstances based on the functionality of the application.
This fundamentally breaks the entire system.
Foundry, Manual Review
To fix this issue, a modifier InheritanceManager::onlyBeneficiaryCanInherit()can be used to mitigate this issue as follows:
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.