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

Bandit Level 26

Bandit Level 26 — discover that a user's login shell is not bash, then break out of the restricted program that replaced it.

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

Level Goal

Logging in to bandit26 from bandit25 should be fairly easy… The shell for user bandit26 is not /bin/bash, but something else. Find out what it is, how it works and how to break out of it.

NOTE: if you’re a Windows user and typically use Powershell to ssh into bandit: Powershell is known to cause issues with the intended solution to this level. You should use command prompt instead.

Commands you may need to solve this level

ssh, cat, more, vi, ls, id, pwd

Study guide

Level map: logged in as bandit25, gain an interactive shell as bandit26.

What this level teaches

How login shells work, and that many ordinary programs have built-in escape hatches.

Key ideas

  • Login shell. The final field of each line in /etc/passwd names the program run at login. It need not be a shell, and it can be a program that lets you do only one thing.
  • Pagers. more shows text one screenful at a time. Interactive pagers and editors such as vi can launch commands, edit files and change settings, which makes them valuable stepping stones.
  • Terminal size matters. A pager only pauses when output is taller than your window, so the size of the window affects what you can do.
  • GTFOBins. A public catalogue of normal Unix programs that can be abused to escape restrictions.

How to approach it

  1. Look at the shell recorded for bandit26 and read what that program does.
  2. Think about what happens if the output is longer than your terminal, and what you can do in that state.
  3. From inside an editor, remember that it can run commands and change the shell it uses.
  4. If you use Windows, run ssh from Command Prompt rather than PowerShell, as the Level Goal advises.

Why it matters

Restricted shells, kiosk systems and sudo rules that permit “just one safe command” are all defeated by this kind of escape.