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

Broken Beneficiary Removal Logic

Summary

The removeBeneficiary function deletes an entry but does not adjust the array length, leaving a zero address and breaking fund distribution.

Vulnerability Details

Using delete beneficiaries[indexToRemove] sets the address to zero but retains the array length. Subsequent iterations (e.g., in withdrawInheritedFunds) will include the zero address, causing failed ETH transfers or locked ERC20 tokens.

Impact

Funds may be permanently locked or transactions reverted, preventing beneficiaries from inheriting assets.

Tools Used

Manual review.

Recommendations

Replace the deletion with array element swapping and pop():

uint256 lastIndex = beneficiaries.length - 1;
beneficiaries[indexToRemove] = beneficiaries[lastIndex];
beneficiaries.pop();
Updates

Lead Judging Commences

0xtimefliez Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Incorrect removal from beneficiary list causes funds to be send to 0 address

Support

FAQs

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