Early user can break addLiquidity
The first liquidity provider can add a tiny amount of liquidity, causing the total liquidity units to be very small, which makes subsequent liquidity additions round down to zero and become impossible. An attacker could thus prevent other users from adding liquidity to the pool.
Submitted by WatchPug
uint256 totalLiquidityUnits = totalSupply;
if (totalLiquidityUnits == 0)
liquidity = nativeDeposit; // TODO: Contact ThorChain on proper approach
In the current implementation, the first liquidity takes the nativeDeposit amount and uses it directly.
However, since this number (totalLiquidityUnits) will later be used for computing the liquidity issued for future addLiquidity using calculateLiquidityUnits.
A malicious user can add liquidity with only 1 wei USDV and making it nearly impossible for future users to add liquidity to the pool.
Recommendation
Uni v2 solved this problem by sending the first 1000 tokens to the zero address.
The same should work here, i.e., on first mint (totalLiquidityUnits == 0), lock some of the first minter’s tokens by minting ~1% of the initial amount to the zero address instead of to the first minter.
Duplicate of #24
Not a duplicate
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 first deposit sets the total liquidity units directly to the deposited amount without locking any minimum, allowing a tiny initial deposit to make future deposits round down to zero.
What the attacker needed
Attacker is first liquidity provider; attacker has a tiny amount of USDV
The fix
The first minter's tokens should be partially locked by minting about 1% of the initial amount to the zero address, similar to Uni v2's approach.
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.
When you add money to a liquidity pool, you get 'liquidity units' that represent your share. The first person to add money sets the initial exchange rate between units and the deposited amount. If they add a very small amount, the total units become tiny, so later deposits are rounded down to zero units, effectively blocking others from joining.
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.