This repository has been archived by the owner on May 26, 2023. It is now read-only.
chaduke - A borrower might receive ZERO underlying tokens after burning his shares in pos.underlyingVaultShare
.
#56
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
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
chaduke
medium
A borrower might receive ZERO underlying tokens after burning his shares in
pos.underlyingVaultShare
.Summary
A borrower might receive ZERO underlying tokens after burning his shares in
pos.underlyingVaultShare
.Vulnerability Detail
We show how a borrower might receive ZERO underlying tokens after burning his shares in
pos.underlyingVaultShare
or receive much less tokens than these shares are worth.Suppose Bob has a position:
pos.underlyingVaultShare = 100
,pos.underlyingAmount = 5000
, and suppose that now each vault share is worth 100 underlying tokens.Bob will call
BlueBerryBank.withdrawLend
(via execute and then via SPELL) to withdraw 50 shares. As a result, he will get (5000-fee) underlying tokens. and thenpos.underlyingAmount = 0
,pos.underlyingVaultShare = 50
(L697-L699)https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/BlueBerryBank.sol#L669-L704
wAmount
will be set to zero due topos.underlyingAmount = 0
. Ifpos.underlyingAmount
has a small value, only that small amount will be sent back to Bob.Impact
A borrower might receive ZERO collateral tokens after burning his shares in
pos.underlyingVaultShare
, or he might receive much less underlying tokens than his shares deserve.Code Snippet
See above
Tool used
Remix
Manual Review
Recommendation
The withdrawn underlying tokens should be all sent to the user because he earns it.
Duplicate of #109
The text was updated successfully, but these errors were encountered: