Liquidating positions with bounded Kerosen could be unprofitable for liquidators
Liquidators who seize bounded Kerosene tokens cannot withdraw them, so the seized collateral is worth less than the amount they pay to liquidate. This could make liquidations of positions containing bounded Kerosene unprofitable, discouraging liquidators.
Bounded Kerosene is not attractive for liquidation. First of all bounded kerosene has twice the value of unbounded kerosene. For example, if 1 Kerosene is worth 10 usd in the unbounded vault then 0.5 Kerosen will be worth the same amount in a bounded vault.
Twice the valuation is justified for users and Liquidity Providers. The problem however, is if we take the perspective of a liquidator. If he liquidates a position that has a significant percentage of the position value in bounded Kerosene Vault. The liquidator will receive the amount locked in the bounded kerosene vault, which he can’t withdraw; so the liquidator actually wouldn’t be necessary be able to swap the kerosene against stable coins to make a profit, for example. He will also receive half the amount of kerosene if this was an unbounded kerosene Vault. This might not be clear, so we encourage the reader to see the following example to understand the need to rework liquidations for bounded kerosene vaults.
Please note that there is a bug in the liquidate() function and Kerosene Collateral are not sent to the liquidator. As I have confirmed with the sponsor, the protocol is intended to send the Kerosene Tokens to the liquidators alongside the seized Eth.
Proof of Concept
As an example to show the huge disadvantage a liquidator will face when liquidating bounded kerosene vs unbounded kerosene vs exo collateral (like eth), let’s take similar context but with different composition of collateral.
Collateral worth 1.4k and minted dyad is worth 1k usd: -> collRatio = 140 % which is eligible for liquidation. The percentage of coll to seize is 100%+ 40%*20%)/140% => 77.14% of collateral to seize.
For simplicity, let’s say 1 unbounded kerosene Token is worth 100 usd and 1 bounded kerosene token is worth 200 usd (twice the asset price) in the vaults as collateral (however, the value of Kerosene outside the vaults in exchanges is gonna be near the 100 usd valuation).
The liquidator needs to pay down 1k dyads (1k usd).
| Bounded Kerosene | Unbounded Kerosene | Eth (no Kerosene) |
Collateral composition | 1k worth of eth + 2 kerosene Tokens | 1k worth of eth + 4 kerosene Tokens | 1.4k usd worth of eth |
Seized coll | 771 usd worth of eth + 1.54 Kerosene Token (not withdrawable) | 771 usd worth of eth + 3.08 Kerosene Tokens(withdrawable) | 1.08k usd worth of eth |
USD worth of seized collateral | 925 usd (154 usd value is locked, not tradable) | 1.08k usd | 1.08 k usd |
Recommendation
Having twice the value for kerosene if locked, might make sense for Protocol user, this however, will result in problems for liquidators. We recommend the protocol to implement a solution that addresses the following issues:
Liquidators of kerosene type collateral, should always be able to withdraw the token (whether seized from bounded or unbounded Vaults)
When calculating the amount of tokens to seize (incentive), Kerosene tokens should be valued the same, for unbounded and bounded kerosene Vaults, so it would make economic sense for the liquidator
@Koolex - I still think this is a high severity bug and for the following reasons:
Impact: High -> Unprofitable liquidations always have a high impact.
Likeliness: High -> Bounded Kerosene is a huge part of the new protocol update, and users are incentivized (2x Valuation) to lock their Kerosene Tokens in bounded Vaults; which would lead to a high likeliness of positions with bounded Kerosene Vaults in them becoming eligible for liquidation.
I’m unsure how this issue is in scope given it first requires speculating on how the sponsor will mitigate the underlying issue (that neither Kerosene type is handled during liquidations).
In fact, KeroseneVault (inherited by bounded & unbounded vaults) has a move function which assumedly was supposed to be used to move Kerosene on liquidation meaning the liquidators would still receive bounded Kerosene.
function move(
uint from,
uint to,
uint amount
)
external
onlyVaultManager
{
id2asset[from] -= amount;
id2asset[to] += amount;
emit Move(from, to, amount);
}
The profitability of taking on BoundedKerosene is a decision to be made by the liquidator, and given that the liquidator is expected to also own a Note nft rather than a traditional liquidation bot, it’s likely they would also value owning bounded Kerosene.
The issue basically boils down to the opinion that “liquidators don’t want bounded Kerosene” and I don’t think is our job to decide whether that’s the case or not.
Additionally, the recommended mitigation of unlocking bounded Kerosene completely defeats the purpose of having bounded/unbounded kerosene and users would be able to enjoy the benefits of 2x valued Kerosene as collateral, and then liquidate themselves when they wished to withdraw their “bounded” Kerosene.
Leaving as Medium severity since it is explicitly known (by docs, code) that bounded can’t be withdrawn. One could argue that, liquidators could be aware of this and choose not to liquidate. Furthermore, liquidators could liquidate to accumulate bounded kerosene to utilize in the protocol for enhancing the CR. So, it is not completely unprofitable.
The original report as published on Code4rena, by alix40. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the liquidation logic values bounded Kerosene at twice the price of unbounded Kerosene but does not allow liquidators to withdraw the seized bounded tokens, so the seized collateral is worth less than the debt repaid.
What the attacker needed
Position contains bounded Kerosene; position is eligible for liquidation
The fix
The report recommends making seized Kerosene withdrawable and valuing bounded and unbounded Kerosene equally when calculating the amount to seize.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
In some lending systems, when a borrower's collateral falls below a required level, anyone can repay the debt and take a portion of the collateral as a reward. This report says that if the collateral includes a special token that is locked and cannot be withdrawn, the person doing the liquidation may end up with less value than they paid, so they might not want to do it.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.