Open howlbot-integration[bot] opened 2 months ago
koolexcrypto marked the issue as satisfactory
koolexcrypto marked the issue as selected for report
koolexcrypto changed the severity to 2 (Med Risk)
koolexcrypto changed the severity to 3 (High Risk)
Lines of code
https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/TraitForgeNft/TraitForgeNft.sol#L351
Vulnerability details
Vulnerability Details
Increment generation function sets the count of the enitites of the new generation to 0, which could lead to incorrect calculations of the entities in new generation. What can happen is that users will forge entities that will belong to the next generation, and then via the mintToken function the generation will be incremented and genMintCount will be reseted for the next generation, which means that all forged entities will not be counted.
Proof of Concept
Create new test file, paste the code below and run it. The tests show incorrect calculation of the number of entities of a given generation
Impact
The main invariant of the protocol is broken, thus potentially breaking the economy of the game.
Recommended Mitigation Steps
Do not reset the genMintCount of the generation
Assessed type
Other