[카테고리:] Wargame


  • 얼마전 sophos 사이트에 올라온 DecodeMe 풀이

    얼마전 sophos 사이트에 올라온 Decodeme 문제에 대한 풀이를 기록 합니다. http://www.sophos.com/blogs/duck/g/2010/05/15/sophos-auscert-decodeme/ http://www.sophos.com/blogs/duck/g/2010/05/16/decodeme-t-shirt-tex/ 문제를 보면 아래와 같은 로고가 주어지고 디코딩을 하라고 합니다. %~~~~~~~~~~~~~~~~~~~~~~~~% |H4sIAAAAAAACA3P3dLOwTOxh| |YGF4zsBg7tHJMApGwYgE////| |V/zJwsjF8I9BB8QH5QkGjhYG| |xj/MD' gULH| |JrY' BbVi| |Tlx| Y4NgmoOxWoxH4yL5d| |VDR| oTseHh8f6WK359lQU| |qJy\ \YJOGt| |xhN5I\ \dlr| |qoJvnIznRDXvHjPWZ |SY7| |Lz31nKtYPklkV0F6w |AKr| |1E17 ,Vk5| |afng ,hp63R| |VsvNzy8u9qpU670lon11hvnS| |KNWuSS+vrvNf3HV05beU0NXB| |p71kJQQYrAFt8kQCpwMAAA==| %~~~~~~~~~~~~~~~~~~~~~~~~% D E C O D E […]

  • io.smashthestack.org – Level 10

    Level 10 소스는 아래와 같다. #include <stdio.h> #include <stdlib.h> #include <unistd.h> // Contributed by Torch int limit, c; int getebp() { __asm__("movl %ebp, %eax"); } void f(char *s) { int *i; char buf[260]; i = (int *)getebp(); limit = *i – (int)buf + 1; for (c = 0; c < limit && s[c] != '\0'; […]

  • io.smashthestack.org – Level 9

    Level 9 문제 소스는 아래와 같다. #include <stdio.h> #include <string.h> int main(int argc, char **argv) { int pad = 0xbabe; char buf[1024]; strncpy(buf, argv[1], sizeof(buf) – 1); printf(buf); return 0; } 포멧스트링 문제로 보인다. 확인해 보도록 하자. level9@io:/levels$ ./level09 %x bfffdec8level9@io:/levels$ ./level09 AAAA%x%x%x%x AAAAbfffdebe3ffbfffd94041414141level9@io:/levels$ 포멧스트링 문제가 맞는 것으로 보인다. 이제 포멧스트링 공격에 필요한 값들을 확인해 […]

  • io.smashthestack.org – Level 8

    Level 8 문제 소스는 아래와 같다. 우선 gdb를 이용하여 디버깅을 해보도록 하자. level8@io:/tmp/by8$ gdb /levels/level08 GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by […]

  • io.smashthestack.org – Level 7

    Level 7 문제 소스는 아래와 같다. #include <unistd.h> #include <stdio.h> #include <stdlib.h> // We are never deceived; we deceive ourselves. – Johann Wolfgang von Goethe void check_id(unsigned int id) { if(id > 10) { execl("/bin/sh", "sh", NULL); } else { printf("Not today son\n"); } } int main(int argc, char *argv[]) { int id; sscanf(argv[1], "%d", […]

  • io.smashthestack.org – Level 6

    Level 6 문제 소스는 아래와 같다. #include<string.h> // The devil is in the details – nnp void copy_buffers(char *argv[]) { char buf1[32], buf2[32], buf3[32]; strncpy(buf2, argv[1], 31); strncpy(buf3, argv[2], sizeof(buf3)); strcpy(buf1, buf3); } int main(int argc, char *argv[]) { copy_buffers(argv); return 0; } 특별히 오버플로우가 날거 같은 부분이 보이지 않는다. 하지만 아래와 같이 입력을 하면 […]

  • io.smashthestack.org – Level 5

    Level 5의 소스는 아래와 같다. #include <stdio.h> #include <string.h> int main(int argc, char **argv) { char buf[128]; if(argc < 2) return 1; strcpy(buf, argv[1]); printf("%s\n", buf); return 0; } 문제는 간단하다. argv[1]을 buf 변수에 strcpy() 함수를 이용하여 옮기나 buf 변수의 크기보다 더 많은 값을 넣으면 오버플로우가 될것임을 알 수 있다. 따라서 환경변수에 NOP + SHELLCODE를 […]

  • io.smashthestack.org – Level 4

    Level 4 문제 소스는 아래와 같다. #include <stdlib.h> int main() { system("id"); return 0; } id를 실행시키는 간단한 소스다.. PATH 환경변수를 설정해서 우리가 직접 작성한 id를 실행시키면 쉘을 획득할 수 있을 것이다. /tmp/by4 폴더에 id를 새로 작성하여 아래와 같이 공격을 시도 하였다. level4@io:/tmp/by4$ env TERM=linux SHELL=/bin/bash SSH_CLIENT=211.218.16.99 23923 22 OLDPWD=/tmp SSH_TTY=/dev/pts/2 USER=level4 MAIL=/var/mail/level4 PATH=/usr/local/bin:/usr/bin:/bin:/usr/games PWD=/tmp/by4 […]

  • io.smashthestack.org – Level 3

    Level 3 문제 소스는 아래와 같다. #include <stdio.h> #include <unistd.h> #include <string.h> int good(int addr) { printf("Address of hmm: %p\n", addr); } int hmm() { printf("Win.\n"); execl("/bin/sh", "sh", NULL); } extern char **environ; int main(int argc, char **argv) { int i, limit; for(i = 0; environ[i] != NULL; i++) memset(environ[i], 0x00, strlen(environ[i])); int (*fptr)(int) = […]

  • io.smashthestack.org – Level 2

    Level 2 문제를 실행하면 아래와 같다. level2@io:/tmp/by$ /levels/level02 Append the 39th through 42nd numbers in the sequence as a string and feed it to this binary via argv[1]. 1, 2, 3, 5, 8, 13, 21… The 4th through the 7th numbers would give you 581321 level2@io:/tmp/by$ 위 수열에서 39번째부터 42번째를 이어서 쓴 값을 argv[1]로 넣으라고 […]