LP rewards in liquidity_lockbox can be arbitraged
The liquidity_lockbox contract allows a user to deposit a large LP position and immediately withdraw all existing positions, collecting the accrued LP rewards. An attacker could repeat this cycle to continuously extract rewards unfairly.
Submitted by EV_om
The liquidity_lockbox contract is designed to handle liquidity positions in a specific Orca LP pool. Users can deposit their LP NFTs into the contract, receiving in exchange tokens according to their position size. These tokens are minted with the goal of allowing users to bridge them to Ethereum later on and exchange them for OLAS at a discount.
However, a potential vulnerability arises from the unrestricted nature of the deposit and withdrawal functions. Specifically, a user can deposit a large amount of assets and immediately withdraw all existing positions using the tokens they just received. This sequence of actions can be repeated to continuously exploit the LP rewards system, leading to an unfair distribution of rewards.
The root cause of this issue lies in the withdraw() function, which does not have any restrictions or checks that prevent immediate withdrawal after a deposit and pays all accrued LP rewards to the caller.
Proof of Concept
Consider the following scenario:
- Alice obtains a large amount of tokens either through a flashloan or by buying them.
- Alice uses these tokens to open a large position in the Orca pool.
- Alice deposits the position NFT into the
liquidity_lockboxcontract, receiving a large amount of bridge tokens. - Alice withdraws all existing positions using the tokens she just received and receives the LP rewards.
- Alice closes the received positions in the Orca pool, repays the flashloan (if used) and pockets the rewards.
This sequence of actions can be repeated by Alice to continuously exploit the LP rewards system.
Recommended Mitigation Steps
To mitigate this issue, a possible solution could be to implement a lock-up period for deposited positions. This would prevent users from immediately withdrawing their positions after depositing. Additionally, consider not distributing rewards to the withdrawing user (which will never be fair) and instead collecting them for the protocol.
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
The withdraw function has no lock-up or check preventing immediate withdrawal after a deposit and pays all accrued LP rewards to the caller.
Impact
An attacker could repeatedly collect LP rewards that should be distributed fairly, leading to an unfair distribution of rewards.
What the attacker needed
A large amount of tokens or a flashloan; access to the Orca LP pool
The fix
A lock-up period for deposited positions should be implemented, and rewards should not be distributed to the withdrawing user but collected for the protocol.
How it was found
- Obtain a large amount of tokens, for example through a flashloan or by buying them.
- Use the tokens to open a large position in the Orca pool.
- Deposit the position NFT into the liquidity_lockbox contract and receive bridge tokens.
- Withdraw all existing positions using the tokens just received, collecting the LP rewards.
- Close the received positions in the Orca pool and repay the flashloan if one was used.
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 liquidity pool is a shared pot of two cryptocurrencies that people add money to and earn small rewards from. This contract lets people put their share of the pool in and get a token back, but it also lets them take their share out straight away and keep all the rewards that built up. Someone could keep doing this to take rewards that should have gone to everyone else.
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.