Skip to content
Business logic Audit finding Beginner

Assets sent from MarginAccount to InsuranceFund will be locked forever

The InsuranceFund contract lacks a function to transfer non-VUSD tokens, so any such assets sent to it become stuck. An attacker could not directly exploit this, but assets sent by mistake or design would be locked.

0xliumin Follow

Originally disclosed on Code4rena

Submitted by 0xliumin, also found by hyh, minhquanym, and WatchPug

https://github.com/code-423n4/2022-02-hubble/blob/ed1d885d5dbc2eae24e43c3ecbf291a0f5a52765/contracts/MarginAccount.sol#L377

Assets sent from MarginAccount to InsuranceFund will be locked forever.

Proof of Concept

The insurance fund doesn’t have a way to transfer non-vusd out of the contract.

Assets transferred to the InsuranceFund will be locked forever.

Recommended Mitigation Steps

Have a way for governance to sweep tokens to swap them.

atvanguard (Hubble) confirmed and commented:

Yes, this a known issue and already on our roadmap.

moose-code (judge) commented:

The insurance fund contract is also upgradeable so it’s a fairly simple fix upgrade and to sweep the tokens out when the time comes - i.e. tokens won’t be lost forever. Still would be better to have it in from the start to avoid this process. Considering moving to medium. Assessing other issues first, will circle back.

moose-code (judge) decreased severity to Medium and commented:

Moving to medium as contracts are upgradeable so the tokens can always be collected later. If the contract was non-upgradeable I would have left as high.


The original report as published on Code4rena, by 0xliumin. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

Assets sent to the InsuranceFund are locked forever, though the contract is upgradeable so they could be recovered later via an upgrade.

What the attacker needed

Assets sent to InsuranceFund

The fix

Add a governance function to sweep non-VUSD tokens out of the InsuranceFund.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract can hold tokens, but without a function to send them out, those tokens are stuck forever. Here, the InsuranceFund contract can receive tokens other than VUSD but has no way to move them, so they are effectively lost.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0xliumin

View all

5 more disclosed reports, best first.

More from Hubble contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.