You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Mar 1, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Rebase/FoT tokens are not supported as isolated collateral
Summary
The BlueBerryBank.lend function does not account for rebase/FoT tokens.
Vulnerability Detail
The SoftVault and HardVault contracts are already well prepared to handle rebase/FoT tokens properly. However, the BlueBerryBank.lend function does not account for rebase/FoT tokens and will not work properly with them.
As seen in lines 637-641, amount of the ERC-20 token is transferred from the pos.owner to the BlueBerryBank contract. From this amount, a deposit fee is decremented, and the remaining amount is deposited into the SoftVault or HardVault contract.
However, if the used token is a rebase/FoT ERC-20 token, the received token amount does not reflect the actual amount of tokens transferred. This leads to the incorrect amount of tokens being deposited and accounted for.
While the Blueberry protocol has whitelisting mechanisms in place to restrict the use of arbitrary ERC-20 tokens as isolated collateral, rebase/FoT tokens were likely intended to be supported as isolated collateral due to their support in the SoftVault and HardVault contracts.
Impact
Rebase/FoT tokens are not supported as isolated collateral and can not be used as isolated collateral without incurring accounting issues.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
berndartmueller
medium
Rebase/FoT tokens are not supported as isolated collateral
Summary
The
BlueBerryBank.lend
function does not account for rebase/FoT tokens.Vulnerability Detail
The
SoftVault
andHardVault
contracts are already well prepared to handle rebase/FoT tokens properly. However, theBlueBerryBank.lend
function does not account for rebase/FoT tokens and will not work properly with them.As seen in lines 637-641,
amount
of the ERC-20 token is transferred from thepos.owner
to theBlueBerryBank
contract. From thisamount
, a deposit fee is decremented, and the remaining amount is deposited into theSoftVault
orHardVault
contract.However, if the used
token
is a rebase/FoT ERC-20 token, the received token amount does not reflect the actual amount of tokens transferred. This leads to the incorrect amount of tokens being deposited and accounted for.While the Blueberry protocol has whitelisting mechanisms in place to restrict the use of arbitrary ERC-20 tokens as isolated collateral, rebase/FoT tokens were likely intended to be supported as isolated collateral due to their support in the
SoftVault
andHardVault
contracts.Impact
Rebase/FoT tokens are not supported as isolated collateral and can not be used as isolated collateral without incurring accounting issues.
Code Snippet
BlueBerryBank.sol#L637-L641
SoftVault.sol#L76
As mentioned above, the
SoftVault
contract calculates the actual amount of tokens received after the transfer in line 75.Tool used
Manual Review
Recommendation
Consider calculating the delta of the token balance before and after the transfer and use this delta value as the
amount
to lend out.Duplicate of #153
The text was updated successfully, but these errors were encountered: