Open c4-bot-8 opened 7 months ago
JustDravee marked the issue as duplicate of #1048
JustDravee marked the issue as not a duplicate
JustDravee marked the issue as primary issue
JustDravee marked the issue as high quality report
Good find. This is correct.
koolexcrypto marked the issue as satisfactory
koolexcrypto marked the issue as selected for report
This issue should be a dup or partial-50 of #397 .
This issue talks only about the missing oracle function on the kerosene tokens, the return value of the oracle call is used only to calculate the value
variable which isused only on the unnecessary check that is highlighted on issue #397.
So, the root reason for calling the kerosene oracle (which will be removed because the price of Kerosene is not determined by the market) is just a preparation for making the unnecessary check highlighted on #397
Hi @Brivan-26
Thank you for your input.
This issue is about the missing oracle
.
if (getNonKeroseneValue(id) - value < dyadMinted) revert NotEnoughExoCollat();
which prevents withdrawing kerosene unless you have non-kerosene value.
Completely different root causes. So this stays the same.
Lines of code
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L148
Vulnerability details
Impact
VaultManagerV2
has onewithdraw
function responsible for withdrawing both exogenous collateral (weth/wsteth) and endogenous collateral (Kerosene). However the function expects thevault
passed as an argument to have anoracle
method. This is the case forVault
contracts, but not the case for theBoundedKerosineVault
orUnboundedKerosineVault
contracts. This means that whenever a user attempts to withdraw Kerosene deposited into the contract the call will revert, meaning the Kerosene remains stuck in the contract permanently.Proof Of Concept Add the following test to
v2.t.sol
to highlight this.The test reverts with the following stack traces:
Recommended Mitigation Given that the
value
of exogenous and endogenous collateral is calculated differently it is necessary to handle withdrawal of exogenous collteral and Kerosene differently. It would avoid added complexity to the function logic to have two differentwithdraw
andwithdrawKerosene
functions.Assessed type
Other