Submitted by 0xalpharush
https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L739-L746
https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L727
https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L1087
The function matchOneToOneOrders transfers an arbitrary amount of WETH from the user, buy.signer ,  in its inner call to _execMatchOneToOneOrders. The amount charged to the user is calculated dynamically based off of the gas consumption consumed during the trace. Notably, this amount is controlled by the seller since the sellers token can be malicious and purposefully consume a large amount of gas to grief the buyer. For example, when a user purchases an ERC721 token, the _transferNFTs will result in a call to an ERC721.safeTransferFrom that can exhibit any behavior such as wasting gas. This scenario is unlikely given that a buyer would have to purchase a malicious token, but the impact would be devastating as any WETH that the buyer has approved to the exchange can be lost.
This vulnerability is potentially possible in these functions as well:
https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L236-L242
https://github.com/code-423n4/2022-06-infinity/blob/765376fa238bbccd8b1e2e12897c91098c7e5ac6/contracts/core/InfinityExchange.sol#L787-L796
A buyer gives infinite WETH approval to the exchange contract and unknowingly purchases a malicious token from an attacker. The attackers token wastes gas in the transfer call and causes all of the buyers WETH to be sent to the protocol when matchOneToOneOrders is performed by the match executor.
Allow users to input a maximum fee/ gas cost they are willing to spend on each order. Pulling an arbitrary amount from a users wallet without any restriction is a dangerous practice given that many users give large/ infinite approval to contracts.
In addition, manual gas accounting is error prone and it would make more sense to allow users to match orders themselves instead of extracting fees to compensate the matcher.
nneverlander (Infinity) acknowledged and commented:
HardlyDifficult (judge) commented:
For this contest, 78 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by joestakey received the top score from the judge.
The following wardens also submitted reports: IllIllI, 0x1f8b, reassor, zzzitron, 0x29A, GimelSec, BowTiedWardens, hyh, berndartmueller, oyc_109, cryptphi, VAD37, Kenshin, 0xNazgul, horsefacts, defsec, 0xDjango, StErMi, Ruhum, hansfriese, PPrieditis, 0xNineDec, MadWookie, robee, throttle, csanuragjain, Lambda, Treasure-Seeker, GreyArt, hake, samruna, unforgiven, sorrynotsorry, KIntern, Wayne, Czar102, peritoflores, sseefried, sach1r0, georgypetrov, antonttc, Kaiziron, cloudjunky, 0x52, Chom, _Adam, shenwilly, saian, codexploder, 0xkowloon, WatchPug, cccz, wagmi, apostle0x01, fatherOfBlocks, TomJ, 8olidity, TerrierLover, rfa, simon135, Cityscape, 0xmint, FSchmoede, delfin454000, k, rajatbeladiya, nxrblsrpr, Sm4rty, ElKu, asutorufos, Picodes, abhinavmir, Funen, kenta, MiloTruck, a12jmx, and 0xf15ers.
