You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attacker deposits an amount calculated as MASTER.getMinAmountReceived(amountIn, tokenIn, tokenOut, bips) + 1 to the tokenOut address of their Attack contract.
The attacker then calls the performUpkeep function using the fabricated performData.
The attacker creates a Bracket Order with a margin (where takeProfit and stopPrice are set close to the margin).
The margin represents free profit. The higher the amountIn and bips, the greater the margin (free profit).
Impact
#Stop Limit Order with 'Swap-On-Fill'
User holds 2800 USDC and creates a Stop Limit Order with a stopLimitPrice set to 2800 and swapOnFill set to true
Once this price is reached, the Stop Limit Order is filled, swapping the 2800 USDC for 1 WETH and creating a new Bracket Order. This new Bracket Order will share the same orderId as the Stop Limit Order
In this scenario, users only receive a calculated amount based on swapSlippage, even when they could receive a better token amount.
Lone Midnight Stallion
Medium
An attacker can take some profit when create a Bracket Order from a Stop Limit Order with 'Swap-On-Fill'.
Summary
No response
Root Cause
No response
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
checkUpkeep
function on theStopLimit
contract.target
andtxData
inperformData
to point to their ownAttack
contract.MASTER.getMinAmountReceived(amountIn, tokenIn, tokenOut, bips) + 1
to thetokenOut
address of theirAttack
contract.performUpkeep
function using the fabricatedperformData
.takeProfit
andstopPrice
are set close to the margin).The margin represents free profit. The higher the
amountIn
andbips
, the greater the margin (free profit).Impact
In this scenario, users only receive a calculated amount based on
swapSlippage
, even when they could receive a better token amount.PoC
No response
Mitigation
https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/StopLimit.sol#L40-L143
To prevent this exploit, ensure that
performData
is validated usingkeccak256
.The text was updated successfully, but these errors were encountered: