registerAsset() can overwrite _assetClass value
The registerAsset() function in MochiProfileV0.sol allows anyone to reset the asset class of an already registered asset to AssetClass.Sigma, provided sufficient liquidity. This changes several risk parameters and could lead to unintended liquidations.
Submitted by gpersoon, also found by jonah1005 and leastwood
Impact
Everyone can call the function registerAsset() of MochiProfileV0.sol Assuming the liquidity for the asset is sufficient, registerAsset() will reset the _assetClass of an already registered asset to AssetClass.Sigma.
When the _assetClass is changed to AssetClass.Sigma then liquidationFactor(), riskFactor(), maxCollateralFactor(), liquidationFee() keeperFee() maxFee() will also return a different value. Then the entire vault will behave differently. The threshold for liquidation will also be different, possibly leading to a liquidation that isn’t supposed to happen.
Recommended Mitigation Steps
Add the following in function registerAsset():
require(\_assetClass\[\_asset] ==0,"Already exists");
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the registerAsset() function lacks a check to prevent overwriting an existing asset's class.
Impact
The entire vault will behave differently, and the threshold for liquidation will also be different, possibly leading to a liquidation that isn’t supposed to happen.
What the attacker needed
Sufficient liquidity for the asset
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.
A smart contract function meant to register new assets can be called again for an existing asset, overwriting its category. This changes how the system calculates risk and fees, potentially causing unfair liquidations.
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.