Hi,
I found out some potential vulnerability in the contract 'Inheritancemanager.sol' in which the modifier 'onlyBeneficiaryWithIsInherited' can leads to off-by-one error.
The key details of this potential vulnerability can be given as following:
In the modifier 'onlyBeneficiaryWithIsInherited' on line 53-62 of contract 'Inheritancemanager.sol', Loop iterates up to i < beneficiaries.length + 1
, causing out-of-bound array access when i == beneficiaries.length
, meaning that the last element of the beneficiaries array will be ignored as we are unable to call it via modifier.
Valid beneficiaries unable to call functions like 'buyOutEstateNFT' and 'appointTrustee' making key inheritance feature unusable.
Manual Code Analysis
Implement proper array removal by shifting elements and reducing array length (code given below) or use Openzeppelin's EnumerableSet contract for more robust structure (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol).
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.