Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.28 KB

Incorrect comparison enables swapping and token draining at no cost.md

File metadata and controls

35 lines (27 loc) · 1.28 KB

An incorrect comparison in the swap function allows the swap to succeed even if no tokens are paid.

This issue could be used to drain any pool of all of its tokens at no cost.

It then calls the uniswapV3SwapCallback function on the initiator’s account, passing in the amount of tokens to be paid.

The callback function should then transfer at least the requested amount of tokens to the pool contract.

Afterward, a require inside the swap function verifies that the correct amount of tokens (amountIn) has been transferred to the pool.

However, the check inside the require is incorrect. The operand used is >= instead of <=.

Recommendation:

Replace >= with <= in the require statement. __

Slide Screenshot

050.jpg


Slide Text

  • ToB Audit Uniswap V3 Finding 5
  • Data Validation
  • High Severity
  • Incorrect Operator
  • Token Drain
  • Change >= to <=
  • require() Statement

References


Tags