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: 158/183
Findings: 1
Award: $0.28
🌟 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
VaultManagerV2::collatRatio()
used the totalUsdValue of the collateral of the specified Id to determine the calculation, user who made deposit and have addedv the same vault in both VaultManagerV2::add()
and VaultManagerV2::addKerosene()
will have their collateral being referenced twice in collatRatio
calculation.
(this is possible because weth and westh are added in both kerosenemanager.sol and licenser.sol)
VaultManagerV2::getNonKeroseneValue()
and VaultManagerV2::getKeroseneValue()
both individually referenced the same collateral and return the same value seperately which was then added together in VaultManagerV2::getTotalUsdValue()
. this will raise the collateral ratio calculation to keep returning a value above 150% of their collateral and can never get liquidated, which in the real case the collateral to the dyadMinted ratio is 100% or below.
This will break the protocol invariant of TVL > dyad
kerosene manager adding the two collateral here in the deploy script
Vault Licenser adding the two collateral here also in the deploy script
copy and paste file in test/fork folder and run with forge t --mt testCollateral_Ratio_Return_Double -vv
foundry
The team should mitigate this risk by making sure the calculation of TotalUsdValue is not returning double of the supposed value
Context
#0 - c4-pre-sort
2024-04-29T07:18:20Z
JustDravee marked the issue as sufficient quality report
#1 - c4-pre-sort
2024-04-29T07:18:34Z
JustDravee marked the issue as primary issue
#2 - c4-pre-sort
2024-04-29T07:18:41Z
JustDravee marked the issue as remove high or low quality report
#3 - c4-pre-sort
2024-04-29T07:18:53Z
JustDravee marked the issue as duplicate of #966
#4 - c4-pre-sort
2024-04-29T08:37:10Z
JustDravee marked the issue as sufficient quality report
#5 - c4-judge
2024-05-04T09:46:23Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#6 - c4-judge
2024-05-29T11:20:01Z
koolexcrypto marked the issue as duplicate of #1133
#7 - c4-judge
2024-05-29T14:04:04Z
koolexcrypto marked the issue as satisfactory