LP pricing formula is vulnerable to flashloan manipulation
The LP token pricing formula in LimboDAO's burnAsset function can be manipulated by swapping a large amount of EYE tokens into the Uniswap pool, inflating the LP token value. An attacker can use a flashloan to temporarily inflate the pool, burn their LP tokens for more fate tokens, and then swap back, gaining extra voting power or profit.
Submitted by shw
The LP pricing formula used in the burnAsset function of LimboDAO is vulnerable to flashloan manipulation. By swapping a large number of EYE into the underlying pool, an attacker can intentionally inflate the value of the LP tokens to get more fate than he is supposed to with a relatively low cost.
With the large portion of fate he gets, he has more voting power to influence the system’s decisions, or even he can convert his fate to Flan tokens for a direct profit.
Proof of Concept
Below is an example of how the attack works:
- Suppose that there are 1000 EYE and 1000 LINK tokens in the UniswapV2 LINK-EYE pool. The pool’s total supply is 1000, and the attacker has 100 LP tokens.
- If the attacker burns his LP tokens, he earns
1000 * 100/1000 * 20 = 2000amount offate. - Instead, the attacker swaps in 1000 EYE and gets 500 LINK from the pool (according to
x * y = k, ignoring fees for simplicity). Now the pool contains 2000 EYE and 500 LINK tokens. - After the manipulation, he burns his LP tokens and gets
2000 * 100/1000 * 20 = 4000amount offate. - Lastly, he swaps 500 LINK into the pool to get back his 1000 EYE.
- Compared to Step 2, the attacker earns a double amount of
fateby only paying the swapping fees to the pool. The more EYE tokens he swaps into the pool, the morefatehe can get. This attack is practically possible by leveraging flashloans or flashswaps from other pools containing EYE tokens.
The setEYEBasedAssetStake function has the same issue of using a manipulatable LP pricing formula. For more detailed explanations, please refer to the analysis of the Cheese Bank attack and the Warp Finance attack.
Referenced code: DAO/LimboDAO.sol#L356 DAO/LimboDAO.sol#L392
Recommended Mitigation Steps
Use a fair pricing formula for the LP tokens, for example, the one proposed by Alpha Finance.
gititGoro (Behodler) confirmed and commented:
This is actually a good fate inflation vector especially when combined with the fateToFlan conversion
Jack the Pug (judge) commented:
Good catch! A valid economic attack vector can potentially be exploited using flashloans.
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 LP token pricing formula relies on the instantaneous pool balances, which can be manipulated within a single transaction.
Impact
The attacker could gain extra fate tokens, giving more voting power or profit by converting to Flan tokens, at the cost of swap fees.
What the attacker needed
Attacker holds LP tokens; access to flashloan or flashswap; EYE tokens available in a pool
The fix
Use a fair LP token pricing formula, such as the one proposed by Alpha Finance.
How it was found
- The attacker holds LP tokens in the LINK-EYE Uniswap pool.
- The attacker swaps a large amount of EYE into the pool, skewing the balance.
- The attacker burns their LP tokens and receives an inflated amount of fate.
- The attacker swaps back to recover the EYE, paying only swap fees.
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 the value of a token (LP token) is calculated based on the current balance of a trading pool. An attacker can temporarily flood the pool with one token to make the LP token appear more valuable, then cash out for extra reward tokens (fate) before undoing the trade. They can do this cheaply using a flashloan, which is a loan that must be repaid in the same transaction.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.