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: 90/183
Findings: 2
Award: $22.16
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 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
If cr
drops below 1e18
, since liquidator will have to burn his dyad
but receives less assets, no one will have incentive to liquidate others.
In the function liquidate
, if collatRatio(id)
is below 1e18
, no rewards will be given to liquidator and he may also suffer from losses.
dyad.burn(id, msg.sender, dyad.mintedDyad(address(this), id)); uint cappedCr = cr < 1e18 ? 1e18 : cr; uint liquidationEquityShare = (cappedCr - 1e18).mulWadDown(LIQUIDATION_REWARD); uint liquidationAssetShare = (liquidationEquityShare + 1e18).divWadDown(cappedCr);
As a result, no one will have incentive to liquidate others, causing bad debts.
Manual
This is more of a design issue, may be add bots
to liquidate these bad debts automatically.
Math
#0 - c4-pre-sort
2024-04-28T10:09:32Z
JustDravee marked the issue as duplicate of #977
#1 - c4-pre-sort
2024-04-29T09:23:36Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-04T09:44:04Z
koolexcrypto changed the severity to QA (Quality Assurance)
#3 - c4-judge
2024-05-12T09:23:56Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#4 - c4-judge
2024-05-12T09:44:58Z
koolexcrypto marked the issue as grade-c
#5 - c4-judge
2024-05-28T16:20:18Z
This previously downgraded issue has been upgraded by koolexcrypto
#6 - c4-judge
2024-05-28T16:21:34Z
koolexcrypto marked the issue as satisfactory
🌟 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
According to the design, if the Total Value Locked (TVL)
is high, the price of Kerosene
would be higher. Conversely, if the TVL
decreases, such as when a whale exits the game, the price of Kerosene
would also decrease. This effect is particularly pronounced if a malicious user deposits a large sum of assets without minting any Dyad
. This action could artificially inflate the price of Kerosene
. Then, when other users deposit their assets along with Kerosene
to reach beyond the Minimum Collateralization Ratio (MIN_COLLATERIZATION_RATIO)
, the malicious user could simply withdraw all his deposited assets. This withdrawal would lead to an immediate drop in the price of Kerosene
, potentially causing liquidation for other users.
According to design, Kerosene is as valuable as the degree of DYAD’s over-collateralization.
function assetPrice() public view override returns (uint) { uint tvl; address[] memory vaults = kerosineManager.getVaults(); uint numberOfVaults = vaults.length; for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[i]); @=> tvl += vault.asset().balanceOf(address(vault)) * vault.assetPrice() * 1e18 / (10**vault.asset().decimals()) / (10**vault.oracle().decimals()); } @=> uint numerator = tvl - dyad.totalSupply(); uint denominator = kerosineDenominator.denominator(); return numerator * 1e8 / denominator; }
If the Total Value Locked (TVL)
is high, the price of Kerosene
would be higher. Conversely, if the TVL
decreases, such as when a whale exits the game, the price of Kerosene
would also decrease.
If a malicious user deposits large sum of assets without minting any Dyad
, the price of Kerosene
could be manipulated:
Currently there are only 5% of Kerosene
(50M tokens) in circulation according to etherscan stats, if the attack deposits $10M
worth of assets into the protocol, the price of Kerosene
would increase by $0.2
.
When others have deposited their assets+Kerosene
to reach beyond MIN_COLLATERIZATION_RATIO
, the malicious user could simply withdraw all his deposited assets and cause an instant price drop of Kerosene
, triggering potential liquidation.
Manual, VScode
The calculation of TVL should only include the assets of users who have actually minted enough dyad
tokens to prevent manipulation. (Maybe A threshold of Collateralization Ratio could be set to filter out the qualified.)
Math
#0 - c4-pre-sort
2024-04-28T05:50:54Z
JustDravee marked the issue as duplicate of #67
#1 - c4-pre-sort
2024-04-29T09:17:27Z
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:02Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#4 - c4-judge
2024-05-08T12:05:34Z
koolexcrypto marked the issue as satisfactory