The appointTrustee()
function in InheritanceManager.sol
can trigger an array out-of-bounds panic due to an off-by-one error in the onlyBeneficiaryWithIsInherited
modifier. This issue occurs when beneficiaries.length
is small, and isInherited
is true
, leading to a panic error (0x32) that crashes the transaction.
Location:
InheritanceManager.sol
, onlyBeneficiaryWithIsInherited
modifier
The bug occurs because the loop runs one iteration too far (i < beneficiaries.length + 1
).
If beneficiaries.length
is small (0 or 1) and isInherited == true
, the loop will try to access an out-of-bounds index, causing a panic error (0x32).
If beneficiaries.length
is large, the loop will likely break early, meaning the bug is inconsistent.
PoC
Test failure output
Any beneficiary attempting to call appointTrustee()
under these conditions will crash the transaction, making trustee management impossible.
Since trustees are needed to reevaluate assets in case of disputes, this could prevent fair settlement of estate assets.
Funds may become locked if the trustee role is essential for payout disputes.
The issue is inconsistent, making it even riskier since it may go unnoticed in normal testing.
Foundry
Slither
ChatGPT
Manual code review
Fix the off-by-one error by changing the loop condition in onlyBeneficiaryWithIsInherited
:
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.