This vulnerability leads to funds being permanently stuck in the contract due to Solidity's integer division behavior
The withdrawInheritedFunds
function in InheritanceManager.sol
contract is designed to distribute inherited ETH or ERC20 tokens among beneficiaries. However, due to Solidity's integer division, any remainder from the division is left in the contract, leading to fund accumulation over time.
Solidity performs integer division, meaning any remainder from the division (assetAmountAvailable / divisor)
or (ethAmountAvailable / divisor)
will remain in the contract instead of being distributed. This results in an accumulation of unclaimed funds over multiple transactions.
Financial loss due to accumulation of unclaimed funds, creating potential legal or operational issues as integer division is inherent to Solidity and affects all transactions.
Trapped Funds: Over time, the contract accumulates ETH or ERC20 tokens that remain undistributed.
Financial Loss: Beneficiaries receive slightly less than their actual share, leading to dissatisfaction and legal disputes.
Contract Dysfunction: Future withdrawals may be affected if the contract depends on a precise balance.
Dust Accumulation: These funds may be too small to be withdrawn through any other means, leading to irretrievable assets.
Assume the contract holds 100 wei and has 3 beneficiaries.
The division calculation: 100 / 3 = 33 wei
per beneficiary.
The remainder (100 % 3 = 1 wei
) remains in the contract forever.
After multiple withdrawals, these small remainders accumulate, making the contract inefficient.
manual review
Implement logic to distribute the remainder to one of the beneficiaries (e.g., the first or last in the list):
Also for ERC20 tokens
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.