DYAD - Sabit'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: 57/183

Findings: 3

Award: $205.73

🌟 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/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L215-L215

Vulnerability details

Impact

It is impossible to liquidate a user with the highest minted DYAD when such a user is undercollateralized

Proof of Concept

To liquidate an undercollateralized user, the liquidator must substract the equivalence of the minted DYAD of the user being liquidated from his balance.

dyad.burn(id, msg.sender, dyad.mintedDyad(address(this), id));

And here is the burn function:

function burn( uint id, address from, uint amount ) external licensedVaultManager { _burn(from, amount); mintedDyad[msg.sender][id] -= amount; }

What the above means is that the total minted DYAD burnt from the user being liquidated (dyad.mintedDyad(address(this), id)) is the same amount that must be substracted from the liquidator.

The liquidate function does not provide for liquidation in small amounts.

The problem this design creates is that when a user with a high or the highest minted DYAD amount is undercollateralized, it's impossible for anyone to liquidate the user. This is because no one would have the needed DYAD tokens to liquidate the undercollateralized user.

Tools Used

Manual review

I suggest that liquidating in small amount should be implemented.

Assessed type

Context

#0 - c4-pre-sort

2024-04-29T05:52:56Z

JustDravee marked the issue as duplicate of #1097

#1 - c4-pre-sort

2024-04-29T08:34:41Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-11T12:22:05Z

koolexcrypto marked the issue as satisfactory

Lines of code

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

Vulnerability details

Impact

Arbitrary user can temporarily block owner from withdrawing

Proof of Concept

The withdraw function prevents withdrawals in the same block as a deposit. This allows anyone to DoS the owner by making ridiculously small deposits to block withdrawals.

Note that anyone can call the deposit function since the isValidDNft modifier only checks for a valid "id" and not the owner.

Tools Used

Manual review

I suggest a check that if deposit is not done by the owner, it shouldn't block the owner from calling the withdraw function.

Assessed type

DoS

#0 - c4-pre-sort

2024-04-27T11:54:45Z

JustDravee marked the issue as duplicate of #489

#1 - c4-pre-sort

2024-04-29T09:29:00Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-05T20:39:25Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#3 - c4-judge

2024-05-05T20:39:59Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2024-05-05T21:45:45Z

koolexcrypto marked the issue as nullified

#5 - c4-judge

2024-05-05T21:45:49Z

koolexcrypto marked the issue as not nullified

#6 - c4-judge

2024-05-08T15:26:49Z

koolexcrypto marked the issue as duplicate of #1001

#7 - c4-judge

2024-05-11T19:49:33Z

koolexcrypto marked the issue as satisfactory

#8 - c4-judge

2024-05-13T18:34:30Z

koolexcrypto changed the severity to 3 (High Risk)

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/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L205-L229

Vulnerability details

Impact

The protocol can be undercollateralized and users not being able to withdraw their funds.

Proof of Concept

Liquidators call the liquidate functio for the profit and not for anything else. There is 20% bonus for every liquidation. However, there are cases of small positions where a user only has $2, $3 worth of value in their position.

Liquidators won't want to liquidate such positions because the position value doesn't even cover gas fees.

These low value acccounts will never get liquidated leaving the protocol with bad debt.

Tools Used

Manual review

I suggest allowing users to mint if their collateral value is above a particular threshold.

Assessed type

Error

#0 - c4-pre-sort

2024-04-27T17:35:19Z

JustDravee marked the issue as duplicate of #1258

#1 - c4-pre-sort

2024-04-29T09:16:41Z

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:13Z

koolexcrypto marked the issue as grade-b

#4 - c4-judge

2024-05-12T09:32:32Z

koolexcrypto marked the issue as grade-c

#5 - c4-judge

2024-05-22T14:26:07Z

This previously downgraded issue has been upgraded by koolexcrypto

#6 - c4-judge

2024-05-28T16:51:31Z

koolexcrypto marked the issue as satisfactory

#7 - c4-judge

2024-05-28T20:06:00Z

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