DYAD - Daniel526's results

The first capital efficient overcollateralized stablecoin.

General Information

Platform: Code4rena

Start Date: 18/04/2024

Pot Size: $36,500 USDC

Total HM: 19

Participants: 183

Period: 7 days

Judge: Koolex

Id: 367

League: ETH

DYAD

Findings Distribution

Researcher Performance

Rank: 157/183

Findings: 1

Award: $0.28

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L156-L169

Vulnerability details

Impact

The impact of this vulnerability is that users could exploit the system to mint dyad tokens based on inflated collateral values, leading to an imbalance between minted dyad tokens and the actual value of collateral backing them. This could undermine the stability and integrity of the DeFi system, potentially resulting in losses for users and destabilization of the ecosystem.

Proof of Concept

The vulnerability arises from the possibility of depositing multiple assets into separate vaults associated with the same dNFT position and then minting dyad tokens against the total collateral value across all vaults. The contract logic, particularly in the mintDyad function, does not adequately account for this scenario, potentially allowing users to over-collateralize and mint dyad tokens based on duplicated collateral.

Here's the relevant section of the code:

function mintDyad(
    uint    id,
    uint    amount,
    address to
  )
    external 
      isDNftOwner(id)
  {
    uint newDyadMinted = dyad.mintedDyad(address(this), id) + amount;
    if (getNonKeroseneValue(id) < newDyadMinted)     revert NotEnoughExoCollat();
    dyad.mint(id, to, amount);
    if (collatRatio(id) < MIN_COLLATERIZATION_RATIO) revert CrTooLow(); 
    emit MintDyad(id, amount, to);
  }

In this function, newDyadMinted calculates the total dyad tokens minted after the new minting operation. However, it does not consider the possibility of multiple vaults associated with the same dNFT, potentially leading to an incorrect calculation of the total collateral value. For example, if a user has two vaults attached to their dNFT position, each containing 100 units of asset A and asset B respectively, they could potentially deposit both assets as collateral and mint dyad tokens against the combined value of 200 units of asset A and 200 units of asset B, even though they only have 100 units of each asset in total.

Tools Used

Manual

The contract should implement a mechanism to track the total collateral value across all vaults associated with a particular dNFT position. This mechanism would ensure that the minting of dyad tokens cannot exceed the total collateral value, thereby preventing over-collateralization and double-spending.

Assessed type

Context

#0 - c4-pre-sort

2024-04-28T07:02:37Z

JustDravee marked the issue as duplicate of #966

#1 - c4-pre-sort

2024-04-29T08:37:19Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-04T09:46:23Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#3 - c4-judge

2024-05-29T11:20:00Z

koolexcrypto marked the issue as duplicate of #1133

#4 - c4-judge

2024-05-29T11:43:21Z

koolexcrypto changed the severity to 3 (High Risk)

#5 - c4-judge

2024-05-29T14:04:00Z

koolexcrypto marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter