Collateral assets sent to InsuranceFund by MarginAccount will be frozen #36
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L377
Vulnerability details
Impact
The assets sent to InsuranceFund by MarginAccount's
settleBadDebt
will remain frozen there as there are no means implemented to recover them even manually.Proof of Concept
MarginAccount's
settleBadDebt
is used to clear an underfunded account.It's pushing VUSD debt to the insuranceFund and then transferring all the account's collateral there as well:
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L377
However, insuranceFund have no ability to manipulate these collateral tokens:
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/InsuranceFund.sol#L39-L85
I.e. deposit/withdrawal, record/settle bad debt is the only functionality implemented.
Even manual retrieval by governance of the collateral tokens sent to the InsuranceFund doesn't seem to be possible.
Recommended Mitigation Steps
Consider adding a manual retrieval function as the first and the simplest step.
Then, as relying on fully manual and off-the-contract process isn't advised, consider an introduction of an asset liquidation function, so the InsuranceFund be able to sell chosen assets (specifying minimum prices to receive from the market as a function argument) to obtain the reserve asset of the VUSD token and then mint VUSD.
The text was updated successfully, but these errors were encountered: