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: 55/183
Findings: 3
Award: $223.00
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: MrPotatoMagic
Also found by: 0xtankr, ArmedGoose, Egis_Security, Giorgio, KYP, Maroutis, NentoR, OMEN, Sabit, Shubham, SpicyMeatball, T1MOH, d3e4, dimulski, peanuts
200.8376 USDC - $200.84
Detailed description of the impact of this finding.
uint cappedCr = cr < 1e18 ? 1e18 : cr; uint liquidationEquityShare = (cappedCr - 1e18).mulWadDown(LIQUIDATION_REWARD); uint liquidationAssetShare = (liquidationEquityShare + 1e18).divWadDown(cappedCr);
let's asuume cr (collater ratio) is 120 percent right now . This means anyone can call the liquidation .
cr --------->> 1.2 e18
cappedCr --------->> 1.2 e18 (cause cr > 1e18)
liquidationEquityShare -------->> 0.2 e18 * 0.2 e18 /1e18 -------->> 0.04 e18
liquidationAssetShare -------->> (0.04 + 1) e18 * 1e18 / 1.2 e18 -------->> 0.86667 e18
for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[id].at(i)); uint collateral = vault.id2asset(id).mulWadUp(liquidationAssetShare); vault.move(id, to, collateral); }
let's assume vault.id2asset(id) is 120 usd worth of weth
collateral ----------->>> 120 e18 * 0.8667 e18 / 1e18 ----------->>> 104.004 e18
liquidator will get 104 usd worth of collateral .And the rest collateral(16 usd value worth of weth) are still remaining in vault and can claim by vault owner with burning dyad.When collateral ratio become below 100 percent , there is no incentive for liquidation call .This will cause the bad debt for protocol. Instead of returing surplus collateral from liquidation into vault owners , protocol should use those surplus collateral in bad debt distribution.
manual view
pls use surplus collateral from liquidation for bad debt handling instead of sending bad debt to liquidators
Context
#0 - c4-pre-sort
2024-04-28T17:31:15Z
JustDravee marked the issue as duplicate of #456
#1 - c4-pre-sort
2024-04-29T09:31:24Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-12T08:57:39Z
koolexcrypto marked the issue as not a duplicate
#3 - c4-judge
2024-05-12T08:57:47Z
koolexcrypto marked the issue as duplicate of #1097
#4 - c4-judge
2024-05-12T09:18:18Z
koolexcrypto marked the issue as satisfactory
🌟 Selected for report: Infect3d
Also found by: 0x486776, 0xAlix2, 0xleadwizard, 0xnilay, Abdessamed, ArmedGoose, Bauchibred, Bigsam, GalloDaSballo, HChang26, Myrault, OMEN, SBSecurity, T1MOH, ZanyBonzy, alix40, atoko, iamandreiski, jesjupyter, ke1caM, miaowu, peanuts, vahdrak1
17.2908 USDC - $17.29
There is no incentives to call liquidation and this will cause the bad debt for protocol.
uint cappedCr = cr < 1e18 ? 1e18 : cr; uint liquidationEquityShare = (cappedCr - 1e18).mulWadDown(LIQUIDATION_REWARD); uint liquidationAssetShare = (liquidationEquityShare + 1e18).divWadDown(cappedCr);
let's asuume cr (collater ratio) is 90 percent right now . This means anyone can call the liquidation .
cr --------->> 0.9 e18
cappedCr --------->> 1 e18 (cause cr < 1e18)
liquidationEquityShare -------->> 0
liquidationAssetShare -------->> (0 + 1) e18 * 1e18 / 1 e18 -------->> 1 e18
for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[id].at(i)); uint collateral = vault.id2asset(id).mulWadUp(liquidationAssetShare); vault.move(id, to, collateral); }
let's assume vault.id2asset(id) is 90 usd worth of weth
collateral ----------->>> 90 e18 * 1 e18 / 1e18 ----------->>> 90 e18
liquidator burnt 100 dyad and get back 90 usd value worth of collateral.So no one gonna call the liquidate if collateral ratio is below 100 percent.
collateral ratio can drop a large amount due to following facts
1.protocol use weth as collateral , so there could be depegging event .Price will drop significantly .and eth price will drop due to that . 2.kerosene is based on these collateral price.If collateral price dropping significantly will make kersene dropping.
manual view
pls make sure liquidator will not have loss when call liquidation and implement bad debt distribution system.
Context
#0 - c4-pre-sort
2024-04-28T17:27:56Z
JustDravee marked the issue as duplicate of #456
#1 - c4-pre-sort
2024-04-29T09:31:24Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-12T09:09:18Z
koolexcrypto marked the issue as unsatisfactory: Insufficient proof
#3 - c4-judge
2024-05-28T16:04:09Z
koolexcrypto marked the issue as duplicate of #977
#4 - c4-judge
2024-05-29T07:02:43Z
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
There is no incentives to call liquidation on small dyad amount position and this will cause bad debt for protocol.
` function mintDyad( uint id, uint amount, 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(); emit MintDyad(id, amount, to); }`
When minting dyad stable coin , there is no minimum amount to mint .This will be problem for incentives to call liquidation .
Malicious user mint small enough dyad amount .In ethereum , gas price is really high when transactions are too much . So it will be loss to call that small enough dyad amount position .Due to lack of liquidation call on undercollateralized position , there will be bad debt for protocol.
manual view
set minimum amount
Context
#0 - c4-pre-sort
2024-04-27T13:30:22Z
JustDravee marked the issue as duplicate of #1258
#1 - c4-pre-sort
2024-04-29T09:16:46Z
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-12T09:32:59Z
koolexcrypto marked the issue as grade-c
#4 - c4-judge
2024-05-22T14:26:07Z
This previously downgraded issue has been upgraded by koolexcrypto
#5 - c4-judge
2024-05-28T16:52:03Z
koolexcrypto marked the issue as satisfactory
#6 - c4-judge
2024-05-28T20:06:15Z
koolexcrypto marked the issue as duplicate of #175