AI Arena - Velislav4o'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: 101/283

Findings: 3

Award: $61.53

🌟 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/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/FighterFarm.sol#L233-L262

Vulnerability details

Impact

The redeemMintPass function permits users to arbitrarily set the iconsTypes attribute of newly minted 'fighters' during the redemption process. This allows them to bypass an intended association between burned 'mintPass' metadata and generated fighter properties. The developer has confirmed this behavior is unintentional.

Proof of Concept

1. An attacker holds a 'mintPass' with a common, undesirable iconType of low market value.

2. They invoke the redeemMintPass function, burning their mintPass.

Crucially, they manually provide an iconsTypes input corresponding to a rare and coveted icon.

3. Since the validation is missing, the contract accepts the manipulated iconsTypes value.

A new 'fighter' is minted, visually representing the rare 'icon' while having originated from a common 'mintPass'.

Tools Used

Manual Review

Change :

require( mintpassIdsToBurn.length == mintPassDnas.length && mintPassDnas.length == fighterTypes.length && fighterTypes.length == modelHashes.length && modelHashes.length == modelTypes.length

to

require(
            mintpassIdsToBurn.length == mintPassDnas.length && 
            mintPassDnas.length == fighterTypes.length && 
            fighterTypes.length == modelHashes.length &&
            modelHashes.length == modelTypes.length &&
            modelTypes.length == iconsTypes.lenght

Assessed type

Invalid Validation

#0 - c4-pre-sort

2024-02-22T07:46:57Z

raymondfam marked the issue as sufficient quality report

#1 - c4-pre-sort

2024-02-22T07:47:03Z

raymondfam marked the issue as duplicate of #33

#2 - c4-pre-sort

2024-02-26T00:53:29Z

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:12:11Z

HickupHH3 marked the issue as satisfactory

Lines of code

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

Vulnerability details

Impact

This vulnerability allows users to strategically minimize their staking amounts, enabling them to participate in the reward system without genuine risk. This undermines the core concept of risk vs. reward within the protocol.

Proof of Concept

Let's imagine that Alice wants to play Ranked Battle but she decide to stake 1 wei to remove risk of losing NRN The game dose the calculation :  curStakeAtRisk = (bpsLostPerLoss * (amountStaked[tokenId] + stakeAtRisk)) / 10**4;

let's imagine that bpsLostPerLoss is 500 and amountStaked[tokenId] is 1 wei and stakeAtRisk is 10000 wei that mean that the calculation goes

500 * (0+ 10000)) / 10000 = 0

Tools Used

Manual Review

Enforce a minimum threshold for amountStaked[tokenId] that must be surpassed for battle eligibility. This eliminates the zero-risk scenario.

Assessed type

Math

#0 - c4-pre-sort

2024-02-22T16:02:07Z

raymondfam marked the issue as insufficient quality report

#1 - c4-pre-sort

2024-02-22T16:02:14Z

raymondfam marked the issue as duplicate of #38

#2 - c4-judge

2024-03-07T02:49:49Z

HickupHH3 changed the severity to 2 (Med Risk)

#3 - c4-judge

2024-03-07T02:58:22Z

HickupHH3 changed the severity to 3 (High Risk)

#4 - c4-judge

2024-03-07T03:15:54Z

HickupHH3 marked the issue as satisfactory

#5 - c4-judge

2024-03-07T03:16:30Z

HickupHH3 marked the issue as partial-50

Awards

59.2337 USDC - $59.23

Labels

bug
2 (Med Risk)
downgraded by judge
insufficient quality report
satisfactory
:robot:_102_group
duplicate-43

External Links

Lines of code

https://github.com/code-423n4/2024-02-ai-arena/blob/f2952187a8afc44ee6adc28769657717b498b7d4/src/FighterFarm.sol#L484-L531

Vulnerability details

Impact

The current implementation of the fighter minting restriction within the _createNewFighter function has a critical defect. Minting limits are naively enforced by checking the target address's balanceOf. This allows attackers to circumvent safeguards by transferring minted fighters away, and continue minting indefinitely.

Proof of Concept

  1. Attacker reaches threshold (balanceOf(attackerAddress) == MAX_FIGHTERS_ALLOWED).
  2. Attacker transfers a handful of fighters to a freshly created wallet (attackerAddress2).
  3. Since balanceOf(attackerAddress) decreases, they can keep using _createNewFighter even after exceeding the expected limit.

Tools Used

Manual Review

introduce a mapping counter of created fighters. Increment this with each successful _createNewFighter call. Refuse minting when the global counter hits 10 fighters.

Assessed type

Invalid Validation

#0 - c4-pre-sort

2024-02-23T17:50:52Z

raymondfam marked the issue as insufficient quality report

#1 - c4-pre-sort

2024-02-23T17:51:02Z

raymondfam marked the issue as duplicate of #43

#2 - c4-judge

2024-03-07T06:36:55Z

HickupHH3 changed the severity to 2 (Med Risk)

#3 - c4-judge

2024-03-07T06:36:59Z

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