Platform: Code4rena
Start Date: 20/09/2022
Pot Size: $100,000 USDC
Total HM: 4
Participants: 109
Period: 7 days
Judge: GalloDaSballo
Id: 163
League: ETH
Rank: 24/109
Findings: 1
Award: $1,858.21
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: philogy
Also found by: KIntern_NA, auditor0517, bin2chen, cccz, hansfriese, hyh, ladboy233, m9800, pauliax, pedroais, ronnyx2017, wagmi, wastewa, zzykxx
https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/ArtGobblers.sol#L432-L442
tags: c4
, 2022-09-artgobblers
, high
https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/ArtGobblers.sol#L432-L442
When mint new lengendary gobbler, an amount of standard gobblers (cost
) must be burned. But when batch burn gobblers in function mintLegendaryGobbler()
, contract has not delete the approval of these gobblers. So after mint legendary gobbler, attackers can take back the gobblers which must be burned if they approved these gobblers to other address before.
testMintLegendaryGobblerWithNoCost()
)
https://gist.github.com/huuducst/742c8286a080f942e737eb1fc23b4489
(this file is placed at test/)Manual review Foundry
Add delete approval of gobblers when batch burn in function mintLegendaryGobbler()
:
for (uint256 i = 0; i < cost; ++i) { id = gobblerIds[i]; if (id >= FIRST_LEGENDARY_GOBBLER_ID) revert CannotBurnLegendary(id); require(getGobblerData[id].owner == msg.sender, "WRONG_FROM"); burnedMultipleTotal += getGobblerData[id].emissionMultiple; emit Transfer(msg.sender, getGobblerData[id].owner = address(0), id); delete getApproved[id]; // delete the approval of gobbler }
#0 - Shungy
2022-09-27T18:27:23Z
#1 - GalloDaSballo
2022-10-02T14:13:02Z