This repository has been archived by the owner on Jan 7, 2024. It is now read-only.
p12473 - InsuranceFund is still vulnerable to share inflation attack #113
Labels
Non-Reward
This issue will not receive a payout
p12473
high
InsuranceFund is still vulnerable to share inflation attack
Summary
Although reported previously in a Code4rena audit, the InsuranceFund is still vulnerable to a share inflation attack.
Vulnerability Detail
This is your typical first share inflation attack. The first depositor into the InsuranceFund will deposit 1 wei to mint 1 wei of shares. Subsequently the depositor will deposit directly into the InsuranceFund to inflate the value of that first share. When other users want to deposit into the InsuranceFund, they will not receive any share in return if the amount that they are depositing is less than the value of the first share.
Copy the following test into the InsuranceFund.js test.
Run the test with
npx hardhat test ./test/unit/InsuranceFund.js
Impact
Future depositors will be priced out and have their deposits indirectly “stolen” by the first depositor.
Code Snippet
https://github.com/hubble-exchange/hubble-protocol/blob/d89714101dd3494b132a3e3f9fed9aca4e19aef6/contracts/InsuranceFund.sol#L89-L111
Tool used
Manual Review
Recommendation
There are many suggestions here but IMO, I think the best solution is to
Duplicate of #140
The text was updated successfully, but these errors were encountered: