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: 63/183
Findings: 3
Award: $126.54
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Maroutis
Also found by: 0x486776, 0xShitgem, 0xabhay, 0xleadwizard, 0xlemon, 0xnilay, 0xtankr, 3docSec, AM, Aamir, Abdessamed, Al-Qa-qa, AlexCzm, Circolors, CodeWasp, Daniel526, Egis_Security, Emmanuel, Giorgio, Honour, Hueber, Infect3d, Krace, KupiaSec, LeoGold, Limbooo, PoeAudits, SBSecurity, SpicyMeatball, T1MOH, The-Seraphs, TheSavageTeddy, TheSchnilch, Topmark, VAD37, ZanyBonzy, adam-idarrha, bhilare_, btk, carlitox477, cinderblock, dimulski, falconhoof, grearlake, gumgumzum, iamandreiski, itsabinashb, josephdara, ke1caM, kennedy1030, ljj, n0kto, n4nika, neocrao, oakcobalt, petro_1912, pontifex, poslednaya, shaflow2, shikhar229169, web3km, ych18, zhaojohnson, zigtur
0.2831 USDC - $0.28
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L230-L239 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L241-L248 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L241-L248 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L269-L286 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L67-L78 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L80-L91 https://github.com/code-423n4/2024-04-dyad/blob/main/script/deploy/Deploy.V2.s.sol#L62-L65 https://github.com/code-423n4/2024-04-dyad/blob/main/script/deploy/Deploy.V2.s.sol#L93-L95
Users can increase their collateralization ratio allowing them to bypass the 150% collateralization ratio requirement and mint DYAD tokens corresponding to a 100% of their collateral value.
The current deployment scripts adds wSTETH
and WETH
vaults to both KerosineManager and VaultLicenser.
This allows users to add the same vault as both a non kerosene and a kerosene vault to their DNFT
making the same deposited collateral count twice in the collatRatio calculation.
Assuming a WETH price of $3000 :
WETH
vault as a non kerosene vault to his DNFT
.WETH
vault as a kerosene vault to his DNFT
.WETH
vault.Manual Review
Create a Kerosene Licenser and use it instead of using the Kerosene Manager for both managing and licensing kerosene vaults.
Other
#0 - c4-pre-sort
2024-04-29T05:20:26Z
JustDravee marked the issue as duplicate of #966
#1 - c4-pre-sort
2024-04-29T08:37:52Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-04T09:46:21Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#3 - c4-judge
2024-05-29T11:20:20Z
koolexcrypto marked the issue as duplicate of #1133
#4 - c4-judge
2024-05-29T11:43:11Z
koolexcrypto marked the issue as satisfactory
🌟 Selected for report: 0xAlix2
Also found by: 0x486776, 0xabhay, 0xlucky, 0xtankr, Abdessamed, Circolors, CodeWasp, DarkTower, Egis_Security, Giorgio, Infect3d, Krace, KupiaSec, Limbooo, Maroutis, NentoR, Ryonen, SpicyMeatball, T1MOH, TheFabled, TheSavageTeddy, TheSchnilch, VAD37, XDZIBECX, btk, carrotsmuggler, cu5t0mpeo, dimulski, gumgumzum, iamandreiski, imare, itsabinashb, ke1caM, kennedy1030, lian886, n4nika, oakcobalt, sashik_eth, shaflow2, steadyman, web3km, windhustler, zhaojohnson
3.8221 USDC - $3.82
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/Vault.kerosine.unbounded.sol#L50-L67 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/Vault.kerosine.bounded.sol#L44-L50 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/Vault.kerosine.sol#L60-L67 https://github.com/code-423n4/2024-04-dyad/blob/main/script/deploy/Deploy.V2.s.sol#L95 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L269-L286 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L230-L239 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L230-L239 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L156-L169 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L184-L202 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L205-L228
The asset price of Kerosine Vaults is based on their TVL and the current total supply of DYAD.
The TVL of the newly deployed vaults is 0 while the current total supply of DYAD is 622967.4.
This will lead to an underflow here.
WETH
and wSTETH
vaults to his DNFT
DNFT
DNFT
UnboundedKerosineVault
vault to his DNFT
VaultManagerV2@liquidate
-> VaultManagerV2@collatRatio
-> VaultManagerV2@getNonKeroseneValue
-> UnboundedKerosineVault@getUsdValue
-> UnboundedKerosineVault@assetPrice
)UnboundedKerosineVault
vault to his DNFT
DNFT
or Alice backruns and deposits a dust amount for Bob's DNFT
VaultManagerV2@mintDyad/withdraw
-> VaultManagerV2@getNonKeroseneValue
-> UnboundedKerosineVault@getUsdValue
-> UnboundedKerosineVault@assetPrice
).UnboundedKerosineVault
for his DNFT
since it has associated collateral in that vault, effectively rendering that DNFT
unusable.Manual Review
Under/Overflow
#0 - c4-pre-sort
2024-04-27T18:22:56Z
JustDravee marked the issue as duplicate of #958
#1 - c4-pre-sort
2024-04-29T08:39:26Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-05T13:48:39Z
koolexcrypto marked the issue as duplicate of #308
#3 - c4-judge
2024-05-11T20:09:27Z
koolexcrypto marked the issue as satisfactory
🌟 Selected for report: Circolors
Also found by: 0xtankr, AamirMK, Al-Qa-qa, FastChecker, Infect3d, SBSecurity, Strausses, T1MOH, VAD37, carrotsmuggler, gumgumzum
122.4433 USDC - $122.44
https://github.com/code-423n4/2024-04-dyad/blob/main/script/deploy/Deploy.V2.s.sol#L36-L113 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/Vault.kerosine.bounded.sol#L44-L50
Calls to BoundedKerosineVault@assetPrice will fail forcing the multi-sig wallet to update the unboundedKerosineVault
for the deployed BoundedKerosineVault
afterwards.
This contradicts the Migration
section in the contest Readme
:
The whole migration is described in Deploy.V2.s.sol. The only transaction that needs to be done by the multi-sig after the deployment is licensing the new Vault Manager.
function assetPrice() public view override returns (uint) { return unboundedKerosineVault.assetPrice() * 2; // <--- @audit }
The call to assetPrice
will fail because the unboundedKerosineVault
is not set (.i.e is still address(0)).
Manual Review
Set unboundedKerosineVault
for the deployed BoundedKerosineVault
in the deployment script.
Other
#0 - c4-pre-sort
2024-04-29T07:52:40Z
JustDravee marked the issue as duplicate of #829
#1 - c4-pre-sort
2024-04-29T09:22:38Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-05T10:52:11Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#3 - c4-judge
2024-05-29T12:33:41Z
koolexcrypto marked the issue as satisfactory