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

Ineffective Access Control in `onlyBeneficiaryWithIsInherited` Modifier

Summary: The onlyBeneficiaryWithIsInherited modifier fails to restrict access to beneficiaries when isInherited is true, allowing any address to call protected functions like buyOutEstateNFT and appointTrustee

Vulnerability Details: The modifier uses a while loop with a flawed termination condition i < beneficiaries.length + 1. If a non-beneficiary calls a function with this modifier, the loop will run past the end of the array, causing an out-of-bounds error rather than a proper authentication check

Impact : Medium. Relying on out-of-bounds errors for authentication is poor design and could be vulnerable to changes in Solidity's behavior. This creates an unconventional authentication pattern that may be misunderstood during code maintenance

Tools Used

Recommendations :

modifier onlyBeneficiaryWithIsInherited() {
require(isInherited, "Not yet inherited");
bool isBeneficiary = false;
for (uint256 i = 0; i < beneficiaries.length; i++) {
if (msg.sender == beneficiaries[i]) {
isBeneficiary = true;
break;
}
}
require(isBeneficiary, "Not a beneficiary");
_;
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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