Writeups OverTheWireBanditLinuxcronmd5sum

Bandit 22 Writeup - OverTheWire

Writeup for Bandit level 22 from OverTheWire: reverse-engineering a cron script to find a temp file.

Contents

Wargame: Bandit

Level: 22

Category: Linux Fundamentals

Description

A cron job runs a script that computes a filename using echo and md5sum based on the username. We must replicate the computation to find the temp file where the password is stored.

Overview

Solution

Step 1: Read the Cron Script

cat /usr/bin/cronjob_bandit23.sh

Step 2: Compute the Filename for bandit23

command = ["echo", "I am user bandit23", "|", "md5sum", "|", "cut", "-d", "' '", "-f", "1"]
channel = connect.system(" ".join(command))
filename = channel.recv().decode().strip()

Step 3: Read the Temp File

cat /tmp/<md5hash>

Password

QYw0Y2aiA672PsMmh9puTQuhoz8SyR2G

← Back to Blog