Closed github-actions[bot] closed 1 year ago
Duplicate of 363
Liquidity in the lending protocol is always going to be higher than the potential borrowing available to the leverage protocol.
In the event of a liquidity shortfall, the right behavior is to revert. Seems to work as intended
ctf_sec
medium
SoftVault cToken redeem can fail if the underlying token has liquidity shortfall in Compound (fork)
Summary
SoftVault cToken redeem can fail if the underlying token shortfalls
Vulnerability Detail
In the current implementation, the Soft Vault replies on compound based implementation to do lend and redeem
note the function call
https://github.com/compound-finance/compound-protocol/blob/a3214f67b73310d547e00fc578e8355911c9d376/contracts/CErc20.sol#L60
which calls:
which calls:
https://github.com/compound-finance/compound-protocol/blob/a3214f67b73310d547e00fc578e8355911c9d376/contracts/CToken.sol#L456
which calls:
note the function calls:
which calls:
note the check:
If the liquidity short fall happens when utilization rate is high, the redeem can revert,
which blocks the withdrawLend function in BlueBerryBank.sol
Impact
SoftVault.withdraw revert when redeeming from compound fork if the underlying token has liquidity shortfall in Compound (fork)
Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/vault/SoftVault.sol#L88-L123
Tool used
Manual Review
Recommendation
We recommend the protocol monitor the liquidation in underlying cToken and set lending cap to avoid locked fund due to liquidatity shortfall.