Submitted by cmichel
The liquidity token value (AssetHandler.getLiquidityTokenValue) is the sum of the value of the individual claims on cash (underlying or rather cTokens) and fCash.
The amount to redeem on each of these is computed as the LP token to redeem relative to the total LP tokens, see AssetHandler.getCashClaims / AssetHandler.getHaircutCashClaims:
This means the value depends on the current market reserves which can be manipulated.
Youre essentially computing a spot price (even though the individual values use a TWAP price) because you use the current market reserves which can be manipulated.
See the How do I tell if Im using spot price? section here.
The value of an LP token is computed as assetCashClaim + assetRate.convertFromUnderlying( presentValue(fCashClaim) ), where (assetCashClaim, fCashClaim) depends on the current market reserves which can be manipulated by an attacker via flashloans.
Therefore, an attacker trading large amounts in the market can either increase or decrease the value of an LP token.
If the value decreases, they can try to liquidate users borrowing against their LP tokens / nTokens.
If the value increases, they can borrow against it and potentially receive an under-collateralized borrow this way, making a profit.
The exact profitability of such an attack depends on the AMM as the initial reserve manipulation and restoring the reserves later incurs fees and slippage.
In constant-product AMMs like Uniswap its profitable and several projects have already been exploited by this, like warp.finance.
However, Notional Finance uses a more complicated AMM and the contest was too short for me to do a more thorough analysis. It seems like a similar attack could be possible here as described by the developers when talking about a different context of using TWAP oracles:
Recommend not using the current market reserves to determine the value of LP tokens. Also, think about how to implement a TWAP oracle for the LP tokens themselves, instead of combining it from the two TWAPs of the claimables.
T-Woodward (Notional) confirmed and disagreed with severity :
ghoul-sol (judge) commented:
