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

Behemoth Level 4

Behemoth Level 4 — a program reads a file whose name depends on its process ID, which opens the door to a race condition using symbolic links.

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 behemoth4, find the password for behemoth5.

What this level teaches

Race conditions and predictable file names.

Key ideas

  • Predictable names. A file path derived from a value you can learn, such as the process ID, is predictable.
  • Time window. The program pauses between steps, which gives you time to change what a path points at.
  • Symbolic links. A link at the expected path can make the privileged program read a file it was never meant to show you.
  • Controlling the process. Job control or signals (kill -STOP) let you pause a process so you can prepare the link.

How to approach it

  1. Use strace to find which path the program opens and how it names it.
  2. Work out how to learn the process ID early and arrange for the right file to exist.
  3. Repeat until the timing works.

Why it matters

Time-of-check to time-of-use bugs are a major real-world class, which is why secure temporary-file functions exist.