dany.armstrong90 - SuperPool doesn't strictly comply with ERC-4626. #129
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Medium
A Medium severity issue.
Reward
A payout will be made for this issue
Sponsor Disputed
The sponsor disputed this issue's validity
Won't Fix
The sponsor confirmed this issue will not be fixed
dany.armstrong90
Medium
SuperPool doesn't strictly comply with ERC-4626.
Summary
SuperPool.maxWithdraw()
andSuperPool.maxRedeem()
functions returns incorrect values.This means
SuperPool
doesn't strictly comply with ERC-4626.Vulnerability Detail
SuperPool.maxWithdraw()
andSuperPool.maxRedeem()
functions calls the following_maxWithdraw()
function.As can be seen, the above function use liquidity of pool as withdrawable maximum assets in
L478
.On the other hand,
SuperPool.withdraw()
andSuperPool.redeem()
function calls_withdraw()
function and_withdraw()
function calls in turn the following_withdrawFromPools()
function to withdraw assets from deposited pools.As can be seen, the above function use minimum of
assetsInPool
andpoolLiquidity
as withdrawable maximum assets (L563
andL567
) which is less than the value of_maxWithdraw()
function.PoC:
pool1
has100
total deposited shares,1000
total deposited assets and500
total borrowed assets. Sopool1
has1000 - 500
liquidity.pool2
has100
total deposited shares,1000
total deposited assets and1000
total borrowed assets. Sopool2
has1000 - 1000 = 0
liquidity.SuperPool
has10
shares in thepool1
and10
shares in thepool2
.SuperPool
has100
total supply(total shares) and a user has100
shares inSuperPool
which means that the user has100%
shares ofSuperPool
.SuperPool
has10 * 1000 / 100 + 10 * 1000 / 100 = 200
total assets in the underlying pools which is equal touserAssets
ofL483
andassets
ofL548
.totalLiquidity
ofL484
is0 + 500 = 500
and_maxWithdraw()
returnsmin(200, 500) = 200
.withdrawAmt
ofL567
ismin(500, 100) = 100
forpool1
andmin(0, 100) = 0
forpool2
. Therefore_withdrawFromPools()
function withdraw totally100
assets from underlying pools which is smaller than200
of_maxWithdraw()
function.Impact
The
README.md#L161
stated as follows.However SuperPool doesn't strictly comply with ERC-4626.
Code Snippet
https://github.com/sherlock-audit/2024-08-sentiment-v2/blob/main/protocol-v2/src/SuperPool.sol#L478
Tool used
Manual Review
Recommendation
Modify
SuperPool._maxWithdraw()
function as follows.Duplicate of #110
The text was updated successfully, but these errors were encountered: