Swapping large amounts of assets back and forth in an Aerodrome pool allows to bypass exposure limits
Source: https://github.com/sherlock-audit/2024-04-arcadia-pricing-module-judging/issues/18
Found by
PUSH0, zzykxx
Summary
Swapping large amounts of assets back and forth in an Aerodrome pool allows to bypass exposure limits.
Vulnerability Detail
The WrappedAerodromeAM allows wrapping LPs of an Aerodrome pool to then deposit the wrapped position as collateral in an Arcadia account. The wrapper accounts for the trading fees accumulated by the LP when estimating the value of the collateral:
(, uint256 positionId) = _getAssetFromKey(assetKey);
(uint256 fee0Position, uint256 fee1Position) = feesOf(positionId);
underlyingAssetsAmounts = new uint256[](3);
underlyingAssetsAmounts[0] = positionState[positionId].amountWrapped;
underlyingAssetsAmounts[1] = fee0Position;
underlyingAssetsAmounts[2] = fee1Position;
It's possible to take advantage of this to bypass exposure limits. An attacker can:
- Create a new Aerodrome pool
- Mint LPs, the attacker owns the whole liquidity supply
- Deposit the LP as collateral via
WrappedAerodromeAM - Swap large amounts in the Aerodrome pool back and forth to increase the fees accumulated by the LP. The value of the collateral increases while the collateral is already deposited. The attacker won't lose anything besides gas fees because he controls the whole (minues 1e3) liquidity supply.
An attacker can keep swapping amounts indefinitely. Because this is done while the collateral is already deposited in the account the attacker can avoid the restrictions of exposure limits.
Impact
Exposure limits can be bypassed.
Code Snippet
Tool used
Manual Review
Recommendation
A similar attack is possible on UniswapV3 positions, however in that case the protocol already implements safety guards against this possibility. Implement a similar safety guard for Aerodrome positions as well.
Discussion
sherlock-admin4
1 comment(s) were left on this issue during the judging contest.
shealtielanz commented:
exposure limits will truly be bypassed
sherlock-admin3
The protocol team fixed this issue in the following PRs/commits: https://github.com/arcadia-finance/accounts-v2/pull/201
sherlock-admin2
The Lead Senior Watson signed off on the fix.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Arcadia - Aerodrome integrations. Sherlock made it public on 30 April 2024. Found in the 321 audit contest (finding M-2), also found by 1 other warden.
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.