Jumpy Sage Pony - An attacker can take advantage of the StopLimit
's unlimited allowance to Bracket
to steal funds from the StopLimit
.
#871
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Jumpy Sage Pony
High
An attacker can take advantage of the
StopLimit
's unlimited allowance toBracket
to steal funds from theStopLimit
.Summary
The
StopLimit
's allowance toBracket
is set to be unlimited. An attacker can exploit this unlimited allowance to steal all funds stored in theStopLimit
.Root Cause
The
StopLimit
's allowance toBracket
is set to be unlimited.https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/StopLimit.sol#L99-L104
https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/StopLimit.sol#L397-L411
An attacker can create an order with minimum
amountIn
in theBracket
contract and callsperformUpkeep
withtarget
as thetokenToSteal
andtxData
astransferFrom(stopLimit, this, amountToSteal)
.Then all
tokenToSteal
will be transferred toBracket
fromStopLimit
and finally be given to the attacker.As a result, the attacker steal funds from the
StopLimit
.https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/StopLimit.sol#L526-L568
Internal pre-conditions
none
External pre-conditions
none
Attack Path
tokenOut
as the token to steal from theStopLimit
.performUpkeep()
.(This can be done just after creating order, it the TP or SL is set as the current price).- target : tokenToSteal
- txData : transferFrom(stopLimit, this, amountToSteal)
Then all
tokenToSteal
will be transferred toBracket
fromStopLimit
and finally be given to the attacker at L562.As a result, the attacker steal funds from the
StopLimit
.Impact
An attacker can steal the funds from
StopLimit
.PoC
none
Mitigation
The allowance to the
Bracket
should not be settype(uint256).max
.The text was updated successfully, but these errors were encountered: