Skip to main content

Settings

Color Mode

Theme Skin

Background

Appearance preferences are saved in this browser only.

Environment

Current Environment Production

Built with JEKYLL_ENV=production. Changes require deployment.

Quick Links

Theme & Build

Jekyll v3.10.0
Last BuildNov 24, 17:25

Page Location

Page Info

Layout default
Collection wargames
Path _wargames/narnia/narnia1.md
URL /wargames/narnia/narnia1/
Date 2026-04-07

Narnia Level 1

Narnia Level 1 — the program runs code taken from an environment variable; learn what shellcode is and how to supply it.

Table of Contents

Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.

There is no information for this level, intentionally.

Study guide

Level map: logged in as narnia1, find the password for narnia2.

What this level teaches

How executable code can be delivered through an environment variable, and what shellcode is.

Key ideas

  • Environment variables are strings the shell passes to every program. Programs can read them and they can be arbitrarily set by the user.
  • Shellcode is machine code written to perform an action such as starting a shell. It must avoid bytes that break copying or printing.
  • Function pointers. The program treats the variable’s contents as a function and jumps to it.
  • Match the architecture. Shellcode is specific to the CPU and word size; check what the binary is with file.

How to approach it

  1. Read the source to see which variable is read and what is done with it.
  2. Obtain or write shellcode for the correct architecture and place it in that variable, ensuring bytes survive the shell.
  3. Run the program and observe which user you become.

Why it matters

It is the cleanest demonstration of why executing data as code is dangerous, and why modern systems mark data memory as non-executable.