VaderReserve.reimburseImpermanentLoss improperly converts USDV to VADER
The VaderReserve contract's reimburseImpermanentLoss function incorrectly converts an amount denominated in USDV to VADER by dividing by usdvPrice, which is unrelated to the VADER price. This causes the reserve to pay out an incorrect amount of VADER once a USDV price reading exists.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
IL isn’t properly converted from being in terms of USDV to VADER, resulting in reserve paying out incorrect amount.
Proof of Concept
VaderReserve.reimburseImpermanentLoss receives an amount in terms of USDV and converts this to an amount of VADER to send to recipient.
However as shown in the link if there is a previous price stored for USDV, the amount of VADER tokens to be sent to the recipient is amount / usdvPrice.
usdvPrice is the total USD value of foreign assets divided by the total amount of USDV in a number of pairs. It’s then some measure of the inverse of the price of USDV in USD, nothing to do with converting into VADER.
The reserve will then improperly calculate the amount of VADER to pay out once there is a single reading of the USDV price.
Recommended Mitigation Steps
It looks like both branches of this if statement are supposed to be run, i.e. convert from USDV to USD and then to VADER but I can’t be sure. Care should be taken so that the calculation being performed is the expected one.
SamSteinGG (Vader) acknowledged
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 conversion logic mistakenly uses usdvPrice (a measure of USDV's price) instead of a VADER price when calculating the VADER amount to send.
Impact
Once a USDV price reading exists, the reserve could pay out an incorrect amount of VADER, potentially draining or misallocating funds.
What the attacker needed
A single reading of the USDV price exists
The fix
The conversion should be corrected so that the amount is properly converted from USDV to USD and then to VADER, ensuring the calculation matches the intended logic.
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.
This is a smart contract bug where a function that is supposed to convert one token (USDV) into another (VADER) uses the wrong price. Instead of using the VADER price, it uses a value that measures the USDV price, so the amount sent out is wrong. Someone calling the function could receive too much or too little VADER.
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.