Fascination
article thumbnail
[2023 Hacking-Camp CTF / pwnable] horcrux write-up
War Game & CTF/CTF-writeup 2023. 2. 14. 23:44

해당 문제도 SISS 부원 중 시스템 해킹을 처음 공부하고 있는 사람이 냈다고해서 풀어봤다. 실제 대회에서는 for beginner 태그가 붙었다고하니 아마 입문자들이 가장 먼저 도전해보지 않았을까 싶다 # 문제분석 - 주어진 소스코드 이미 소스코드가 주어졌기 때문에 우리는 실제 buf가 할당되는 크기만 확인해주면 어렵지 않게 문제를 해결할 수 있을 것이다. #include #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGA..

article thumbnail
[2023 Hacking-Camp CTF / pwnable] step write-up
War Game & CTF/CTF-writeup 2023. 2. 14. 22:53

이번에 SISS에서 처음으로 pwnable을 3명이나 출제했다는 소식에 해킹캠프는 참여하지는 않았지만, SISS 부원들이 제작한 문제만 풀어보기로 했다. # 문제분석 checksec로 확인해보니 canary외에는 크게 신경써야 할 보호기법이 보이지 않는 것 같다 카나리만 우회한다면 buffer overflow 취약점으로 return address를 조작할 수 있지 않을까라고 생각했다 문제풀이에 유용한 함수를 찾아보기 위해 pwndbg의 info func 기능을 사용해보았다 get_shell 함수를 확인할 수 있었고 gdb로 확인했을 때 shell을 딸 수 있게해주는 함수인 것을 확인할 수 있었다 main에서 사용되는 함수와 함수에 사용되는 인자 값으로 예측한 프로그램의 흐름은 다음과 같다 1. buf가 ..

article thumbnail
[Dreamhack] file-download-1
War Game & CTF/Dreamhack 2023. 2. 8. 00:28

[Dreamhack] file-download-1 File Download 취약점이 존재하는 웹 서비스입니다. flag.py를 다운로드 받으면 플래그를 획득할 수 있습니다. # 접속 - Home Navigation Bar에 Home과 Upload My Memo가 링크로 걸려있음을 확인할 수 있음 메모를 추가할 경우 Home에서 바로 확인이 가능한 형태이며 해당 메모를 클릭하면 내용을 볼 수 있음 - upload 파일의 이름과 내용을 작성하여 메모를 추가할 수 있는 페이지 - read upload했던 메모를 확인할 수 있음 url을 확인했을 시 get parameter로 파일 이름을 이용하고 있음 # 코드 확인 - app.py 파일을 upload하는 부분에서는 find 함수를 통해 ".."을 필터링하고 있..

article thumbnail
[Bandit] Level 4 → Level 5

[Bandit] Level 4 → Level 5 Bandit: https://overthewire.org/wargames/bandit/bandit5.html 1. Level Goal 다음 단계로 넘어가기 위한 비밀번호는 "inhere" 디렉토리 안에 오직 사람만 읽을 수 있는(human-readable) 파일 형태로 저장되어 있다 2. Commands you may need to solve this level ls cd cat file du find 3. 개념 정리 및 풀이 방법 file 명령어 *(asterisk) 활용: 현재 경로의 모든 파일을 의미하는 "./*"을 사용하면 현재 디렉토리 내 모든 파일에 대해 file 명령어를 실행할 수 있다 file 명령어의 사용에 대해서는 앞에서 정리했으므로 생략..

article thumbnail
[Bandit] Level 3 → Level 4

[Bandit] Level 3 → Level 4 Bandit: https://overthewire.org/wargames/bandit/bandit4.html 1. Level Goal 다음 단계로 넘어가기 위한 비밀번호는 inhere directory안에 숨은 파일로 저장되어 있다 2. Commands you may need to solve this level ls cd cat file du find 3. 개념 정리 및 풀이 방법 ls 명령어 옵션 -a: .으로 시작하는 요소를 무시하지 않음 -a 옵션을 사용하면 숨은 파일을 확인할 수 있다 문제 풀이 환경: Linux Ubuntu 18.04 현재 사용자의 위치는 home 디렉토리이므로 ls 명령어를 통해 inhere 디렉토리가 존재함을 확인한다 cd(ch..

article thumbnail
[Bandit] Level 2 → Level 3

[Bandit] Level 2 → Level 3 Bandit: https://overthewire.org/wargames/bandit/bandit3.html 1. Level Goal 다음 단계로 넘어가기 위한 비밀번호는 "spaces in this filename"이라는 이름을 가지며 홈디렉토리 안에 위치하고 있다 2. Commands you may need to solve this level ls cd cat file du find 💡 Helpful reading material: Google Search for "spaces in filename" 3. 개념 정리 및 풀이 방법 ls 명령어 및 cat 명령어는 이전 단계에서 정리했으므로 생략한다 [Bandit] Level 0 → Level 1 [Ban..

article thumbnail
[Bandit] Level 1 → Level 2

[Bandit] Level 1 → Level 2 Bandit : https://overthewire.org/wargames/bandit/bandit2.html 1. Level Goal 다음 Level을 위한 password는 home directory 안에 '-'라고 불리는 파일 안에 저장되어 있다 2. Commands you may need to solve this level ls cd cat file du find 💡 Helpful reading material: Google Search for "dashed filename" 3. 개념 정리 및 풀이 방법 ls 명령어 및 cat 명령어는 앞 단계에서 정리했으므로 생략한다. [Bandit] Level 0 → Level 1 [Bandit] Level 0..

article thumbnail
[Bandit] Level 0 → Level 1

[Bandit] Level 0 → Level 1 Bandit: https://overthewire.org/wargames/bandit/bandit1.html 1. Level Goal 다음 레벨의 password는 홈 디렉토리에 있는 readme라는 파일에 저장된다 ssh를 사용하여 bandit1에 로그인하려면 해당 password가 필요하다 각 level의 password를 찾을 때마다 ssh(port: 2220)을 사용하여 해당 레벨에 로그인하고 게임을 진행할 수 있다 2. Commands you may need to solve this level ls cd cat file du find 3. 개념 정리 및 풀이 방법 ls 명령어: list의 줄임말로 현재 위치나 특정 경로의 디렉토리 내용의 리스트를 ..

article thumbnail
[Bandit] Level 0: Bandit 접속하기

[Bandit] Level 0: Bandit 접속하기 Bandit: https://overthewire.org/wargames/bandit/ 1. Level Goal 목표는 ssh를 사용하여 게임에 접속하는 것이다 host는 bandit.labs.overthewire.org에 연결되어야하며 이때 port는 2220을 사용한다 username은 bandit0로 설정한다 로그인 한 이후에는 level 1로 가기 위한 방법을 찾으면 된다 2. Commands you may need to solve this level ssh 3. 풀이 방법 및 개념 정리 ssh 설치 $ sudo apt update $ sudo apt install openssh-server ssh 서비스 실행 확인 $ sudo systemct..

article thumbnail
[Dreamhack] basic_rop_x86
War Game & CTF/Dreamhack 2022. 9. 24. 17:01

basic_rop_x86 이 문제는 서버에서 작동하고 있는 서비스(basic_rop_x86)의 바이너리와 소스 코드가 주어집니다. Return Oriented Programming 공격 기법을 통해 셸을 획득한 후, “flag” 파일을 읽으세요. “flag” 파일의 내용을 워게임 사이트에 인증하면 점수를 획득할 수 있습니다. 플래그의 형식은 DH{…} 입니다. # 문제 분석 - 소스 코드 main 함수에서 read 함수와 write 함수를 사용함 initialize 함수에서 puts 함수를 사용함 → 인자를 하나만 필요로 하기 때문에 이를 활용하여 페이로드를 작성하면 좋을 것 데이터를 읽어들일 수 있는 함수는 read 함수이며, 이를 통해 system 함수의 주소를 구하게 된다면 이미 ROP 페이로드가 ..