From e8bd4ac8684d273951e1f6a4deeca18cf53a6299 Mon Sep 17 00:00:00 2001 From: Ju06-sc Date: Mon, 29 Jun 2026 12:37:39 +0900 Subject: [PATCH 1/2] =?UTF-8?q?week07=20=EA=B3=BC=EC=A0=9C=20=EC=A0=9C?= =?UTF-8?q?=EC=B6=9C=20-=20=EC=9D=B4=EC=A3=BC=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../readme.md" | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 "assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" diff --git "a/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" "b/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" new file mode 100644 index 0000000..75d0e92 --- /dev/null +++ "b/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" @@ -0,0 +1,46 @@ +## 시스템 보안 과제(7주차) + +## 풀이 과정 +0. 문제 다운로드 및 서버 연결 +Image +-firebox브라우저에서 드림핵에 접속 +-문제 파일 다운로드 및 vm 생성 +*vm -> 잇스플로잇코드에 연결 시 사용 + +1. 취약점 분석 +Image +-scanf("%s", buf) => 해당 코드는 입력 길이를 제한하지 않아, 버퍼 오버플로우를 발생시킬 가능성 존재 +Image +-취약점 확인 + +2. 보호기법 확인 +Image +-'gdb ./rao' : pwndbg에서 파일 분석 가능 +Image +-'checksec'(보호기법 확인) : canary, pie가 모두 꺼져있음 -> 리턴 주소 덮어쓰는 공격 가능 +*canary: 오버플로우 탐지 기능/ pie: 주소 변경 기능 + +3. pwndbg 분석 +1) +Image +-'disas main' : 스택 구조 파악 +-'sub rsp, 0x30' : 스택에 0x30 공간 할당 +-'lea rax, [rbp-0x30]' : buf의 시작 주소 -> rbp-0x30 +-'ret' : main 종료 시 스택에서 리턴 주소를 꺼내 점프 , 이 주소를 get_shell로 덮어 쓰는 것이 목표 +2)b,r 로 브레이크 포인트 설정 후 실행 +-'b *main +54' , 'r' +3)get_shell 주소 확인 +Image +-'p get_shell' : 주소 확인 -> get_shell의 주소는 '0x4006aa' + +4. 잇스플로잇 코드 작성 +Image +*이전에 파악한 정보: 오프셋-56바이트 / get_shell 주소-0x4006aa +-'gedit exploit.py' : 코드 작성을 위한 코드 +-'padding = b'A' * 0x30 + b'B' * 0x8' : 56바이트 (buf 0x30 + saved RBP 0x8) +-'payload = padding + p64(0x4006aa)' : 리턴 주소를 get_shell로 교체 + +5. 플래그 획득 +Image +-'python3 exploit.py' +-파일 목록 확인 후 flag 파일로 플래그 얻기 \ No newline at end of file From 1ca96cad658d1e1dd5a88fb527a4c6db1ab41026 Mon Sep 17 00:00:00 2001 From: Ju06-sc Date: Mon, 29 Jun 2026 12:43:15 +0900 Subject: [PATCH 2/2] =?UTF-8?q?week07=20=EA=B3=BC=EC=A0=9C=20=EC=A0=9C?= =?UTF-8?q?=EC=B6=9C=20-=20=EC=9D=B4=EC=A3=BC=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../week07/\354\235\264\354\243\274\355\235\254/readme.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" "b/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" index 75d0e92..c2d77eb 100644 --- "a/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" +++ "b/assignment/week07/\354\235\264\354\243\274\355\235\254/readme.md" @@ -43,4 +43,4 @@ 5. 플래그 획득 Image -'python3 exploit.py' --파일 목록 확인 후 flag 파일로 플래그 얻기 \ No newline at end of file +-파일 목록 확인 후 flag 파일로 플래그 얻기 \ No newline at end of file