The removeBeneficiary
function uses the delete
operator to remove beneficiaries, which replaces the address with address(0) rather than removing the array element. This can lead to funds being distributed to the zero address during inheritance, effectively burning those funds.
When removing a beneficiary, the function replaces the address with address(0) instead of properly removing the element from the array:
This creates several issues:
The zero address remains in the beneficiaries array
During fund distribution in withdrawInheritedFunds
, tokens or ETH will be sent to the zero address
The divisor used to calculate shares remains unchanged
This vulnerability could lead to:
Permanently lost funds when distributed to the zero address
Incorrect calculation of inheritance shares
Potential denial of service if many addresses are removed, as the array maintains its original length
Unexpected behavior in other functions that rely on the beneficiaries array
This is rated as medium severity because it can lead to permanent loss of funds during inheritance distribution, but requires specific actions (removing a beneficiary without replacing them) to trigger.
Manual code review
Implement a proper array element removal technique that preserves array integrity:
This approach maintains array integrity, ensures no zero addresses in the beneficiaries list, and properly resets the deadline to maintain the security model.
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.