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.

Theme & Build

Jekyll v3.10.0
Last BuildOct 17, 19:54

Page Info

Layout default
Collection none
Path overthewire/bandit/bandit27.md
URL /docs/wargames/bandit/bandit27/
Date 2026-04-07

Source Code

Set repository: USER/REPO in your _config.yml to enable source-code shortcuts.

Bandit27

Bandit Level 27 — you already have a shell as bandit26; use a setuid helper in its home directory to read the next password.

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

Level Goal

Good job getting a shell! Now hurry and grab the password for bandit27!

Commands you may need to solve this level

ls

Study guide

Level map: logged in as bandit26, find the password for bandit27.

What this level teaches

Recognising a pattern you have met before: the setuid binary from Level 20 again, this time as your route to the next user.

Key ideas

  • Reuse patterns. After a hard level, the follow-up can be easy, provided you recognise what you are looking at.
  • ls -l shows an s in the permissions of a setuid file and who owns it.
  • How the helper behaves. Run it with no arguments to see what it expects.

How to approach it

  1. List your home directory and spot the setuid program.
  2. Work out, from its usage message, how to make it act as bandit27 on your behalf.
  3. Use it to read the file in /etc/bandit_pass.

Why it matters

Mature administrators know “how do I run one command as another user” by heart: sudo, setuid helpers and su all follow the same idea.