Closed c4-bot-9 closed 6 months ago
JustDravee marked the issue as high quality report
JustDravee marked the issue as primary issue
A users' ability to shield themselves from liquidation with kerosene is considered a feature, not a bug. Even if kerosene's utilization reached 100%, protocol wide overcollat would still be 125%
@shafu0x I suggest we label issue 1027 as sponsor disputed
.
koolexcrypto marked the issue as duplicate of #308
koolexcrypto marked the issue as not a duplicate
koolexcrypto marked the issue as duplicate of #338
koolexcrypto marked the issue as satisfactory
This report outlines more clearly that the issue here is specifically about overall protocol health (maintaining the > 1:1 ratio between collateral and dyad minted), avoiding large scale liquidations / stablecoin depegging.
I believe this report should be considered as the primary issue for this duplicate group, if not a separate issue entirely given that the the root of the issue outlined here is the protocols inability to adequately handle significant downwards ETH price action (all positions are effectively ETH longs). Adding the ability to liquidate positions with a sub 1:1 ratio is the suggested mitigation to keep the protocol healthy rather than the root cause as outlined the in the current primary issue.
Thank you for the feedback.
After reviewing, I still believe the main issue stands, as it is a bit clearer and easier to understand.
Lines of code
https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L214
Vulnerability details
Impact
VaultManagerV2
checks a DNft's exogenous collateral is at least equal to their amount of minted Dyad in bothwithdraw
andmintDyad
. However after the Dyad is minted there is nothing to require that that ratio remains at least 1:1. This is because to liquidate a user it is only necessary that their collateralization ratio falls belowMIN_COLLATERIZATION_RATIO
which can be covered by the users Kerosene holdings.Furthermore as all the collateral in the protocol will be significantly correlated to the price of Ether, if the price of Ether was to drop a large amount it would very likely mean that multiple users drop below the 1:1 exogenous collateral to dyad minted ratio, potentially resulting in the overall TVL of the protocol falling below the amount of dyad minted. This breaks the main invariant of the protocol and would lead to the stable coin being undercollateralized.
As well as this,
UnboundedKeroseneVault::assetPrice
relies on TVL being greater thandyad.totalSupply
as the following calculation will otherwise cause an underflow revert:Proof of Concept Testing this is currently complicated because of the existing issue of
dyad.totalSupply()
being non-zero based on dyad minted from the original VaultManager contract.However the idea is relatively simple:
Add the following test to
v2.t.sol
for an example highlighting this:The test returns the following error:
Recommended Mitigation It's likely necessary that
VaultManagerV2::liquidate
considers a DNft at risk of liquidation if it's collateral ratio is < 150% OR it's exogenous collateral ratio is below 100%. This would protect the Dyad stable coin from being under collateralised as users would be able to liquidate these positions and return the tvl:dyad supply ratio back to a positive one.Assessed type
Other