DYAD - OMEN'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: 55/183

Findings: 3

Award: $223.00

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

200.8376 USDC - $200.84

Labels

bug
3 (High Risk)
satisfactory
sufficient quality report
:robot:_11_group
duplicate-1097

External Links

Lines of code

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

Vulnerability details

Impact

Detailed description of the impact of this finding.

Proof of Concept

uint cappedCr = cr < 1e18 ? 1e18 : cr; uint liquidationEquityShare = (cappedCr - 1e18).mulWadDown(LIQUIDATION_REWARD); uint liquidationAssetShare = (liquidationEquityShare + 1e18).divWadDown(cappedCr);

let's asuume cr (collater ratio) is 120 percent right now . This means anyone can call the liquidation .

cr --------->> 1.2 e18

cappedCr --------->> 1.2 e18 (cause cr > 1e18)

liquidationEquityShare -------->> 0.2 e18 * 0.2 e18 /1e18 -------->> 0.04 e18

liquidationAssetShare -------->> (0.04 + 1) e18 * 1e18 / 1.2 e18 -------->> 0.86667 e18

for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[id].at(i)); uint collateral = vault.id2asset(id).mulWadUp(liquidationAssetShare); vault.move(id, to, collateral); }

let's assume vault.id2asset(id) is 120 usd worth of weth

collateral ----------->>> 120 e18 * 0.8667 e18 / 1e18 ----------->>> 104.004 e18

liquidator will get 104 usd worth of collateral .And the rest collateral(16 usd value worth of weth) are still remaining in vault and can claim by vault owner with burning dyad.When collateral ratio become below 100 percent , there is no incentive for liquidation call .This will cause the bad debt for protocol. Instead of returing surplus collateral from liquidation into vault owners , protocol should use those surplus collateral in bad debt distribution.

  1. protocol make sure liquidator didn't lose funds when liquidation is called
  2. when bad debt occur , protocol should use surplus collateral from liquidation to handle it .

Tools Used

manual view

pls use surplus collateral from liquidation for bad debt handling instead of sending bad debt to liquidators

Assessed type

Context

#0 - c4-pre-sort

2024-04-28T17:31:15Z

JustDravee marked the issue as duplicate of #456

#1 - c4-pre-sort

2024-04-29T09:31:24Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-12T08:57:39Z

koolexcrypto marked the issue as not a duplicate

#3 - c4-judge

2024-05-12T08:57:47Z

koolexcrypto marked the issue as duplicate of #1097

#4 - c4-judge

2024-05-12T09:18:18Z

koolexcrypto marked the issue as satisfactory

Awards

17.2908 USDC - $17.29

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
edited-by-warden
:robot:_11_group
duplicate-977

External Links

Lines of code

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

Vulnerability details

Impact

There is no incentives to call liquidation and this will cause the bad debt for protocol.

Proof of Concept

uint cappedCr = cr < 1e18 ? 1e18 : cr; uint liquidationEquityShare = (cappedCr - 1e18).mulWadDown(LIQUIDATION_REWARD); uint liquidationAssetShare = (liquidationEquityShare + 1e18).divWadDown(cappedCr);

let's asuume cr (collater ratio) is 90 percent right now . This means anyone can call the liquidation .

cr --------->> 0.9 e18

cappedCr --------->> 1 e18 (cause cr < 1e18)

liquidationEquityShare -------->> 0

liquidationAssetShare -------->> (0 + 1) e18 * 1e18 / 1 e18 -------->> 1 e18

for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[id].at(i)); uint collateral = vault.id2asset(id).mulWadUp(liquidationAssetShare); vault.move(id, to, collateral); }

let's assume vault.id2asset(id) is 90 usd worth of weth

collateral ----------->>> 90 e18 * 1 e18 / 1e18 ----------->>> 90 e18

liquidator burnt 100 dyad and get back 90 usd value worth of collateral.So no one gonna call the liquidate if collateral ratio is below 100 percent.

collateral ratio can drop a large amount due to following facts

1.protocol use weth as collateral , so there could be depegging event .Price will drop significantly .and eth price will drop due to that . 2.kerosene is based on these collateral price.If collateral price dropping significantly will make kersene dropping.

Tools Used

manual view

pls make sure liquidator will not have loss when call liquidation and implement bad debt distribution system.

Assessed type

Context

#0 - c4-pre-sort

2024-04-28T17:27:56Z

JustDravee marked the issue as duplicate of #456

#1 - c4-pre-sort

2024-04-29T09:31:24Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-12T09:09:18Z

koolexcrypto marked the issue as unsatisfactory: Insufficient proof

#3 - c4-judge

2024-05-28T16:04:09Z

koolexcrypto marked the issue as duplicate of #977

#4 - c4-judge

2024-05-29T07:02:43Z

koolexcrypto marked the issue as satisfactory

Awards

4.8719 USDC - $4.87

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
:robot:_11_group
duplicate-175

External Links

Lines of code

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

Vulnerability details

Impact

There is no incentives to call liquidation on small dyad amount position and this will cause bad debt for protocol.

Proof of Concept

` 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); }`

When minting dyad stable coin , there is no minimum amount to mint .This will be problem for incentives to call liquidation .

Malicious user mint small enough dyad amount .In ethereum , gas price is really high when transactions are too much . So it will be loss to call that small enough dyad amount position .Due to lack of liquidation call on undercollateralized position , there will be bad debt for protocol.

Tools Used

manual view

set minimum amount

Assessed type

Context

#0 - c4-pre-sort

2024-04-27T13:30:22Z

JustDravee marked the issue as duplicate of #1258

#1 - c4-pre-sort

2024-04-29T09:16:46Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-03T14:07:47Z

koolexcrypto changed the severity to QA (Quality Assurance)

#3 - c4-judge

2024-05-12T09:32:59Z

koolexcrypto marked the issue as grade-c

#4 - c4-judge

2024-05-22T14:26:07Z

This previously downgraded issue has been upgraded by koolexcrypto

#5 - c4-judge

2024-05-28T16:52:03Z

koolexcrypto marked the issue as satisfactory

#6 - c4-judge

2024-05-28T20:06:15Z

koolexcrypto marked the issue as duplicate of #175

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