# Attackers can drain the `OracleLess` contract by creating an order with a `malicious tokenIn` and executing it with a `malicious target`.

OracleLess accepts arbitrary tokenIn and arbitrary target/txData in fillOrder, letting an attacker drain all USDT held by the contract.

- Payout: Audit contest
- Severity: high
- Program: Oku
- Found by: 0xaxaxa
- Disclosed: 2024-11-22
- Write-up quality: 8/10
- Original: https://github.com/sherlock-audit/2024-11-oku-judging/issues/357
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-oku%3AH-2
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic

**Target:** OracleLess automated-trigger contract (createOrder/fillOrder)
**Root cause:** createOrder does not validate tokenIn as a legitimate ERC20, and fillOrder/execute does not restrict target or txData, so attacker controls both the approved token and the arbitrary call.
**Steps:**
1. Deploy malicious ERC20 whose approve(spender,amount) transfers 1 wei WETH to msg.sender and returns true.
2. Call `createOrder` with tokenIn=malicious token, tokenOut=WETH, minAmountOut=0.
3. Call `fillOrder` with target=USDT address and txData=USDT.transfer(attacker, fullBalance).
4. execute() calls `tokenIn.safeApprove(target, amountIn)` which triggers malicious approve, sending 1 wei WETH to OracleLess.
5. execute() then calls `target.call(txData)` transferring all USDT to attacker.
6. finalTokenOut-initialTokenOut = 1 > minAmountOut(0), so the require passes and the order settles.
**How found:** Code review of createOrder/fillOrder: noticed tokenIn is unvalidated and execute() performs an arbitrary target.call with attacker-supplied txData after approving tokenIn, then only checks tokenOut delta against minAmountOut.
**Exploitation:** Attacker needs no capital: the malicious token's approve hook self-funds the tokenOut balance check with 1 wei WETH, while the arbitrary target.call drains the contract's entire USDT balance to the attacker.
**Insight:** When a contract performs an arbitrary external call gated only by a tokenOut balance delta, look for attacker-controlled tokenIn whose approve/transfer hooks can satisfy the delta check for free, turning the arbitrary call into a full-balance drain.

