Submitted by Eeyore, also found by nnez
During the reallocation of a pair, the Predy protocol does not verify that the liquidity in the Uniswap pool between the upper and lower tick belongs exclusively to that pair. Instead, it takes the entire liquidity from the range that the pair currently operates within.
In a scenario where a trusted operator creates two pairs for the same Uniswap pool, perhaps to have different quote tokens as margin tokens, there is a possibility that both pairs will have the same upper and lower tick setup.
In such a situation, if a user trades gamma on the first pair, and later the price moves outside the threshold of the second pair, if anyone performs a reallocation on that second pair, even if there were no gamma trades on the second pair, the second pair will steal liquidity from the users open gamma position.
This will cause all accounting within the protocol for these two pairs to be compromised.
Internal protocol accounting will be disrupted, potentially making it impossible to close or liquidate positions properly.
Note: In such a scenario, the users gamma position in the first pair cannot be closed properly. Any reallocation done on the first pair operates with empty liquidity, making it impossible to liquidate the users gamma positions.
This test illustrates how to one pair steals other pair liquidity.
Create test/PoC/TestPoCReallocate.t.sol and run forge test --match-test testPoCReallocateStealFromOtherPair -vvvv.
Uniswap
syuhei176 (Predy) confirmed and commented:
0xsomeone (judge) commented:
