This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
roguereddwarf - BaseVault.sol: Users are unable to close loan when oracle is stale or disabled so they cannot withdraw their collateral #33
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Escalation Resolved
This issue's escalations have been approved/rejected
Non-Reward
This issue will not receive a payout
roguereddwarf
medium
BaseVault.sol: Users are unable to close loan when oracle is stale or disabled so they cannot withdraw their collateral
Summary
When users try to withdraw their collateral this triggers a call to
_getCollPrice
which reverts if the oracle is stale or disabled.This is a problem because users will not be able to withdraw their collateral in this case.
When a user has fully reduced his debt meaning
debt=0
, then he should be able to withdraw his collateral without the need for a valid price from the oracle.Even the
emergencyClosePosition
function needs a valid price which should not be the case.Vulnerability Detail
When withdrawing collateral from a loan (either via the
BaseVault.modifyPosition
orBaseVault.emergencyClosePosition
function) theBaseVault._modifyPosition
function will be called.When collateral is withdrawn,
mustCheckHealth
is set to true:https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L313-L321
This means that
_checkAccountHealth
will be called:https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L325-L327
Downstream this then calls
_getOraclePrice
which reverts if there is no valid price:https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L205-L207
Impact
Users are unable to withdraw their collateral when the oracle is stale or disabled even if they have no debt.
Code Snippet
https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L276-L328
https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L198-L208
Tool used
Manual Review
Recommendation
In the
BaseVault._modifyPosition
function, thecheckAccountHealth
function (which needs a valid price downstream) should only be called whenuserDetails[_account].debt > 0
:Duplicate of #184
The text was updated successfully, but these errors were encountered: