AI Arena - adamn000's results

In AI Arena you train an AI character to battle in a platform fighting game. Imagine a cross between Pokémon and Super Smash Bros, but the characters are AIs, and you can train them to learn almost any skill in preparation for battle.

General Information

Platform: Code4rena

Start Date: 09/02/2024

Pot Size: $60,500 USDC

Total HM: 17

Participants: 283

Period: 12 days

Judge:

Id: 328

League: ETH

AI Arena

Findings Distribution

Researcher Performance

Rank: 227/283

Findings: 1

Award: $1.27

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

1.2667 USDC - $1.27

Labels

bug
3 (High Risk)
satisfactory
sufficient quality report
upgraded by judge
:robot:_86_group
duplicate-366

External Links

Lines of code

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L254

Vulnerability details

Impact

Users will be eligble to mint new NFT's by FighterFarm::redeemMintPass, one of the parameters in this function is mintPassDnas. Then, this function calls FighterFarm::_createNewFighter function, with mintPassDnas as a hashed uint256. In FighterFarm::_createNewFighter function, to get NFT attributes as element, weight and newDna, protocol using FighterFarm::_createFighterBase function with dna parameter which is uint256 hashed mintPassDnas. Reference to documentation, "A fighter’s weight is the primary determinant of its other relative strength and weaknesses (i.e. all other battle attributes are a function of weight)". As we can see in FighterFarm::_createNewFighter function, weight is based on dna.

There are similiar situation in FighterFarm::claimFighters, FighterFarm::mintFromMergingPool and FighterFarm::reRoll. In this case it is harder to get the best weight beacuse dna depends on user address and other variables. Furthermore, user can check what parameters will give better weight and mint when condition are met.

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L214

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L324

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L379

Proof of Concept

User interact with FighterFarm::redeemMintPass function and mintPassDnas = "1234". Following next steps, uint256(keccak256(abi.encode(mintPassDnas)) = 109354925330486725663316016813838071664739777272443667231673145530778523508943, this number is the dna. Finally, weight = dna % 31 + 65. In this example, weight is equal 94, weight range is 65-95 (there are 3 types of weights: 65-74, 75-84, 85-94). In this case user will get the best fighter NFT.

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L254

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L500

https://github.com/code-423n4/2024-02-ai-arena/blob/main/src/FighterFarm.sol#L471

Tools Used

Manual review.

Use Chainlink VRF to get random number and be sure weight and other parameters is random. (https://docs.chain.link/vrf)

Assessed type

ERC721

#0 - c4-pre-sort

2024-02-22T08:00:31Z

raymondfam marked the issue as sufficient quality report

#1 - c4-pre-sort

2024-02-22T08:00:41Z

raymondfam marked the issue as duplicate of #33

#2 - c4-pre-sort

2024-02-26T00:53:44Z

raymondfam marked the issue as duplicate of #1626

#3 - c4-judge

2024-03-05T10:56:27Z

HickupHH3 changed the severity to 3 (High Risk)

#4 - c4-judge

2024-03-06T03:34:56Z

HickupHH3 marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter