Sneaky Eggplant Fly - Insecure calls to safeTransferFrom
leads to users tokens steal by attacker
#789
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Sneaky Eggplant Fly
Medium
Insecure calls to
safeTransferFrom
leads to users tokens steal by attackerSummary
The function
safeTransferFrom()
is used to transfer tokens from user to the protocol contract. This function is used inmodifyOrder
andcreateOrder
with the recipent address as theowner
form who the tokens will be transfered from. An attacker can abuse this functionnality to create unfaire orders for a protocol user that approve more tokens than needed to the protocol contract the fill the order immediatly and gain instant profit while the victim lost his tokens.Root Cause
In
OracleLess.sol::procureTokens():280
https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/OracleLess.sol#L280
procureTokens()
implement tokens transfer from an owner address to the protocol contractIn
StopLimit.sol::createOrder():171
https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/StopLimit.sol#L171
In
StopLimit.sol::modifyOrder():226-230
https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/StopLimit.sol#L226-L230
In
Bracket.sol::modifyOrder():250-254
https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/automatedTrigger/Bracket.sol#L250-L254
Internal pre-conditions
No response
External pre-conditions
Attack Path
Impact
No response
PoC
No response
Mitigation
It would be better to use
msg.sender
to ensure that therecipient/owner
of the order is the order creator or juste usemsg.sender
as parameter to thesafeTransferFrom()
function call instead of order recipientThe text was updated successfully, but these errors were encountered: