https://overthewire.org/wargames/bandit/bandit7.html
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
이제 슬슬 난이도가 올라간다.
bandit6@bandit:~$ ls
bandit6@bandit:~$ ls -al [1]
total 20
drwxr-xr-x 2 root root 4096 May 7 20:14 .
drwxr-xr-x 41 root root 4096 May 7 20:14 ..
-rw-r--r-- 1 root root 220 May 15 2017 .bash_logout
-rw-r--r-- 1 root root 3526 May 15 2017 .bashrc
-rw-r--r-- 1 root root 675 May 15 2017 .profile
bandit6@bandit:~$ cd /
bandit6@bandit:/$ ls [2]
bin cgroup2 etc initrd.img lib lib64 lost+found mnt proc root sbin srv tmp var vmlinuz.old
boot dev home initrd.img.old lib32 libx32 media opt README.txt run share sys usr vmlinuz
bandit6@bandit:/$ find / -size 33c -user bandit7 -group bandit6 [1]
find: ‘/root’: Permission denied [2]
find: ‘/home/bandit28-git’: Permission denied
find: ‘/home/bandit30-git’: Permission denied
find: ‘/home/bandit5/inhere’: Permission denied
find: ‘/home/bandit27-git’: Permission denied
find: ‘/home/bandit29-git’: Permission denied
find: ‘/home/bandit31-git’: Permission denied
...
/
에서 find
명령어에 위의 조건들을 다 옵션으로 걸어서 찾아보자.find / -size 33c -user bandit7 -group bandit6
cat
으로 찍어 보자니 왠지 뭔가 지는 것 같고 찝찝하다....
find: ‘/home/bandit5/inhere’: Permission denied
find: ‘/home/bandit27-git’: Permission denied
find: ‘/home/bandit29-git’: Permission denied
find: ‘/home/bandit31-git’: Permission denied
...
bandit6@bandit:/$ find / -size 33c -user bandit7 -group bandit6 2> /dev/null [1]
/var/lib/dpkg/info/bandit7.password [2]
bandit6@bandit:/$ cat /var/lib/dpkg/info/bandit7.password [3]
H??????????????????????????????
find / -size 33c -user bandit7 -group bandit6 2> /dev/null
2> /dev/null
로 에러난 결과를 모두 거른다./var/lib/dpkg/info/bandit7.password
라는 생긴 것부터 패스워드스러운 파일을 찾았다.cat
으로 열어보니 패스워드 같은 문자열이 보인다.다음 단계로 넘어가자
ssh -p 2220 bandit7@bandit.labs.overthewire.org
>
를 이용하여 출력의 방향을 지정해 줄 수 있다.dev/null
로 설정하였다.dev/null
은 쓰레기통(내지는 블랙홀?) 비슷한 개념으로, 여기로 날리면 그냥 사라진다.