The withdrawInheritedFunds
and buyOutEstateNFT
functions in the InheritanceManager
contract contain a critical flaw where division by zero can occur if the beneficiaries
array is empty. This issue can cause transaction reverts and prevent fund distribution.
The contract assumes that beneficiaries.length
is always greater than zero when performing fund distribution. However, if no beneficiaries have been added or all have been removed, the divisor in asset calculations becomes zero, leading to a division-by-zero error.
Any attempt to withdraw inherited funds or buy out an estate NFT when there are no beneficiaries will revert, making the contract unusable.
Could lead to locked funds if the owner is inactive and no valid beneficiaries exist to inherit assets.
Manual Code Review
Add a check at the beginning of withdrawInheritedFunds
and buyOutEstateNFT
to ensure there is at least one valid beneficiary before performing any division.
Graceful Handling: Instead of reverting abruptly, return an error message indicating no valid beneficiaries exist.
Require Minimum Beneficiaries: Enforce a requirement that at least one beneficiary must always exist before certain inheritance functions can execute.
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.