Reserve does not properly apply prices of VADER and USDV tokens
The reserve contract multiplied the impermanent-loss amount by an oracle price that is stored as a fixed-point number, without converting it back to a normal integer. Depending on which branch ran, the payout could be 1e18 times too large or too small, so the reserve could pay out far more than it should and lose funds.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
Reserve pays out vastly higher (or lower) IL protection than it should.
Proof of Concept
Consider the lines 98 and 102 as shown on the link below:
Here we multiply the IL experienced by the LP by a price for USDV or VADER as returned by the LBT. However the price from the oracle is a fixed point number (scaled up by 1e8 or 1e18 depending on the resolution of finding “Oracle returns an improperly scaled USDV/VADER price”) and so a fixed scaling factor should be applied to convert back from a fixed point number to a standard integer.
As it stands depending on the branch which is executed, the amount to be reimbursed will be 1e18 times too large or too small. Should the “else” branch be executed the reserve will pay out much in terms of IL protection resulting in severe loss of funds. High severity.
Recommended Mitigation Steps
Apply similar logic to as displayed here:
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 code multiplied by a fixed-point oracle price without dividing by the scaling factor to convert it back to a standard integer.
Impact
The reserve could pay out vastly more than it should in IL protection, resulting in severe loss of funds.
What the attacker needed
Reserve pays IL protection; oracle price is fixed-point
The fix
The price should be converted from a fixed-point number back to a standard integer, using the same scaling logic as in the USDV token contract.
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 is a program on a blockchain that holds and moves funds. This one pays users back for a kind of loss, and it used a price value that is scaled up by a large factor (a fixed-point number) as if it were a plain number. That made the payout wrong by a huge factor, so the contract could send out far too much money.
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.