본문 바로가기

블로그?

level 3 -> 4 /* The Lord of the BOF : The Fellowship of the BOF - orc - egghunter */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } // egghunter for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); if(argv[1][47] != '\xbf') { printf("stack is still your friend.\n"); exit(0); } strcpy(buffer, argv.. 더보기
level 2 -> 3 [cobolt@localhost cobolt]$ cat goblin.c /* The Lord of the BOF : The Fellowship of the BOF - goblin - small buffer + stdin*/ int main(){ char buffer[16]; gets(buffer); printf("%s\n", buffer);} Dump of assembler code for function main:0x80483f8 :push %ebp0x80483f9 :mov %ebp,%esp0x80483fb :sub %esp,160x80483fe :lea %eax,[%ebp-16]0x8048401 :push %eax0x8048402 :call 0x804830c 0x8048407 :add %esp,40x.. 더보기
level 1 -> 2 [gremlin@localhost gremlin]$ cat cobolt.c /* The Lord of the BOF : The Fellowship of the BOF - cobolt - small buffer*/ int main(int argc, char *argv[]){ char buffer[16]; if(argc < 2){ printf("argv error\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer);} (gdb) disas mainDump of assembler code for function main:0x8048430 :push %ebp0x8048431 :mov %ebp,%esp0x8048433 :sub %esp,160x8048.. 더보기
level gate -> 1 [gate@localhost gate]$ cat gremlin.c/* The Lord of the BOF : The Fellowship of the BOF - gremlin - simple BOF */ int main(int argc, char *argv[]) { char buffer[256]; if(argc < 2){ printf("argv error\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); } (gdb) disas mainDump of assembler code for function main:0x8048430 :push %ebp0x8048431 :mov %ebp,%esp0x8048433 :sub %esp,0x100//256b.. 더보기
dynamic linker dynamic linker의 내부 구조https://web.archive.org/web/20081215162517/http://x82.inetcop.org/h0me/papers/FC_exploit/relocation.txt dynamic section 덮어쓰기를 이용한 exphttp://pwn3r.tistory.com/entry/Docs-Reusing-Dynamic-Linker-for-Exploitation _dl_runtime_resolver의 함수 정보 조작을 통한 exphttp://gooverto.tistory.com/entry/Return-To-DL-Exploitation 더보기
vdso What is linux-gate.so.1? - by Johan Petersson 요즘 linux desktop에서 ldd를 때려보면 linux-gate.so.1이라는 파일이 보인다. [tolkien@tolkien tmp]$ ldd /bin/ls linux-gate.so.1 => (0xb7f84000) librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7f66000) libselinux.so.1 => /lib/libselinux.so.1 (0xb7f4d000) libacl.so.1 => /lib/libacl.so.1 (0xb7f45000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7df6000) libpthread.so.0 =>.. 더보기
함수 호출 과정, PLT와 GOT 리눅스 함수 호출 과정이 어떻게 될까? 간단한 printf 함수로 테스트를 해봤습니다. #include int main(){ printf("test~~~"); }다음 프로그램을 작성 후 gdb로 까보면.. (gdb) disas mainDump of assembler code for function main: 0x0804841b :lea ecx,[esp+0x4] 0x0804841f :and esp,0xfffffff0 0x08048422 :push DWORD PTR [ecx-0x4] 0x08048425 :push ebp 0x08048426 :mov ebp,esp 0x08048428 :push ecx 0x08048429 :sub esp,0x4 0x0804842c :sub esp,0xc 0x0804842f :p.. 더보기
syscall 목록 http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html 더보기
Assembly Learner https://github.com/Jinmo/AssemblyLearner 에서 받으실 수 있습니다.jinmo님께서 제작하신 어셈블리 교육용(?) 프레임워크입니다.문제 추가도 가능하고 이것저것 건드릴 수 있으니 프레임워크라 할 수 있으려나용 무튼.. 뭐 이런식으로 구성되어 있고 왼쪽에서 코드를 입력한 후 실행을 하게 되면 제가 입력한 코드를 실행해줍니다.사실 C 인라인 어셈블리 외에는 처음 해봐서 음음 첨엔 헷갈렸는데 하다보니 재밌더라구요아무튼 튜토리얼부터 해봅시다. 지문 그대로 읽어보시고 하면 됩니다. eax를 2 * eax + 1로 만들라고 했으니 위와 같이 해주면 풀렸습니다! 라고 뜹니당근데 답 보기 버튼은 실행이 안되네용..아무튼 본 문제로 해봅시다! 2-1. 쉘코드 짜기 - int 0x80!Ins.. 더보기
stack6,7 (gdb) disas mainDump of assembler code for function main:0x080484fa :push ebp0x080484fb :mov ebp,esp0x080484fd :and esp,0xfffffff00x08048500 :call 0x8048484 //바로 점프0x08048505 :mov esp,ebp0x08048507 :pop ebp0x08048508 :ret End of assembler dump.(gdb) disas getpathDump of assembler code for function getpath:0x08048484 :push ebp0x08048485 :mov ebp,esp0x08048487 :sub esp,0x68//0x68byte 할당0x0804848a .. 더보기