The removeBeneficiary function is intended to remove a previously added beneficiary from the beneficiaries array. Instead it just deletes the item within the array (set it's value to 0).
If a beneficiary is removed withdrawInheritedFunds
will still use the original array size to divide the inheritance. In case of ETH some ETH will be transfered to address(0), so it will be permanently lost. In case of ERC20 tokens the contract will try to transfer some token to he zero address, which will fail, and withdrawInheritedFunds will revert.
The following test demonstrates that out of an initial 12 ETH 4 ETH is permanently lost if one of three beneficiaries is removed.
This test demonstrates, that withdrawInheritedFunds reverts if it is called with an ERC20 address after beneficiary was removed.
ETH is permanently lost, or ERC20 toke is permanently locked into the contract if removeBeneficiary is ever called by the owner.
Manual review and foundry test.
Remove the beneficiary from the array. E.g. set the last value of the array to the one to be removed, and pop the last value from the array.
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.