BASH Level 3

Table of Contents

RANDOM is fun, but there is always some ways to bypass it.

Problem

#!/bin/bash

x=$RANDOM
echo "Input the random number."
read input

if [[ "$input" -eq "$x" ]]
then
        echo "AWESOME sauce"
        cat flag.txt
else
        echo "$input"
        echo "$x try again"
fi

Solution

This is maybe an unintended solution.

What is $input?

What is $x?

How can we get $input equal with $x?

level3@5a2276bbe718:~$ sudo -u level4 ./passcodes.sh
Input the random number.
x
AWESOME sauce
auctf{wut_r_d33z_RaNdom_numz}
Nemo Xiong avatar
Nemo Xiong
ex-Cybersecurity Executor, now a student in Unimelb
comments powered by Disqus