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: 127/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
Judge has assessed an item in Issue #1082 as 2 risk. The relevant finding follows:
[L-01] Deposit() can deposit to any vault might result in dos in function Deposittakes a vault address & id as argument but doesnt perform any owner checks,possibly allowing anyone to deposit to any id corresponding vault.
function deposit( uint id, address vault, uint amount ) external isValidDNft(id) { idToBlockOfLastDeposit[id] = block.number; Vault _vault = Vault(vault); _vault.asset().safeTransferFrom(msg.sender, address(vault), amount); _vault.deposit(id, amount); }
However,the vulnerability arises when a legitimate user wants to withdraw their funds
function withdraw( uint id, address vault, uint amount, address to ) public isDNftOwner(id) { if (idToBlockOfLastDeposit[id] == block.number) revert DepositedInSameBlock();
In the withdraw function theres a check where it (idToBlockOfLastDeposit[id] == block.number) a malicious user can deposit a small amount to the legit user whos trying to withdraw their funds,reverting the transaction. Consider adding a grace period or msg sender check.
#0 - c4-judge
2024-05-05T19:12:30Z
koolexcrypto marked the issue as duplicate of #489
#1 - c4-judge
2024-05-05T20:38:06Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#2 - c4-judge
2024-05-05T21:06:21Z
koolexcrypto marked the issue as nullified
#3 - c4-judge
2024-05-05T21:06:30Z
koolexcrypto marked the issue as not nullified
#4 - c4-judge
2024-05-08T15:30:07Z
koolexcrypto marked the issue as duplicate of #1001
#5 - c4-judge
2024-05-11T19:45:15Z
koolexcrypto marked the issue as satisfactory
#6 - c4-judge
2024-05-13T18:34:30Z
koolexcrypto changed the severity to 3 (High Risk)
🌟 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
Judge has assessed an item in Issue #1082 as 2 risk. The relevant finding follows:
[L-02] Remove Vault can be susceptible to dos in the function remove
function remove( uint id, address vault ) external isDNftOwner(id) { if (Vault(vault).id2asset(id) > 0) revert VaultHasAssets(); if (!vaults[id].remove(vault)) revert VaultNotAdded(); emit Removed(id, vault); }
if (Vault(vault).id2asset(id) > 0) revert VaultHasAssets(); will cause revertion if a attacker deposits to the vault making the user not be able remove the vault, resulting in dos.
#0 - c4-judge
2024-05-05T19:12:47Z
koolexcrypto marked the issue as duplicate of #489
#1 - c4-judge
2024-05-05T20:38:06Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#2 - c4-judge
2024-05-05T21:06:03Z
koolexcrypto marked the issue as nullified
#3 - c4-judge
2024-05-05T21:06:09Z
koolexcrypto marked the issue as not nullified
#4 - c4-judge
2024-05-08T15:30:08Z
koolexcrypto marked the issue as duplicate of #1001
#5 - c4-judge
2024-05-11T19:45:16Z
koolexcrypto marked the issue as satisfactory
#6 - c4-judge
2024-05-13T18:34:30Z
koolexcrypto changed the severity to 3 (High Risk)
🌟 Selected for report: carrotsmuggler
Also found by: 0xAlix2, 0xSecuri, 0xblack_bird, 0xnev, AM, Al-Qa-qa, AlexCzm, Dudex_2004, Egis_Security, GalloDaSballo, Infect3d, Jorgect, KupiaSec, Ryonen, SpicyMeatball, T1MOH, VAD37, adam-idarrha, amaron, cu5t0mpeo, d3e4, darksnow, forgebyola, foxb868, itsabinashb, jesjupyter, nnez, peanuts, pontifex, wangxx2026, windhustler, zhuying
4.8719 USDC - $4.87
https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L1561-L1694 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L1561-L1694
Users collateral ratio will be manipulated making any legit user liquidatable, Causing loss of funds for the user.
MIN_COLLATERIZATION_RATIO = 1.5e18
Bob identifies Alice as a potential target.
Bob aims to decrease Alice's collateral ratio just below the (1e18) to fully close her position by minting DYAD tokens to her balance.
Bob mint mints 625,000 DYAD token to Alice token balance. Manipulating her collateral ratio to go below 1e18.
Bob then calls liquidate on Alice, system calculates liquidity share ie, 100% in this case.
Alice gets fully liquidated, while Bob gets full asset from Alice as liquidation reward.
Manual review
consider adding an input for the id for the to
address in the mint
function and checking this specific id-collateral ratio.
dont forget to ensure input checks for the new to_id
& a different modifier to check ensure correct ownership.
function mintDyad( uint id, uint amount, + uint to_id address to ) external isDNftOwner(id) { uint newDyadMinted = dyad.mintedDyad(address(this), id) + amount; if (getNonKeroseneValue(id) < newDyadMinted) revert NotEnoughExoCollat(); dyad.mint(id, to, amount); - if (collatRatio(id) < MIN_COLLATERIZATION_RATIO) revert CrTooLow(); + if (collatRatio(to_id) < MIN_COLLATERIZATION_RATIO) revert CrTooLow(); emit MintDyad(id, amount, to); }
Other
#0 - c4-pre-sort
2024-04-28T19:55:54Z
JustDravee marked the issue as duplicate of #67
#1 - c4-pre-sort
2024-04-29T09:06:21Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-05T09:59:11Z
koolexcrypto changed the severity to 2 (Med Risk)
#3 - c4-judge
2024-05-08T11:50:01Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#4 - c4-judge
2024-05-08T12:09:02Z
koolexcrypto marked the issue as satisfactory