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
Rank: 125/183
Findings: 2
Award: $4.89
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: MrPotatoMagic
Also found by: 0x175, 0x486776, 0x77, 0xAkira, 0xAsen, 0xDemon, 0xabhay, 0xblack_bird, 0xlemon, 0xloscar01, 0xtankr, 3docSec, 4rdiii, Abdessamed, AlexCzm, Angry_Mustache_Man, BiasedMerc, Circolors, Cryptor, DMoore, DPS, DedOhWale, Dinesh11G, Dots, GalloDaSballo, Giorgio, Honour, Imp, Jorgect, Krace, KupiaSec, Mrxstrange, NentoR, Pechenite, PoeAudits, Ryonen, SBSecurity, Sabit, T1MOH, TheFabled, TheSavageTeddy, Tychai0s, VAD37, Vasquez, WildSniper, ZanyBonzy, adam-idarrha, alix40, asui, blutorque, btk, c0pp3rscr3w3r, caglankaan, carrotsmuggler, d_tony7470, dimulski, dinkras, djxploit, falconhoof, forgebyola, grearlake, imare, itsabinashb, josephdara, kartik_giri_47538, ke1caM, kennedy1030, koo, lionking927, ljj, niser93, pep7siup, poslednaya, ptsanev, sashik_eth, shaflow2, steadyman, turvy_fuzz, ubl4nk, valentin_s2304, web3km, xyz, y4y, zhaojohnson, zigtur
0.0234 USDC - $0.02
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L119-L126
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
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
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"
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
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
🌟 Selected for report: dimulski
Also found by: 0xleadwizard, 0xlemon, Aamir, Al-Qa-qa, AvantGard, Bauchibred, Cryptor, DarkTower, Egis_Security, Giorgio, Maroutis, MrPotatoMagic, OMEN, Ocean_Sky, Ryonen, SBSecurity, Sabit, SpicyMeatball, Stefanov, T1MOH, Tigerfrake, WildSniper, atoko, bhilare_, darksnow, fandonov, grearlake, iamandreiski, igdbase, pontifex, web3km, xiao
4.8719 USDC - $4.87
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
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
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
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
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