AI Arena - 0xShitgem'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: 68/283

Findings: 1

Award: $111.68

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

111.676 USDC - $111.68

Labels

bug
3 (High Risk)
satisfactory
sufficient quality report
:robot:_49_group
duplicate-68

External Links

Lines of code

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

Vulnerability details

Impact

reRoll function accepts below parameters

/// @notice Rolls a new fighter with random traits.
/// @param tokenId ID of the fighter being re-rolled.
/// @param fighterType The fighter type.
function reRoll(uint8 tokenId, uint8 fighterType) public {}

In programming uint8 is described as 8-bit unsigned integer and the maximum value of this integer is 255. That means that any number above 255 passed as parameter would revert.

Impact: Users with NFTs above 255 won't be able to execute this function

Proof of Concept

You can paste following into FigherFarm.t.sol:

function testTokenId() public {
    _fighterFarmContract.reRoll(256, 0);
}

And it wouldn't even compile throwing this error: Invalid type for argument in function call. Invalid implicit conversion from int_const 256 to uint8 requested. Literal is too large to fit in uint8.

Tools Used

Manual Review

Consider changing from uint8 to uint256.

Assessed type

Error

#0 - c4-pre-sort

2024-02-21T23:58:05Z

raymondfam marked the issue as sufficient quality report

#1 - c4-pre-sort

2024-02-21T23:58:12Z

raymondfam marked the issue as duplicate of #68

#2 - c4-judge

2024-03-05T01:55:48Z

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