Bandit Level 6 → Level 7

Level Goal

The password for the next level is stored somewhere on the server and has all of the following properties: – owned by user bandit7 – owned by group bandit6 – 33 bytes in size

Commands you may need to solve this level

ls, cd, cat, file, du, find, grep

We will use find again with additional options. We already know -size 33c will find the file with 33 bytes. Option -group bandit6 will show the file belongs to bandit6 group. Option -user bandit7 will show the file belongs to user bandit7. Lastly, since this is somewhere in the server, we need to start the search at the root directory /. Finally, there will be a lot of file with Permission denied except one. To filter out this file, we can send the stderr to /dev/null where it will be ignore (2>/dev/null). Additional explanation on grep and on 2>/dev/null.

find / -size 33c -user bandit7 -group bandit6 2>/dev/null
cat /var/lib/dpkg/info/bandit7.password