DYAD - GalloDaSballo'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: 89/183

Findings: 3

Award: $22.18

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L143-L144

Vulnerability details

Impact

Due to the introduction of the idToBlockOfLastDeposit check, small 1 wei deposits could be sent to all Dyad users as a means to prevent them from withdrawing their positions

https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L143-L144

    if (idToBlockOfLastDeposit[id] == block.number) revert DepositedInSameBlock();

POC

  • Deposit to user via:

https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L119-L127

  function deposit(
    uint    id,
    address vault,
    uint    amount
  ) 
    external 
      isValidDNft(id)
  {
    idToBlockOfLastDeposit[id] = block.number;
  • User can never withdraw

Mitigation

I generally don't recommend block-locks as the main issue with the system seems to be the manipulation of prices, I would recommend working to ensure Kerosene is tamper-proof rather than rely on block-locks which are not particularly effective on mainnet

Assessed type

MEV

#0 - c4-pre-sort

2024-04-28T07:07:05Z

JustDravee marked the issue as duplicate of #489

#1 - c4-pre-sort

2024-04-29T09:25:28Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-05T20:39:26Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#3 - c4-judge

2024-05-05T20:45:35Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2024-05-05T21:48:52Z

koolexcrypto marked the issue as nullified

#5 - c4-judge

2024-05-05T21:48:55Z

koolexcrypto marked the issue as not nullified

#6 - c4-judge

2024-05-08T15:26:45Z

koolexcrypto marked the issue as duplicate of #1001

#7 - c4-judge

2024-05-11T19:49:21Z

koolexcrypto marked the issue as satisfactory

#8 - c4-judge

2024-05-13T18:34:30Z

koolexcrypto changed the severity to 3 (High Risk)

Awards

17.2908 USDC - $17.29

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
:robot:_193_group
duplicate-977

External Links

Lines of code

https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManager.sol#L146-L169

Vulnerability details

Impact

In lack of a mechanism to handle bad debt, any Vault that will be underwater will never be liquidated

This will have a negative impact to the Peg of Dyad

While a 150% CR is very safe, I have demonstrated in Kerosene backing check can mostly be sidestepped that the 1:1 collateral backing can be sidestepped

This means that bad debt, while unlikely, is possible and should not be dismissed as acceptable

Due to the logic in liquidate, 100% of debt must be paid for a certain amount of assets + bonus to be paid out

This fundamentally means that any time the cost of liquidation is too high (due to low premium), liquidations won't happen

Invariant Explanation

The Health of Dyad is based on the collective sum of Collateral / Debt

Not having a way to handle bad debt will mean that over time the Token will have to trade below peg to compensate for it's bad debt backing

Mitigation

Add a way to perform bad debt liquidations and redistribute the bad debt in some way

In lack of that you'll have to have the DAO step in as buyer of last resort being willing to take the losses for these bad debt CDP

I don't recommend this as I'm confident some actors will abuse this to make money off of the DAO

Assessed type

MEV

#0 - c4-pre-sort

2024-04-28T10:07:00Z

JustDravee marked the issue as primary issue

#1 - c4-pre-sort

2024-04-29T09:34:18Z

JustDravee marked the issue as sufficient quality report

#2 - shafu0x

2024-04-30T15:19:34Z

Would this be solved by partial liquidations?

#3 - c4-judge

2024-05-05T11:47:42Z

koolexcrypto marked the issue as duplicate of #1097

#4 - c4-judge

2024-05-08T08:50:14Z

koolexcrypto marked the issue as not a duplicate

#5 - c4-judge

2024-05-08T14:57:09Z

koolexcrypto marked the issue as primary issue

#6 - c4-judge

2024-05-09T12:21:18Z

koolexcrypto marked the issue as duplicate of #977

#7 - c4-judge

2024-05-12T09:23:57Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#8 - c4-judge

2024-05-29T07:02:06Z

koolexcrypto marked the issue as satisfactory

Awards

4.8719 USDC - $4.87

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
:robot:_188_group
duplicate-67

External Links

Lines of code

https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/Vault.kerosine.unbounded.sol#L58-L64

Vulnerability details

Impact

Kerosene backed Vaults will be spot liquidatable at will whenever majority of holders decides to

POC

We can simplify the future state of DYAD to the following:

  • A Benign Majority, of users at or above 150% CR fully with exogenous collateral
  • A minority of users using Kerosene to keep their CR at or above 150%

These minority users, will be at the mercy of the majority

For the sake of argument let's imagine that the Majority has CR at 150% of all of which is exogenous and the Minority has CR at 150%, where 100% of it is exogenous, but 50% is Kerosene

Example representation

The Majority will be able to:

  • Close their position (check is safe since it's not system wide)
  • Cause a dump in the Kerosene value
  • Liquidate the Minority
  • Reopen their position

Mitigation

Kerosene must become tampering resistant before it is usable

For example, the vaults collateralizing kerosene should be aggressively above 150% CR, and should be somewhat locked for some time as to prevent the scenario above from being possible

Assessed type

MEV

#0 - c4-pre-sort

2024-04-28T07:18:45Z

JustDravee marked the issue as duplicate of #67

#1 - c4-pre-sort

2024-04-29T09:06:15Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-08T11:50:08Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#3 - c4-judge

2024-05-08T12:40:57Z

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