Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

`OnlyBeneficiaryWithIsInherited` does not work properly, no one gets true this modifier, causing that all nft's are stuck in the wallet after it is inherrited and causing that it is impossible to appoint a new `trustee`

IMPACT : HIGH

Likelihood : HIGH

Summary

The purpose of the OnlyBeneficiaryWithIsInherited modifier is that if someone that is not one of the beneficieries calls for example buyOutEstateNFT that it would revert because of index out of bound. But since this modifier is badly coded it will also run out of bounds also when a beneficiary calls this function.

Impact

buyOutEstateNFT & appointTrustee are both protected by this modifier, causing that noone can buy out the estateNft's and thus do the estateNft's get stuck in this wallet after the owner has passed away nor can a new trustee be appointed.

Proof of Concept

function testOnlyBeneficiaryWithIsInheritedFails() public {
vm.prank(owner);
im.addBeneficiery(beneficiery);
address newTrustee = makeAddr("newTrustee");
vm.prank(beneficiery);
im.appointTrustee(newTrustee);
}

Recommendation

replace the OnlyBeneficiaryWithIsInherited modifier by the following

modifier onlyBeneficiaryWithIsInherited() {
uint256 i = 0;
bool isInheritedAndIsBeneficiary = false;
- while (i < beneficiaries.length + 1) {
+ while (i< beneficiaries.length){
if (msg.sender == beneficiaries[i] && isInherited) {
- break;
+ isInheritedAndIsBeneficiary = true;
}
i++;
}
+ if (!isInheritedAndIsBeneficiary ) {
+ revert inheritanceManager__NotBeneficiaryOrInherited();
+ }
_;
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.