A beneficiary address that does not receive funds can cause neither of the beneficiaries to be able to get their inheritance and permanently locks funds/assets in the contract.
In the InheritanceManager.sol
contract, if a beneficiaries address is a address/smart contract that for one-reason or another rejects/reverts the funds, the withdrawal of the inheritance funds/assets fails for all of the beneficiaries. This results in the funds/assets being stuck indefinitely in the smart contract (assuming the owner does not make any interaction after the 90 day period).
This issue is caused by the handling of the transfers being executed as a batch rather than being handled independently. The logic which sends the inheritance funds is:
This is unfair for the other beneficiaries who are able to accept the inheritance funds. Furthermore this breaks the contracts functionality as none of the beneficiaries are able to withdraw their share of the funds/assets.
The impact of this vulnerability is High as funds are locked within the contract indefinitely. Furthermore, the contracts functionality is broken as none of the beneficiaries are able to obtain any of their shares (which defeats the purpose of the contract). The Likelihood is medium as there are variety of reasons a transaction may fail.
Manual Review
Foundry for testing
To prove the validty of this issue, I have created a test function that can be run by: forge test --mt testWithdrawWithBadBenefector -vvv
The function:
Adds inheritance funds and assigns 2 good beneficiaries and 1 beneficiary that has a smart contract address (contains a revert statement)
Shows the inheritance balance
Fast forwards to beyond the 90 day time period making locked funds eligibe for unlocking.
Unlocks the funds and starts the inheritance process
Shows that none of the beneficiaries received a balance.
The test function
The "bad" address
The recommend fix for this issue is to
Store the balances for each of the beneficiaries separately and then handle the transfers independently. This is so that, even if one of the addresses has an issue, it does not affect the flow of other beneficiaries gaining their inheritance funds.
There could be a check to make sure that smart contract addresses are not allowed; However, this may be restrictive therefore the 1st recommendation may be more preferred.
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.