The onlyBeneficiaryWithIsInherited
modifier in the InheritanceManager contract uses an incorrect loop condition, causing an array out-of-bounds access. This issue manifests when a beneficiary calls functions protected by this modifier, potentially leading to unintended reverts and denial-of-service.
The modifier is designed to verify that the caller is a beneficiary and that the inheritance flag is set. However, the current implementation uses a loop condition i < beneficiaries.length + 1
. When the array has one element, after checking index 0, the loop continues to index 1, which does not exist. This results in a panic due to an array out-of-bounds error. In scenarios where only one beneficiary is present (or if the beneficiary check fails), this flaw prevents legitimate calls, disrupting the contract’s functionality.
Direct Impact: Legitimate beneficiaries may be unable to execute functions (such as appointing a trustee or triggering fund distribution) because the call reverts due to an out-of-bounds access.
Manual review
Foundry (Forge) for unit testing, which produced an array out-of-bounds panic.
Update the onlyBeneficiaryWithIsInherited
modifier to iterate only until i < beneficiaries.length
.
Implement an explicit check (using a for
loop or mapping) to verify beneficiary membership without risking array over-indexing.
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.