DYAD - dinkras'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: 145/183

Findings: 2

Award: $3.84

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of Code

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

IMPACT

DOS of all withdrawals in a given block thus manipulating the Kerosine price in certain conditions

Proof of concept

An attacker can block all withdrawals txs in a given block by frontrunning the users who want to withdraw and call deposit() with 0 wei and the victim's nft Ids. The flash loan prevention mechanism forbids the users to deposit and withdraw at the same block. This will lead to reverts when the victims try to withdraw.

Since the Kerosine price is calculated with the tvl of all exocollateral assets in mind, in case of huge sum withdrawals from users, the attacker can block their withdrawals -> manipulate the Kerosine price and take advantage of the price.

Redeeming Dyad functionality could also be blocked for the current block with this approach.

This is all possible because anyone can deposit with someone else's NFT with the combination of the flash loan prevention mechanism of DYAD protocol.

Tools used

Manual review

Reccomended Mitigation Steps

Add a isDNftOwner(id) modifier in VaultManagerV2.deposit() so only the NFT owner can deposit

Assessed Type

DOS

#0 - thebrittfactor

2024-04-25T20:11:11Z

For transparency, this submission was provided to C4 staff prior to audit close to be submitted on the wardens behalf.

#1 - c4-pre-sort

2024-04-28T19:42:11Z

JustDravee marked the issue as duplicate of #489

#2 - c4-pre-sort

2024-04-29T09:25:51Z

JustDravee marked the issue as sufficient quality report

#3 - c4-judge

2024-05-05T20:38:06Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2024-05-05T21:07:39Z

koolexcrypto marked the issue as nullified

#5 - c4-judge

2024-05-05T21:07:45Z

koolexcrypto marked the issue as not nullified

#6 - c4-judge

2024-05-08T15:30:06Z

koolexcrypto marked the issue as duplicate of #1001

#7 - c4-judge

2024-05-11T19:45:12Z

koolexcrypto marked the issue as satisfactory

#8 - c4-judge

2024-05-13T18:34:30Z

koolexcrypto changed the severity to 3 (High Risk)

Awards

3.8221 USDC - $3.82

Labels

bug
3 (High Risk)
satisfactory
sufficient quality report
:robot:_28_group
duplicate-830

External Links

Lines of Code:

https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L146-L150 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/Vault.kerosine.unbounded.sol#L15

Impact

All deposited Kerosine tokens inside Vault.kerosine.unbounded.sol get stuck and cannot be withdrawn by anyone

Proof of Concept

When a user tries to withdraw his Kerosine tokens from a Kerosine vault he calls the VaultManagerV2.withdraw(). When calculating the value(L 146) the _vault.oracle() field is used for the calculation. However this field does not exist inside Vault.kerosine.unbounded.sol and an EVM error is thrown. As a result all withdraw txs of Kerosine tokens are reverted. This leads to frozen funds https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L146-L150

POC: https://gist.github.com/dinkras/8d4508b34c9f33487a2e2027011a6ac6

Tools Used

Manual review

Implement withdraw specific logic for the Kerosin vault in VaultManagerV2.sol

Assessed Type

DOS

#0 - thebrittfactor

2024-04-25T20:09:41Z

For transparency, this submission was provided to C4 staff prior to audit close to be submitted on the wardens behalf.

#1 - c4-pre-sort

2024-04-26T21:32:30Z

JustDravee marked the issue as duplicate of #1048

#2 - c4-pre-sort

2024-04-28T18:39:34Z

JustDravee marked the issue as duplicate of #830

#3 - c4-pre-sort

2024-04-29T08:45:18Z

JustDravee marked the issue as sufficient quality report

#4 - c4-judge

2024-05-11T20:05:46Z

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