DEAL20% OFF
Pre Black FridaySALE
--
Days
--
Hours
--
Minutes
--
Seconds
Book a call
DEAL20% OFF
Pre Black FridaySALE
--
Days
--
Hours
--
Minutes
--
Seconds
Book a call
GLITCH40% OFF
Price Glitch40% OFF
00
Days
00
Hours
05
Minutes
00
Seconds
Claim 40% Off
GLITCH40% OFF
Price Glitch40% OFF
00
Days
00
Hours
05
Minutes
00
Seconds
Claim 40% Off
All articles

Ethernaut Level 4 Walkthrough: Telephone

Sven Daneel 3 min read
Ethernaut Level 4 Walkthrough: Telephone

This Web3/Solidity-based wargame is akin to a hacking Capture The Flag (CTF) challenge, where each level presents a smart contract puzzle waiting to be ‘hacked’. It’s an immersive and interactive way to learn about Ethereum and Solidity programming. Let's take a look at the Ethernaut Level 4 Walkthrough: Telephone

ethernaut level 4 walkthrough telephone

Telephone: Owning Up to the Deceptiveness of tx.origin

In the intriguing world of Ethereum smart contracts, security is paramount. Today, we’ll delve into Challenge 4: Telephone, a clever puzzle that exposes a vulnerability in how contracts identify message originators. By the end, we’ll not only conquer the challenge but gain valuable insights into the intricacies of tx.origin and msg.sender.

The Challenge’s Call

Challenge 4 presents a seemingly straightforward objective: claim ownership of a pre-deployed smart contract. But there’s a catch! Directly calling the contract’s changeOwner function won't grant ownership. This compels us to think outside the box and exploit a clever trick.

Unveiling the Contract’s Secrets

The first step is to understand the contract’s logic. We need to dissect how it verifies ownership claims. Here, the key lies in differentiating between two crucial variables:

  • tx.origin: This represents the original initiator of the transaction, the user's wallet address.
  • msg.sender: This signifies the address directly calling the function, which could be another contract.

The Art of Deception

The vulnerability lies in the fact that a contract can’t directly determine tx.origin. Here's where the magic happens:

  1. We craft a new smart contract, let’s call it Impersonator.
  2. Impersonator mirrors the changeOwner function from the Telephone contract.
  3. The twist: When called, Impersonator's changeOwner function relays the call to the Telephone contract's changeOwner, but with a crucial twist.

The Grand Illusion

Instead of directly calling Telephone’s changeOwner, Impersonator acts as a middleman. This seemingly insignificant step alters how the Telephone contract perceives the message origin. Because Impersonator calls Telephone's changeOwner, msg.sender becomes Impersonator's address, while tx.origin remains our user wallet.

The Telephone contract, lacking the ability to see tx.origin, gets deceived. It believes Impersonator is claiming ownership, while in reality, the transaction originated from our wallet, making us the true owner.

Beyond the Challenge

Challenge 4 sheds light on the potential pitfalls of relying solely on msg.sender for authorization. It emphasizes the importance of considering tx.origin when necessary to prevent ownership manipulation or other vulnerabilities.

The Road Ahead

The Ethernaut challenges provide a fantastic platform to explore the intricacies of smart contract security. Each challenge unveils new concepts and challenges our understanding of Solidity. As we venture further, stay tuned for more explorations into the captivating realm of Ethereum smart contracts!

This blog post explores Challenge 4, highlighting the significance of understanding tx.origin and msg.sender for robust smart contract design. By exploiting the limitations of message origin identification, we not only conquered the challenge but gained valuable security insights.

Ready for the next Ethernaut challenge? Click to check out the previous ethernaut challenge and see what's next in our series!

faq

FAQs

What is the Ethernaut Level 4: Telephone challenge?

  • The challenge involves interacting with a smart contract to change ownership by exploiting specific conditions in its code.

How do you solve the Ethernaut Level 4: Telephone challenge?

  • Solve it by using another contract to call the target contract’s function, thereby bypassing the direct call restriction.

What skills are needed to complete Ethernaut Level 4?

  • A basic understanding of Ethereum, Solidity, and how smart contracts operate is essential.

What tools are required for the Ethernaut challenges?

  • Tools like Remix IDE, Metamask, and a solid understanding of Ethereum's test networks are necessary.

What is the importance of the Telephone challenge in learning Ethereum?

  • It teaches about function visibility, contract interaction, and security considerations in smart contract development.
Share
Sven Daneel

Written by

Sven Daneel

Sven Daneel is a smart contract auditor and security educator passionate about fortifying on-chain systems. He guides engineers through foundational smart contract vulnerabilities—from pseudo-randomness exploits to authentication risks like tx.origin—helping developers spot critical security flaws before deploying to mainnet.

You may also like

Ethernaut Walkthrough

Ethernaut Level 2 Walkthrough: Fallout

The Ethernaut Level 2 offers a fascinating glimpse into the vulnerabilities that can arise from seemingly minor oversights in smart contract development. This article takes you through the challenge, revealing the…

Marko JaureguiMarch 21, 2024Read
Ethernaut Walkthrough

Ethernaut Level 18 Walkthrough: Magic Number

As you may already know, The Ethernaut , from OpenZeppelin, is a series of challenges designed to teach and test your understanding of smart contract security. Well, today was the time for Ethernaut Level 18 , titled…

Ana RojoJuly 15, 2024Read
Ethernaut Walkthrough

Ethernaut Level 15 Walkthrough: Naught Coin

Ethernaut Level 15, "Naught Coin," throws you headfirst into the world of ERC20 tokens and their potential vulnerabilities. This challenge presents a seemingly locked contract with a 10-year transfer lock on your own…

Alexis AmoiJune 24, 2024Read
Ethernaut Walkthrough

Ethernaut Level 3 Walkthrough: Coin Flip

The Ethernaut Level 3 , called "Coin Flip," is a lesson on the weak spots in how smart contracts handle chance and prediction. This article walks you through the Coin Flip game, showing where the contract has a weak…

Sven DaneelApril 2, 2024Read
Ethernaut Walkthrough

Ethernaut Level 16 Walkthrough: Preservation

This article will break down the Ethernaut Level 16: Preservation contract, point out its flaws, and show how the Hack contract takes advantage of these weaknesses. Let's dive into how delegatecall can be risky by…

Georgi PlamenovJuly 6, 2024Read
Ethernaut Level 29- Switch Challenge Explained 2025Ethernaut Walkthrough

Ethernaut Level 29 Walkthrough: The Switch Challenge Explained

The Ethernaut Level 29 Switch challenge revolves around understanding how dynamic CALLDATA is constructed and interpreted by Solidity contracts. The objective is to craft a CALLDATA payload that allows a single low-level

Seth TenenbaumJune 12, 2025Read
More Ethernaut Walkthrough articles →

Talk to an advisor

Book a call with a real human before the next cohort fills.

Speak with an advisor. We'll map the right program to your goals - and lock in your enrollment offer.

20% off enrollment offer

20% OFF - limited-time enrollment offer.

Applied automatically when you book a call before the timer hits zero.

--
Days
--
Hours
--
Minutes
--
Seconds
  • Guarantee: Job or 100% money back
  • Expert-curated curriculum
  • On-demand mentor support
Advisor Elena RodriguezAdvisor Sarah JenningsAdvisor David Chen
Real advisors · reply within 2 hours

Book your call

Free