Open c4-bot-7 opened 6 months ago
JustDravee marked the issue as high quality report
JustDravee marked the issue as primary issue
yes, it should only check for dyad minted from v1.
koolexcrypto marked the issue as satisfactory
koolexcrypto marked the issue as selected for report
Please check this comment https://github.com/code-423n4/2024-04-dyad-findings/issues/224#issuecomment-2122476979
CC: @shafu0x
Lines of code
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/Vault.kerosine.unbounded.sol#L50-L68
Vulnerability details
Impact
The protocol expects users to migrate their collateral from V1 vaults to V2 vaults, this significantly increases the TVL of the protocol's V2. At the same time, the Kerosene price depends on the TVL, in
UnboundedKerosineVault::assetPrice
the numerator of the equation is:This will always revert until the TVL becomes > Dyad's supply, which is around 600k. So when users deposit Kerosene in either Kerosene vaults their Kerosene will temporarily get stuck in there.
Proof of Concept
This assumes that a reported bug is fixed, which is using the correct licenser, to overcome this we had to manually change the licenser in
addKerosene
andgetKeroseneValue
.Because of another reported issue, a small change should be made to the code to workaround it, in
VaultManagerV2::withdraw
, replace_vault.oracle().decimals()
with8
This just sets the oracle decimals to a static value of 8.
Test POC:
Make sure to fork the main net and set the block number to
19703450
Tools Used
Manual review
Recommended Mitigation Steps
This is a bit tricky, but I think the most straightforward and logical solution would be to block the usage of the Kerosene vaults (just keep them unlicensed) until enough users migrate their positions from V1, i.e. the TVL reaches the Dyad's total supply. This is discussed with the sponsors.
Assessed type
Under/Overflow