A rounding issue in the inheritanceManager::buyOutEstateNFT
function causes incorrect fund transfer due to integer division errors.
vulnerable code
The calculation of finalAmount
involves integer division (value / divisor
), which causes truncation.
Example: If value = 300003
and beneficiaries.length = 4
, the expected finalAmount
should be 225002, but due to truncation, it results in 225000.
POC
Paste the following test in the inheritanceManagerTest.t.sol
file.
Over time, miscalculations could accumulate into significant lost funds.
Foundry
Use multiplication before division to prevent truncation:
Implement precision handling by using a scaling factor (e.g., value * 1e18
and then dividing at the end).
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.