Closed c4-bot-5 closed 4 months ago
JustDravee marked the issue as sufficient quality report
The value of DYAD in external pools is not relevant to the system. Arbitrage opportunities may arise. Feature, not bug.
@shafu0x I suggest we label issue 610 as sponsor disputed
.
koolexcrypto marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L205-L228 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L230-L239 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L241-L248 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L250-L267 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L269-L286
Vulnerability details
Impact
An off-peg DYAD can result in premature or delayed liquidations. If DYAD's value is inflated, under-collateralized vaults may not be liquidated, posing a risk to the system's integrity. Conversely, if DYAD's value is deflated, vaults may be liquidated unnecessarily, causing undue loss to users.
Proof of Concept
Let's consider a scenario where the DYAD token's price deviates significantly from its pegged value, leading to off-peg conditions. This could occur due to various factors such as market speculation, liquidity issues, or external events impacting the token's value.
In the
VaultManagerV2
contract, the off-peg DYAD scenario could affect the accuracy of USD value calculations, potentially resulting in unfair liquidations. Here's how this scenario might unfold:Off-Peg DYAD Situation
: Assume that the DYAD token's price deviates significantly from its pegged value due to market volatility or other factors. This means that the value of assets held as collateral (in DYAD) within the vaults may be overestimated or underestimated based on the inaccurate DYAD price.Impact on USD Value Calculations
: ThegetTotalUsdValue
,getNonKeroseneValue
, andgetKeroseneValue
functions calculate the total USD value of assets held within the vaults. However, if the DYAD token's price is off-peg, these calculations will be inaccurate because they rely on the DYAD price to convert asset values to USD.Unfair Liquidation
: Inaccurate USD value calculations can lead to incorrect assessments of collateralization ratios (collatRatio
). This might trigger premature or unnecessary liquidations of vaults if the calculated collateralization ratio falls below the minimum threshold (MIN_COLLATERIZATION_RATIO
), even if the actual collateralization level is sufficient when considering the correct DYAD price.The function relies on the USD value of collateral (
getTotalUsdValue(id)
) and the amount of DYAD minted (_dyad
). If the DYAD token's value is off-peg, the USD value of the minted DYAD does not reflect the true debt, leading to an inaccurate collateralization ratio. This ratio is critical for ensuring the system's solvency and triggering liquidations when necessary.Tools Used
Manual
Recommended Mitigation Steps
Implement a mechanism to monitor and enforce the peg of the DYAD token. This could involve a combination of on-chain and off-chain solutions, such as using a reliable oracle to provide the current peg value and adjusting the minting and redemption
Assessed type
Context