Decimal token underflow could produce loss of funds
The GUniLPOracle contract performs a decimal subtraction that can underflow when a pool token has more than 18 decimals. This could cause errors when the oracle calculates price values.
Submitted by 0x1f8b, also found by broccolirob and pauliax
It is possible to produce underflows with specific tokens which can cause errors when calculating prices.
Proof of Concept
The pragma is pragma solidity 0.6.12; therefore, integer overflows must be protected with safe math. But in the case of GUniLPOracle, there is a decimal subtraction that could underflow if any token in the pool has more than 18 decimals. This could cause an error when calculating price values.
Recommended Mitigation Steps
Ensure that tokens have less than 18 decimals.
m19 (Mimo DeFi) confirmed and commented:
We confirm this issue.
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
Impact
Price calculations could error out for pools containing tokens with more than 18 decimals, which the report frames as a possible loss of funds.
What the attacker needed
A pool token with more than 18 decimals
The fix
The report recommends ensuring that tokens have fewer than 18 decimals.
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 that runs on a blockchain. This one works out the price of a pool of tokens, and it subtracts a number based on how many decimal places the tokens use. If a token uses more than 18 decimal places, that subtraction goes below zero, which the code does not handle, so the price calculation can fail.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.