Skip to main content

34 posts tagged with "bandit"

View All Tags

Bandit Level 5 → 6

Shubham
Cybersecurity Enthusiast

Login : ssh bandit5@bandit.labs.overthewire.org -p 2220
password : 4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw

task :

The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties: -human-readable
1033 bytes in size
-not executable

Theory lil bit:

  1. file <path> — reports a file’s type (e.g. ASCII text = human readable).
  2. * and brace expansion {.,}* — wildcard patterns; {.,}* helps include dotfiles (hidden files).
  3. | (pipe) — sends output of one command as input to another (e.g. file ... | grep ASCII).
  4. grep PATTERN — filter lines that match PATTERN; grep -v PATTERN inverts (exclude lines).
  5. du -b -a — lists file sizes in bytes (-b) for all files (-a).
  6. find . -type f -size 1033c ! -executable -exec file '{}' \; — find regular files of exact size 1033 bytes (1033c), that are non-executable (! -executable), and run file on each result.

solution:

bandit5@bandit:~$ ls
inhere
bandit5@bandit:~$ cd inhere
bandit5@bandit:~/inhere$ ls -la
total 88
drwxr-x--- 22 root bandit5 4096 Aug 15 13:16 .
drwxr-xr-x 3 root root 4096 Aug 15 13:16 ..
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere00
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere01
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere02
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere03
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere04
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere05
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere06
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere07
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere08
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere09
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere10
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere11
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere12
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere13
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere14
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere15
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere16
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere17
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere18
drwxr-x--- 2 root bandit5 4096 Aug 15 13:16 maybehere19
bandit5@bandit:~/inhere$ file */{.,}* | grep "ASCII"
maybehere00/.file1: ASCII text, with very long lines (550)
maybehere00/.file2: ASCII text, with very long lines (7835)
maybehere01/.file2: ASCII text, with very long lines (3069)
maybehere02/.file1: ASCII text, with very long lines (6350)
maybehere02/.file2: ASCII text, with very long lines (2576)
maybehere03/.file1: ASCII text, with very long lines (9768)
maybehere03/.file2: ASCII text, with very long lines (8879)
maybehere04/.file1: ASCII text, with very long lines (2439)
maybehere04/.file2: ASCII text, with very long lines (6143)
maybehere05/.file1: ASCII text, with very long lines (3200)
maybehere05/.file2: ASCII text, with very long lines (5916)
maybehere06/.file1: ASCII text, with very long lines (1270)
maybehere06/.file2: ASCII text, with very long lines (8975)
maybehere07/.file1: ASCII text, with very long lines (3064)
maybehere07/.file2: ASCII text, with very long lines (1000)
maybehere08/.file1: ASCII text, with very long lines (8168)
maybehere08/.file2: ASCII text, with very long lines (746)
maybehere09/.file1: ASCII text, with very long lines (6762)
maybehere09/.file2: ASCII text, with very long lines (8516)
maybehere10/.file1: ASCII text, with very long lines (7091)
maybehere10/.file2: ASCII text
maybehere11/.file1: ASCII text, with very long lines (451)
maybehere11/.file2: ASCII text, with very long lines (2500)
maybehere12/.file1: ASCII text, with very long lines (5814)
maybehere12/.file2: ASCII text, with very long lines (8243)
maybehere13/.file1: ASCII text, with very long lines (5257)
maybehere13/.file2: ASCII text, with very long lines (8951)
maybehere14/.file1: ASCII text, with very long lines (3426)
maybehere14/.file2: ASCII text, with very long lines (1502)
maybehere15/.file1: ASCII text, with very long lines (2158)
maybehere15/.file2: ASCII text
maybehere16/.file1: ASCII text, with very long lines (5425)
maybehere16/.file2: ASCII text, with very long lines (8471)
maybehere17/.file1: ASCII text, with very long lines (894)
maybehere17/.file2: ASCII text, with very long lines (8340)
maybehere18/.file1: ASCII text, with very long lines (5701)
maybehere18/.file2: ASCII text, with very long lines (2083)
maybehere19/.file1: ASCII text, with very long lines (7208)
maybehere19/.file2: ASCII text, with very long lines (4739)
maybehere00/-file1: ASCII text, with very long lines (1038)
maybehere00/-file2: ASCII text, with very long lines (9387)
maybehere00/spaces file1: ASCII text, with very long lines (6117)
maybehere00/spaces file2: ASCII text, with very long lines (6849)
maybehere01/-file1: ASCII text, with very long lines (6027)
maybehere01/-file2: ASCII text
maybehere01/spaces file1: ASCII text, with very long lines (4138)
maybehere01/spaces file2: ASCII text, with very long lines (4542)
maybehere02/-file1: ASCII text, with very long lines (3800)
maybehere02/spaces file1: ASCII text, with very long lines (6745)
maybehere02/spaces file2: ASCII text, with very long lines (8487)
maybehere03/-file1: ASCII text, with very long lines (314)
maybehere03/-file2: ASCII text, with very long lines (6594)
maybehere03/spaces file1: ASCII text, with very long lines (2189)
maybehere03/spaces file2: ASCII text, with very long lines (3384)
maybehere04/-file1: ASCII text, with very long lines (4409)
maybehere04/-file2: ASCII text, with very long lines (2618)
maybehere04/spaces file1: ASCII text, with very long lines (5531)
maybehere04/spaces file2: ASCII text, with very long lines (2490)
maybehere05/-file1: ASCII text, with very long lines (2345)
maybehere05/-file2: ASCII text, with very long lines (5958)
maybehere05/spaces file1: ASCII text, with very long lines (879)
maybehere05/spaces file2: ASCII text, with very long lines (2419)
maybehere06/-file1: ASCII text, with very long lines (5730)
maybehere06/-file2: ASCII text, with very long lines (1075)
maybehere06/spaces file1: ASCII text, with very long lines (4072)
maybehere06/spaces file2: ASCII text, with very long lines (4250)
maybehere07/-file1: ASCII text, with very long lines (3662)
maybehere07/-file2: ASCII text, with very long lines (2487)
maybehere07/spaces file1: ASCII text, with very long lines (4129)
maybehere07/spaces file2: ASCII text, with very long lines (9063)
maybehere08/-file1: ASCII text, with very long lines (1076)
maybehere08/-file2: ASCII text, with very long lines (3824)
maybehere08/spaces file1: ASCII text
maybehere08/spaces file2: ASCII text, with very long lines (3692)
maybehere09/-file1: ASCII text, with very long lines (3627)
maybehere09/-file2: ASCII text, with very long lines (773)
maybehere09/spaces file1: ASCII text, with very long lines (5300)
maybehere09/spaces file2: ASCII text, with very long lines (8715)
maybehere10/-file1: ASCII text, with very long lines (1051)
maybehere10/-file2: ASCII text, with very long lines (1990)
maybehere10/spaces file1: ASCII text, with very long lines (8268)
maybehere10/spaces file2: ASCII text, with very long lines (3569)
maybehere11/-file1: ASCII text, with very long lines (1210)
maybehere11/-file2: ASCII text, with very long lines (4558)
maybehere11/spaces file1: ASCII text, with very long lines (3146)
maybehere11/spaces file2: ASCII text, with very long lines (502)
maybehere12/-file1: ASCII text, with very long lines (9677)
maybehere12/-file2: ASCII text
maybehere12/spaces file1: ASCII text, with very long lines (2156)
maybehere12/spaces file2: ASCII text, with very long lines (2459)
maybehere13/-file1: ASCII text, with very long lines (1358)
maybehere13/-file2: ASCII text, with very long lines (1422)
maybehere13/spaces file1: ASCII text, with very long lines (3951)
maybehere13/spaces file2: ASCII text, with very long lines (951)
maybehere14/-file1: ASCII text, with very long lines (4281)
maybehere14/-file2: ASCII text, with very long lines (8350)
maybehere14/spaces file1: ASCII text, with very long lines (1381)
maybehere14/spaces file2: ASCII text, with very long lines (870)
maybehere15/-file1: ASCII text, with very long lines (8793)
maybehere15/-file2: ASCII text, with very long lines (9498)
maybehere15/spaces file1: ASCII text, with very long lines (1622)
maybehere15/spaces file2: ASCII text
maybehere16/-file1: ASCII text, with very long lines (4276)
maybehere16/-file2: ASCII text, with very long lines (5300)
maybehere16/spaces file1: ASCII text, with very long lines (9772)
maybehere16/spaces file2: ASCII text, with very long lines (3145)
maybehere17/-file1: ASCII text, with very long lines (1132)
maybehere17/-file2: ASCII text, with very long lines (1790)
maybehere17/spaces file1: ASCII text, with very long lines (8360)
maybehere17/spaces file2: ASCII text, with very long lines (3386)
maybehere18/-file1: ASCII text, with very long lines (9696)
maybehere18/-file2: ASCII text
maybehere18/spaces file1: ASCII text, with very long lines (7333)
maybehere18/spaces file2: ASCII text, with very long lines (6347)
maybehere19/-file1: ASCII text, with very long lines (6301)
maybehere19/-file2: ASCII text, with very long lines (5593)
maybehere19/spaces file1: ASCII text, with very long lines (7185)
maybehere19/spaces file2: ASCII text, with very long lines (8784)
bandit5@bandit:~/inhere$ du -b -a | grep 1033
1033 ./maybehere07/.file2
bandit5@bandit:~/inhere$ file ./maybehere07/.file2
./maybehere07/.file2: ASCII text, with very long lines (1000)
bandit5@bandit:~/inhere$ cat ./maybehere07/.file2
HWasnPhtq9AVKe0dmk45nxy20cvUa6EG


or we also have one liner!!!

bandit5@bandit:~/inhere$ find . -type f -size 1033c ! -executable -exec file '{}' \; | grep ASCII
./maybehere07/.file2: ASCII text, with very long lines (1000)
bandit5@bandit:~/inhere$ cat ./maybehere07/.file2
HWasnPhtq9AVKe0dmk45nxy20cvUa6EG
`

Bandit Level 6 → 7

Shubham
Cybersecurity Enthusiast

Login : ssh bandit6@bandit.labs.overthewire.org -p 2220
password : HWasnPhtq9AVKe0dmk45nxy20cvUa6EG

task :

Find a file somewhere on the server with these properties:
-owned by user bandit7
-owned by group bandit6
-exactly 33 bytes in size

Theory lil bit:

  1. ls -l shows owner and group (3rd and 4th columns).
  2. Example: -rw-r----- 1 bandit7 bandit6 33 ... bandit7.password → user bandit7, group bandit6, size 33.
  3. find can search by owner and group: -user <name>, -group <name>.
  4. Use -type f to restrict to regular files and -size 33c to match exactly 33 bytes (c = bytes).
  5. Searching from / can produce many “Permission denied” messages; redirect stderr to /dev/null with 2>/dev/null to hide them.

solution:

bandit6@bandit:~$ find / -type f -user bandit7 -group bandit6 -size 33c 2>/dev/null
/var/lib/dpkg/info/bandit7.password
bandit6@bandit:~$ cat /var/lib/dpkg/info/bandit7.password
morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj

`

Bandit Level 7 → 8

Shubham
Cybersecurity Enthusiast

Login : ssh bandit6@bandit.labs.overthewire.org -p 2220
password : morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj

task

Get the password from a file, next to the word millionth

theory lil bit

  1. grep <pattern> prints lines that match <pattern>.
  2. Use the pipe | to send output from one command into another (e.g. cat data.txt | grep millionth), though grep can read files directly: grep millionth data.txt.
  3. For very large files, grep is much faster than manually inspecting with less or cat.

solution

bandit7@bandit:~$ ls
data.txt
bandit7@bandit:~$ du -b data.txt
4184396 data.txt
bandit7@bandit:~$ cat data.txt | grep millionth
millionth dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc
bandit7@bandit:~$

`

Bandit Passwords

Shubham
Cybersecurity Enthusiast

bandit0 : bandit0
Bandit1 : ZjLjTmM6FvvyRnrb2rfNWOZOTa6ip5If
Bandit2 : 263JGJPfgU6LtdEvgfWU1XP5yac29mFx
Bandit3 : MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
Bandit4 : 2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ
Bandit5 : 4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw
Bandit6 : HWasnPhtq9AVKe0dmk45nxy20cvUa6EG
Bandit7 : morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj
Bandit8 : dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc
Bandit9: 4CKMh1JI91bUIZZPXDqGanal4xvAg0JM
Bandit10 : FGUW5ilLVJrxX9kMYMmlN4MgbpfMiqey
Bandit11 : dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
Bandit12 : 7x16WNeHIi5YkIhWsfFIqoognUTyj9Q4
Bandit13 : FO5dwFsc0cbaIiH0h8J2eUks2vdTDwAn
Bandit14 : MU4VWeTyJk8ROof1qqmcBPaLh7lDCPvS
Bandit15 : 8xCjnmgoKbGLhHFAZlGE5Tmu4M2tKJQo
Bandit16 : kSkvUpMQ7lBYyCM4GBPvCvT1BfWRy0Dx
Bandit17 : ssh key
Bandit18 : x2gLTTjFwMOhQ8oWNbMN362QKxfRqGlO
Bandit19 : cGWpMaKXVwDUNgPAVJbWYuGHVn9zl3j8
Bandit20 : 0qXahG8ZjOVMN9Ghs7iOWsCfZyXOUbYO

`