In the event that an owner sets up an estate for their beneficiaries, any of the beneficiaries can buy the estate for a reduced cost, and the proceeds will be shared between the remaining beneficiaries.
A coupe of errors in the InheritanceManager::buyOutEstateNFT()
function results in proceeds from the sale of the estate not being properly distributed between the remaining beneficiaries.
There are 3 impacts of this bug:
Where there are more than 2 beneficiaries -let's assume 3-, when one of the beneficiaries buys out the estate, the proceeds is shared into 3(instead of 2) portions
Only one of the remaining beneficiaries gets a portion, the remaining portions remain in the portfolio
Whoever is the owner can withdraw these remaining portions out
Thus, leaving the remaining beneficiaries without an inheritance.
Manual Review
Foundry
Consider this scenario:
Jack has a really sick Porsche 911 GT which he sets up as an estate for his 3 beneficiaries (wife, son, and daughter) to inherit by calling ::createEstateNFT()
He sets the value of the estate at 150k USDC
Son opts to buy out the estate for 100k USDC
by calling ::buyOutEstateNFT()
Wife and daughter should get 50k USDC
each, but wife gets 33.3k USDC
, and the balance remains in the portfolio
Jack (or whoever is the owner) can withdraw the portfolio
Daughter is left with no inheritance
Add the following test to the InheritanceManagerTest
contract:
The security flaw exists in the buyOutEstateNFT() function, and particularly in the way it calculates distribution of proceeds from sale of estate.
Make the following corrections:
Changes made:
Changed return
to continue
For distribution of proceeds, divided finalAmount
by multiplier
instead of divisor
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.