Loud Lace Porpoise - Attackers can drain the OracleLess
contract by creating an order with a malicious tokenIn
and executing it with a malicious target
.
#357
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Loud Lace Porpoise
High
Attackers can drain the
OracleLess
contract by creating an order with amalicious tokenIn
and executing it with amalicious target
.Summary
In the
OracleLess
contract, thecreateOrder()
function does not verify whether thetokenIn
is a legitimate ERC20 token, allowing attackers to create an order with a malicious token. Additionally, thefillOrder()
function does not check if thetarget
andtxData
are valid, enabling attackers to execute their order with a malicioustarget
andtxData
.Root Cause
The OracleLess.createOrder() function does not verify whether
tokenIn
is a legitimate ERC20 token.Additionally, the OracleLess.fillOrder() function does not check if
target
andtxData
are valid.Internal pre-conditions
External pre-conditions
Attack Path
Let's consider the following scenario:
Alice, the attacker, creates a malicious token.
Alice creates an order with her malicious token:
tokenIn
: Alice's malicious tokentokenOut
:WETH
minAmountOut
: 0Alice calls the
fillOrder()
function to execute her malicious order, setting parameters as follows:target
: address ofUSDT
txData
: transfer allUSDT
in theOracleLess
contract to Alice.At line 118 of the
fillOrder()
function,execute()
is invoked:execute()
execute()
function,tokenIn.safeApprove()
is called. Alice made her malicioustokenIn
as follows:WETH
to theOracleLess
contract.USDT
are transferred to Alice, astarget
isUSDT
andtxData
is set to transfer to Alice.finalTokenOut - initialTokenOut
will be 1, as the contract has already received 1 wei. Thus, the require statement will pass sinceorder.minAmountOut
was set 0.As a result, Alice can drain all
USDT
from theOracleLess
contract.Impact
Attackers can drain the
OracleLess
contract by using malicioustoken
,target
, andtxData
.PoC
Mitigation
It is recommended to implement a whitelist mechanism for
token
,target
, andtxData
.The text was updated successfully, but these errors were encountered: