DYAD - WildSniper'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: 125/183

Findings: 2

Award: $4.89

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Impact

complete freeze of all user funds as long as the attacker wants unless the position of the user is liquidated which leads to definite loss of extra 20% of collateral as the reward for liquidator as the user has no choice to withdraw collateral or redeemDyad

Attack Vectors

1- A malicious actor is planning an attack on protocol users to liquidate them whenever market crash to take advantage of extra 20% value

2- A malicious Actor is planning large social media attack about the protocol i.e (that he cant withdraw is funds or that the protocol got hacked) and when all users go to withdraw or redeem they always revert giving only one chance for users to get a usd value of their DYAD (they simply dumb it in LP available) a malicious actor can then buy DYAD at very low prices and redeem them for collateral such attacks can hurt the protocol reputation for ever as the end user wont be interested in the root cause of the attack

Proof of Concept

An attacker with MEV bot can track MemePool for any interactions associated with VaultManagerV2.sol if he sees any withdrawal withdraw() or redeemDyad() request he can front run their request with a deposit() request using the victim dNFT ID taking advantage of line deposit https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L127 and Line https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L143 in withdraw

as stated in the above line (to deposit you only need to put a valid dNFT id, which will be the victim ID) so that the mapping mapping (uint => uint) public idToBlockOfLastDeposit; gets updated

then normal user transaction that got front Rund revert with the condition if (idToBlockOfLastDeposit[id] == block.number) revert DepositedInSameBlock(); the attacker can deposit only 1 wei of token value since there is no minimum Deposit amount making the attack more feasible and profitable as stated in the Attack Vectors

picture of illustrative drawing https://imgur.com/a/8M9bOaD and link of the excalidraw "https://excalidraw.com/#json=RyNlB_ebFkCl8t9o2T3t7,-sd6R2IiZ04ZXsz0O0TKmw"

Tools Used

manual review

the conditional line is put to prevent flashLoad attacks we wont change it we want to add isDNftOwner() modifier on top of deposit() function

Assessed type

DoS

#0 - c4-pre-sort

2024-04-27T11:55:57Z

JustDravee marked the issue as duplicate of #489

#1 - c4-pre-sort

2024-04-29T09:28:43Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-05T20:41:17Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#3 - c4-judge

2024-05-05T20:42:01Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2024-05-05T20:45:37Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#5 - c4-judge

2024-05-05T21:53:50Z

koolexcrypto marked the issue as nullified

#6 - c4-judge

2024-05-05T21:53:56Z

koolexcrypto marked the issue as not nullified

#7 - c4-judge

2024-05-08T15:26:36Z

koolexcrypto marked the issue as duplicate of #1001

#8 - c4-judge

2024-05-11T19:48:56Z

koolexcrypto marked the issue as satisfactory

Awards

4.8719 USDC - $4.87

Labels

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

External Links

Lines of code

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

Vulnerability details

Impact

small size collaterals don't give an incentive for liquidators to liquidate their collateral gradually leading build up of those positions and in the same time the value of the collateral keeps decreasing leading to loss of underlying usd value of DYAD stable coin

Proof of Concept

uint public constant LIQUIDATION_REWARD = 0.2e18;
the reward is 20% of any extra collateral left above the 1 to 1 value of DYAD, but this is not the case in small positions like (80$ of ETH) and minting 50 DYAD, if his eth decrease in value to 70$ not its liquidatable $50 of value goes to liquidator vault and 20% of the extra 20$ (5$) which doesn't even cover the ETH Mainnet fees

Tools Used

manual review

adding fixed payment for liquidators to barely cover fees + a liquidation reward to incentivize their job. i know this should be capital efficient stable coin but we cant risk its de-peg we can take the fixed fee from depositors to Disincentive them to keep their collateral as liquidatable and if they withdraw they can get their fee back through an accounting logic

Assessed type

Other

#0 - c4-pre-sort

2024-04-29T05:58:15Z

JustDravee marked the issue as duplicate of #1258

#1 - c4-pre-sort

2024-04-29T09:08:40Z

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-22T14:26:07Z

This previously downgraded issue has been upgraded by koolexcrypto

#4 - c4-judge

2024-05-28T16:51:22Z

koolexcrypto marked the issue as satisfactory

#5 - c4-judge

2024-05-28T20:05:57Z

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