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

Bandit Level 20

Bandit Level 20 — use a setuid binary to read a file owned by another user, and learn what the setuid permission bit means.

Table of Contents

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

Level Goal

To gain access to the next level, you should use the setuid binary in the homedirectory. Execute it without arguments to find out how to use it. The password for this level can be found in the usual place (/etc/bandit_pass), after you have used the setuid binary.

Helpful Reading Material

Study guide

Level map: logged in as bandit19, find the password for bandit20.

What this level teaches

How Unix lets a program run with its owner’s privileges, and why that is both useful and dangerous.

Key ideas

  • User IDs. A process has a real UID (who started it) and an effective UID (whose permissions it uses for access checks).
  • setuid. When a file has the setuid bit (shown as s in ls -l), running it makes the effective UID the file’s owner. The classic example is passwd, which lets ordinary users update a root-owned file.
  • id prints your current user and group IDs.
  • Boundary. Every setuid program is a deliberate crack in the privilege wall, so it must be written very carefully.

How to approach it

  1. Look at the binary with ls -l and note the s.
  2. Run it with no arguments, as the Level Goal suggests, and read how it wants to be used.
  3. The password then sits in the usual place under /etc/bandit_pass.

Why it matters

Hunting for setuid binaries (find / -perm -4000) is a standard step in Linux privilege escalation, both for attackers and for hardening audits.