Submitted by peakbolt
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L873 
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L930
RdpxV2Core.bond() calls reLPContract.reLP() at the end of the bonding to adjust the LP for the rDPX/ETH pool and swap ETH for rDPX.
Within reLPContract.reLP(), it first calls removeLiquidity() to remove liquidity (rDPX and ETH), followed by swapExactTokensForTokens() and addLiquidity().
However, the issue is that an attacker has control over RdpxV2Core.bond() and can use it to indirectly call reLPContract.reLP(). That means the attacker can basically frontrunned/backrunned reLP() without a mempool. It also reduces the attack cost as attacker does not pay high gas to frontrun it.
One may argue that the slippage protection is in place, but that only makes it less profitable and would not help in this case because the attacker is able to increase the trade size of the UniswapV2 transactions. That is because the attacker can adjust the bonding amount to increase the amount of liquidity removed by reLP() (and also swap/add liquidity), allowing the attacker to craft a profitable sandwich attack.
It is not recommended to allow users to have indirect control over the UniswapV2 transaction in reLPContract.
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L873
An attacker can steal from rdpxV2Core by crafting an profitable sandwich attack on bond().
An attacker can perform a sandwich attack as follows:
Remove reLPContract.ReLP() from bond() and trigger separately to prevent user access to it.
psytama (Dopex) confirmed and commented:
Alex the Entreprenerd (Judge) commented:
Alex the Entreprenerd (Judge) decreased severity to Medium and commented:
peakbolt (Warden) commented:
Alex the Entreprenerd (Judge) commented:
peakbolt (warden) commented:
Alex the Entreprenerd (Judge) commented:
