Featured image of post OverTheWire - Bandit - Level 4

OverTheWire - Bandit - Level 4

The solution to OverTheWires Bandit, Level 4

Well, hello party people! Let’s see what today has in store for us.

Challenge

Okie dokie, so it looks like we just have a bunch of files and they’re hard to script to look in all of them because of the prefix of hyphen in the format of -fileXX.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
ssh bandit3@bandit.labs.overthewire.org -p 2220

bandit4@bandit:~/inhere$ ls -la
total 48
drwxr-xr-x 2 root    root    4096 Feb 21 22:03 .
drwxr-xr-x 3 root    root    4096 Feb 21 22:03 ..
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file00
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file01
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file02
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file03
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file04
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file05
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file06
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file07
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file08
-rw-r----- 1 bandit5 bandit4   33 Feb 21 22:03 -file09

bandit4@bandit:~/inhere$ file *.*
*.*: cannot open `*.*' (No such file or directory)

Bummer, that didn’t work… oh duh, the pattern starts with hyphen LOL. Let’s just cat them all and see if we can find something that looks like our flag.

1
2
3
4
5
bandit4@bandit:~/inhere$ cat ./-file0*
=�M�Ð�EW�f��.Y>*���{K���H��G��[�o�Q�G�*�Y���~���d]��+S,�I�t^���\�9�Q]#�1���_�&5B���d�0^�]�D$�H��V���f��STA�܅�b����U�k5�?:�o�ҫ\ԑ2s��=n̩-�`C9��`V�_�ЪF�`V��E+�sa��F�a\6n�0t��N+f
                                     �FLAG_FLAG_FLAG_FLAG_FLAG_FLAG
d��
_8�o���W��[1m�)$�����R�"�_��)��!��Dg�H�H}�Xb���J

Yeeeeeee…. lets grep just so i can confirm that is the flag, and which file it’s in.

1
2
3
4
5
�bandit4@bandit:~/inhere$ grep -r 'FLAG_FLAG_FLAG_FLAG_FLAG_FLAG' .
./-file07:FLAG_FLAG_FLAG_FLAG_FLAG_FLAG

bandit4@bandit:~/inhere$ cat ./-file07
FLAG_FLAG_FLAG_FLAG_FLAG_FLAG

AWWWW YEAH

Built with Hugo
Theme Stack designed by Jimmy