The contract fails to properly update the beneficiary list when a beneficiary is removed. As a result, the inheritance distribution calculation includes removed beneficiaries, causing a portion of the funds to be sent to address(0)
, effectively burning them, and also and causing reverts to occur for ERC20 tokens withdrawal.
inheritanceManager::withdrawInheritedFunds
FunctionThe function determines amountPerBeneficiary
using beneficiaries.length
, which still includes removed beneficiaries. Since inheritanceManager::removeBeneficiary
only deletes an entry but does not reduce the array size, the divisor
remains unchanged. The contract then attempts to send funds to removed beneficiaries, resulting in ETH being sent to address(0)
, effectively burning it, and causing reverts to occur for ERC20 tokens withdrawal.
Proof Of Concept
Paste the following test in inheritanceManagerTest.t.sol
file.
POC Explanation
The contract originally holds 12 ETH.
Owner adds 4 beneficiaries, but later removed 2 beneficiaries.
Since two beneficiaries were removed but still counted in the divisor, the inheritanceManager::withdrawInheritedFunds
function incorrectly assumes there are 4 recipients.
Only 6 ETH is properly distributed to active beneficiaries.
The remaining 6 ETH is sent to address(0)
, effectively burning it.
ERC20 tokens reverts, thereby causing Denial of Service.
Some ETH meant for active beneficiaries is lost forever.
Beneficiaries receive less than their rightful share.
Unintended burning of funds that should have been inherited.
ERC20 tokens reverts, thereby causing Denial of Service.
Foundry
Modify inheritanceManager::removeBeneficiary
to correctly update the array:
This ensures the array size properly reflects the number of active beneficiaries.
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.