This repository has been archived by the owner on May 26, 2023. It is now read-only.
0Kage - Interest component of underlying amount is not withdrawable using the withdrawLend
function. Such amount is permanently locked in the BlueBerryBank contract
#109
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High 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
0Kage
high
Interest component of underlying amount is not withdrawable using the
withdrawLend
function. Such amount is permanently locked in the BlueBerryBank contractSummary
Soft vault shares are issued against interest bearing tokens issued by
Compound
protocol in exchange for underlying deposits. However,withdrawLend
function caps the withdrawable amount to initial underlying deposited by user (pos.underlyingAmount
). Capping underlying amount to initial underlying deposited would mean that a user can burn all his vault shares inwithdrawLend
function and only receive original underlying deposited.Interest accrued component received from Soft vault (that rightfully belongs to the user) is no longer retrievable because the underlying vault shares are already burnt. Loss to the users is permanent as such interest amount sits permanently locked in Blueberry bank.
Vulnerability Detail
withdrawLend
function inBlueBerryBank
allows users to withdraw underlying amount fromHard
orSoft
vaults.Soft
vault shares are backed by interest bearingcTokens
issued by Compound ProtocolUser can request underlying by specifying
shareAmount
. When user tries to send the maximumshareAmount
to withdraw all the lent amount, notice that the amount withdrawable is limited to thepos.underlyingAmount
(original deposit made by the user).While this is the case, notice also that the full
shareAmount
is deducted fromunderlyingVaultShare
. User cannot recover remaining funds because in the next call, user doesn't have any vault shares against his address. Interest accrued component on the underlying that was returned bySoftVault
toBlueberryBank
never makes it back to the original lender.Impact
Every time, user withdraws underlying from a Soft vault, interest component gets trapped in BlueBerry contract. Here is a scenario.
SoftVault
using thelend
function of BlueberryBank at T=0In the whole process, Alice has lost access to 50 USDC.
Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/BlueBerryBank.sol#L693
Tool used
Manual Review
Recommendation
Introduced a new variable to adjust positions & removed cap on withdraw amount.
Highlighted changes I recommend to withdrawLend with //******//.
The text was updated successfully, but these errors were encountered: