ThePharmacist - Base pools can get bricked if depositors pull out #400
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A Medium severity issue.
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
ThePharmacist
Medium
Base pools can get bricked if depositors pull out
Summary
In case depositors pull their funds out of the pool, due to rounding, there can be
TotalDepositAssets > 0
whileTotalDepositShares == 0
. This would completely brick thedeposit
function of the pool and the pool would not be functional anymore. This can lead to attackers being able to disable a pool since the start of it's initialization.Root Cause
in
withdraw:350
, theasset
toshare
conversion is rounded up. This can allow the subtraction inwithdraw:364
to reduce theshare
amount to zero whileassets
can stay more than zero.This state causes every
convertToShares
to lead to zero for deposit assets, hence, bricking thedeposit
function with the errorPool_ZeroSharesDeposit
.Internal pre-conditions
totalDepositAssets
>totalDepositShares
External pre-conditions
N/A
Attack Path
1
inTotalDepositAssets == 1 && TotalDepositShares == 0
holds trueImpact
Attacker can create all the possible pools for a certain address and brick them all. This stops the target address from creating any more pools. However, new pools can be created from other addresses and be transferred too the victim. This bug can break certain usecases and allow adversaries to target certain users/protocol and launch DoS against them.
PoC
The log outputs for the PoC below:
Which shows the final
Total Deposit Assets 1
andTotal Deposit Shares 0
which bricks the victim pool.Mitigation
The protocol should check and only allow state transitions that make
assets
orshares
0 only if the other one is also 0.The text was updated successfully, but these errors were encountered: