You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
I have noticed several validations missing or not robust enough in the protocol that could impact the behavior and lead to unexpected results. I have grouped all of them together in this one submission.
Vulnerability Detail
addCollateralType and queueCollateralChange should validate the _interestPer3Min >= DIVISION_BASE (1e18), otherwise the virtualPrice will always be 0 (or impossible to update):
vaultUpdateVirtualPriceAndTime does not verify the invariant mentioned in the docs:
"Vaults should only be able to interact with the collateral relating to their AssetType."
addCollateralType does not check if liquidityPoolOf[_currencyKey] already exists, it always overrides with a new one:
liquidityPoolOf[_currencyKey]= _liquidityPool;
callLiquidation could have a slippage control parameter where liquidators can specify what minimum reward amount satisfies them.
Synths closeLoan does not validate that if not all the loan is repaid, the remaining USD borrowed is >= ONE_HUNDRED_DOLLARS.
closeLoan and callLiquidation in Velo vault does not validate that _loanNFTs entries are unique (not repeated).
Impact
All these missing validations could result in a protocol misbehaving if these edge conditions are triggered.
For example, if the virtual price becomes 0, it will be impossible to open new or close existing loans or even liquidate because the interest calculation will revert (division by 0):
The code should be robust enough to handle every possible case that can be anticipated. Consider applying the aforementioned validations and improvements.
To remove the escalation from consideration: Delete your comment.
To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
Although issue 5 is valid, multiple issues should not be combined into a single issue.
Escalations of such nature may not be considered valid in future.
Although issue 5 is valid, multiple issues should not be combined into a single issue.
Escalations of such nature may not be considered valid in future.
This issue's escalations have been accepted!
Contestants' payouts and scores will be updated according to the changes made on this issue.
HonorLt
medium
Missing or not entirely correct validations
Summary
I have noticed several validations missing or not robust enough in the protocol that could impact the behavior and lead to unexpected results. I have grouped all of them together in this one submission.
Vulnerability Detail
addCollateralType
andqueueCollateralChange
should validate the_interestPer3Min >= DIVISION_BASE (1e18)
, otherwise thevirtualPrice
will always be 0 (or impossible to update):_checkDailyMaxLoans
should be<=
:closeLoan
should be>=
:getOraclePrice
price boundaries should be inclusive<=
and>=
:getOraclePrice
does not validate stale roundrequire(answeredInRound >= roundID, "Stale round");
:vaultUpdateVirtualPriceAndTime
does not verify the invariant mentioned in the docs:"Vaults should only be able to interact with the collateral relating to their AssetType."
should have something like this:
addCollateralType
does not check ifliquidityPoolOf[_currencyKey]
already exists, it always overrides with a new one:liquidityPoolOf[_currencyKey]= _liquidityPool;
callLiquidation
could have a slippage control parameter where liquidators can specify what minimum reward amount satisfies them.Synths
closeLoan
does not validate that if not all the loan is repaid, the remaining USD borrowed is>= ONE_HUNDRED_DOLLARS
.closeLoan
andcallLiquidation
in Velo vault does not validate that_loanNFTs
entries are unique (not repeated).Impact
All these missing validations could result in a protocol misbehaving if these edge conditions are triggered.
For example, if the virtual price becomes 0, it will be impossible to open new or close existing loans or even liquidate because the interest calculation will revert (division by 0):
Code Snippet
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L293
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L100
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L268
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Base_ERC20.sol#L152
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Velo.sol#L206
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Lyra.sol#L234
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Synths.sol#L226
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Velo.sol#L559
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Velo-Deposit-Tokens/contracts/DepositReceipt_Base.sol#L157-L181
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L243-L251
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L319
Tool used
Manual Review
Recommendation
The code should be robust enough to handle every possible case that can be anticipated. Consider applying the aforementioned validations and improvements.
Duplicate of #200
The text was updated successfully, but these errors were encountered: