The protocol integrates with 1inch DEX aggregator for token swaps during position creation and unwinding. The _call1InchSwap function accepts _swapParams (encoded calldata) that calls the swap() function on the 1inch router. However, the function has two critical flaws:
No Parameter Validation: The function does not verify that dstReceiver in the SwapDescription is set to address(this), allowing swap outputs to be sent to arbitrary addresses.
Return Value Trust: The function trusts the return value from the swap call instead of checking the actual token balance increase. Even if tokens are sent to the wrong address, the return value may still indicate success and a high amount received.
When a malicious owner provides swap calldata with dstReceiver set to their own address, the swap executes successfully and returns a high value, but the tokens never reach the contract. The contract then proceeds with operations assuming it received the tokens, potentially using other users' funds to repay flash loans.
Likelihood:
The combination of unvalidated dstReceiver parameter and return value trust creates a clear attack vector that can be exploited whenever the contract has other users' funds available.
Impact:
Fund Diversion: A malicious owner can redirect swap outputs to their own address by setting dstReceiver to their address in the swap description. The swap executes successfully and returns a high value, but tokens never reach the contract.
The most critical fix is to verify the actual token balance increase instead of trusting the return value:
This fix ensures that even if dstReceiver is set incorrectly, the attack will fail because returnAmount will be 0 (no balance increase), causing the minReturnAmount check to fail.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.