This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
xiaoming90 - No minimum borrow size check against secondary debts #212
Labels
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
xiaoming90
medium
No minimum borrow size check against secondary debts
Summary
Secondary debts were not checked against the minimum borrow size during exit, which could lead to accounts with insufficient debt becoming insolvent and the protocol incurring bad debts.
Vulnerability Detail
https://github.com/sherlock-audit/2023-03-notional-0xleastwood/blob/main/contracts-v2/contracts/internal/vaults/VaultAccount.sol#L140
A vault account has one primary debt (
accountDebtUnderlying
) and one or more secondary debts (accountDebtOne
andaccountDebtTwo
).When a vault account exits the vault, Notional will check that its primary debt (
accountDebtUnderlying
) meets the minimum borrow size requirement. If a vault account wants to exit under the minimum borrow size it must fully exit so that we do not have dust accounts that become insolvent. This check is being performed in Line 140 above.However, this check is not performed against the secondary debts. As a result, it is possible that the secondary debts fall below the minimum borrow size after exiting.
Impact
Vault accounts with debt below the minimum borrow size are at risk of becoming insolvent, leaving the protocol with bad debts.
Code Snippet
https://github.com/sherlock-audit/2023-03-notional-0xleastwood/blob/main/contracts-v2/contracts/internal/vaults/VaultAccount.sol#L140
Tool used
Manual Review
Recommendation
Consider performing a similar check against the secondary debts (
accountDebtOne
andaccountDebtTwo
) within the_setVaultAccount
function to ensure they do not fall below the minimum borrow size.The text was updated successfully, but these errors were encountered: