hats-finance / Origami-0x998f1b716a5022be026ca6b919c0ddf45ca31abd

GNU Affero General Public License v3.0
2 stars 0 forks source link

No slippage protection in Aggregator #3

Open hats-bug-reporter[bot] opened 8 months ago

hats-bug-reporter[bot] commented 8 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x61d1ed1693dbdb2fc92f36837d642575371cdab85d6831dbbf3cddb6f3b194a2 Severity: high

Description: Description\ There is no slippage protection (minOut parameter) in OrigamiDexAggregatorSwapper.sol, this can and will lead to fund loss via MEV bots while using the Aggregator. 1inch also recommends to put minOut parameter while integrating with the router to not lose funds. Example integration for swap function can be seen from here : https://github.com/smye/1inch-swap/blob/master/contracts/SwapProxy.sol

Attack Scenario\ When transaction seen in the mempool, MEV bots will sandwich the transaction and fund loss will occur.

frontier159 commented 8 months ago

This is intentional to avoid duplicate slippage checks - any slippage checks are handled in client code rather than within this OrigamiDexAggregatorSwapper.sol contract.

eg: OrigamiLovTokenErc4626Manager.sol#L338 OrigamiLovTokenFlashAndBorrowManager.sol#L366