We found a program that is hiding a flag but requires you to guess the number it is thinking of. Chances are Linux has an easy way to try all the numb$
Either use SSH or use the Web Shell to get onto the shell server and navigate to the correct directory. Then do a quick Google search on 'bash loops'.$
-
First i nagivate to the directory:- /problems/77ad2ec283d51f7b1ddc449ffe109e0b
cd /problems/77ad2ec283d51f7b1ddc449ffe109e0b in the terminal.
-
Then i saw two files was their
cd /problems/77ad2ec283d51f7b1ddc449ffe109e0bin the terminal.A> BashLoop (Binary file) B> Flag (But we don't had permisson to open the flag file directely.
-
Then i tried to execute that Binary file And it says
$./Bashloop "What number am I thinking of? It is between 0 and 4096" -
So if we do
./Bashloop 3
Then it says
$ ./bashloop 1337 Nope. Pick another number between 0 and 4096 ```text -
So now read the hint It says:-
Then do a quick Google search on 'bash loops'. You may need to use grep to filter out the responses as well!
So now we can use FOR loop
link https://ryanstutorials.net/bash-scripting-tutorial/bash-loops.php
Read about for loop their,
Now
lets make for last payload
we can use any number from 0 to 4096
then
for spirit in {0..4096};do /problems/77ad2ec283d51f7b1ddc449ffe109e0b/bashloop $spirit |grep -v "Nope. Pick another number between 0 and 4096"; doneand we got the flag
$ for spirit in {0..4096}; do /problems/77ad2ec283d51f7b1ddc449ffe1
09e0b/bashloop $spirit |grep -v "Nope. Pick another number bet
ween 0 and 4096"; done
Yay! That's the number! Here be the flag: 9963698b982d491536db
b9cec73a417eThanks :)