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/narnia7.md
URL /wargames/narnia/narnia7/
Date 2026-04-07

Narnia Level 7

Narnia Level 7 — a format-string bug again, this time used to redirect a function pointer.

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 narnia7, find the password for narnia8.

What this level teaches

Combining the format-string write primitive with a function pointer to change control flow.

Key ideas

  • Function pointers store the address of code to call. Changing one changes what runs.
  • Writing a precise value. With %n and careful padding, you can write multi-byte values, sometimes in smaller pieces.
  • Reading the layout. The addresses of the intended and unintended functions are printed or discoverable in the program.
  • Same technique, new goal. You have already seen this idea in Level 5; here the target is different.

How to approach it

  1. Read the source and note how the pointer is set and used.
  2. Find the addresses involved and the stack position of your input.
  3. Build the format string, test with harmless values, then use the real ones.

Why it matters

Writing a pointer is the usual first step to controlling a program, even in modern, hardened software.