Skip to content

Magic Animal Carousel Bytecode Difference #853

Description

@Sammmmx

The Issue

After spending hours in this level I found out that the contract function changeAnimal() is not behaving the way it was supposed to.

It has require statements that make sure that carousel[crateId] != 0 and owner == address(0).

I tried calling changeAnimal() on a crateId that was empty. More specifically, crateId 456. It was clear in the contract code shown in the Ethernaut Website that calling a non-initialized crateId will revert the function but I had to land on this after trying everything else.

Now based on the first require statement carousel[crateId] != 0, the function was supposed to revert because carousel[456] == 0 but it executes successfully Allowing me to put values in any crateId even if it was never initialized.

The Intended Contract

I read articles for the solution of this level which were all posted in 2025 or earlier and compared the contract those articles pasted with the current contract in Ethernaut. The Contracts differ at changeAnimal()

Here's a screenshot of the same :
Image

Was the require statement intentionally added to lure players away from the possibility of accessing any crateId? Or the require statement was actually supposed to revert the function but the bytecode at the instance address is incorrect?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions