Featured Content Slider

Home » » ctf.wargame.vn Pwn50 | 50

ctf.wargame.vn Pwn50 | 50

Vo Uu | 05:51 | 0 nhận xét
ĐỀ: http://challenges.wargame.vn:1337/pwn50/easy_overflow.c

SSRC:
/* stack1.c                                     *
* specially crafted to feed your brain by gera */
#include <stdio.h>
int main() {
int cookie = 0x1337;
char buf[8];
printf("buf: %08x cookie: %08x\n", &buf, &cookie);
fflush(stdout);
fgets(buf,13,stdin);
fflush(stdout);
printf("cookie value: %.8x\n",cookie);
if (cookie == 0x41424344)
printf("HERE IS YOUR FLAG: xxxxxxxxxxxxxxxxxxxxxxxxx\n");
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxx is censored, it is not real-flag, you must pwn on remote host to get real-flag :)

SỞ dòng char buf[8]; cho thấy mảng buf chỉ có thể chứa tối đa là 8 ký tự
Mà dòng fgets lại cho phép đầu vào lên tới 13 kí tự
==> bị BOF ở mảng buf sẽ bị tràn lên biến cookie (vì stack là đi lên :D)

0x41 là kí tự A
0x42 là kí tự B
0x43 là kí tự C
0x44 là kí tự D

Vậy ta phải input 8 kí tự cho biến buf và 4 kí tự "DCBA" để tràn lên biến cookie :D
Share this article :

0 nhận xét:

Đăng nhận xét

Recent Post

Test Footer 1

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. The UG - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger