Open sherlock-admin opened 1 year ago
Valid issue, transfers during supposedly permissionless settlement can indeed cause issues.
@0xleastwood + @xiaoming9090: PR 135 attempted to fix the issue by removing the transfer of excess assets from the settlement. It will store the excess assets to be refunded in s.primaryCash
so that it can be read to vaultAccount.tempCashBalance
later when exiting the vault (VaultAccountAction.exitVault
). The transfer of excess assets will be performed during the exit vault.
However, in an edge case where a liquidator deleverages another account and happens to have primary cash in their vault account, their s.primaryCash
(excess cash) will be wiped.
Following is the function call flow for reference:
deleverageAccount
-> _transferVaultSharesToLiquidator
-> liquidator.setVaultAccount
-> Effect: liquidator's s.primaryCash = 0
@0xleastwood + @xiaoming9090: Verified fix as per comments in #207. Fixed in https://github.com/notional-finance/contracts-v2/pull/135
ShadowForce
medium
Cannot permissionless settle the vault account if the user use a blacklisted account
Summary
Cannot permissionless settle the vault account if the user use a blacklisted account
Vulnerability Detail
In VaultAccoutnAction.sol, one of the critical function is
as the comment suggests, this function should be called permissionless
and the comment is, which means there should not be able to permissionless reject account settlement
this is calling
which calls
basically this calls
calling
the token withdrawal logic above try to push ETH to accout
this is calling
note the function call
if the token type is not ETHER,
we are transfer the underlying ERC20 token to the account
the token in-scoped is
USDC is common token that has blacklisted
if the account is blacklisted, the transfer would revert and the account cannot be settled!
Impact
what are the impact,
per comment
if that is too vague, I can list three, there are more!
https://github.com/notional-finance/contracts-v2/blob/b20a45c912785fab5f2b62992e5260f44dbae197/contracts/external/actions/VaultLiquidationAction.sol#L229
Code Snippet
https://github.com/notional-finance/contracts-v2/blob/b20a45c912785fab5f2b62992e5260f44dbae197/contracts/internal/balances/TokenHandler.sol#L241
Tool used
Manual Review
Recommendation
maybe let admin bypass the withdrawPrimeCash and force settle the account to not let settlement block further action!