Submitted by philogy, also found by auditor0517, bin2chen, cccz, hansfriese, hyh, KIntern_NA, ladboy233, m9800, pauliax, pedroais, ronnyx2017, wagmi, wastewa, and zzykxx
ArtGobblers.sol#L432
ArtGobblers.sol#L890
Allows users to mint legendary Gobblers for free assuming they have the necessary amount of Gobblers to begin with. This is achieved by reviving sacrificed Gobblers after having called mintLegendaryGobbler.
This vulnerability allows the violation of the fundamental mechanics of in-scope contracts, allowing buyers to purchase legendary Gobblers at almost no cost outside of temporary liquidity requirements which can be reduced via the use of NFT flashloans.
Add the following code to the ArtGobblersTest contract in  test/ArtGobblers.t.sol  and run the test via forge test --match-test testCanReuseSacrificedGobblers -vvv:
Ensure token ownership is reset in the for-loop of the mintLegendaryGobbler method. Alternatively to reduce the gas cost of mintLegendaryGobbler by saving on the approval deletion, simply check the from address in transferFrom, revert if its address(0). Note that the latter version would also require changing the getApproved view method such that it checks the owner of the token and returns the zero-address if the owner is zero, otherwise the getApproved method would return the old owner after the underlying Gobbler was sacrificed.
FrankieIsLost (Art Gobblers) confirmed and commented:
Alex the Entreprenerd (judge) commented:
