defcon20 bin200

2012. 6. 22. 02:39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
 
int main(int argc, char *argv[])
{
    char fname[] = "c:\\mac.h";
    char buf[1024] = {0};
    FILE* fp;
    int ret = 0;
 
    fp = fopen(fname, "r");
    if (fp < 0)
    {
        printf("fopen error\n");
        return -1;
    }
    ret = fread(buf,1,991, fp);
     
    printf("buf: %s\n\n", buf);
 
    __asm{
        xor ecx, ecx
        mov edx, 1
        lea eax, dword ptr buf
        xor ebx, ebx
        dec eax
        dec ecx
#if 1
badcob:
        inc eax
        inc ecx
        mov bl, byte ptr ss:[eax]
        not bl
        mov byte ptr ss:[eax], bl
        cmp ecx, 0x3df
        jnz badcob     
#endif
    }
 
         
 
    printf("buf: %s\n", buf);
    fclose(fp);
    return 0;
}

'CTF' 카테고리의 다른 글

Holyshield 2010 Write up  (2) 2012.11.28
JFF2 JH1  (2) 2012.08.11
jff2 silly100  (5) 2012.08.06
defcon20 pp400 exploit  (0) 2012.06.16
defcon20 pp300 exploit  (0) 2012.06.16
defcon20 pp200 exploit  (0) 2012.06.16
pctf 2012 format  (0) 2012.05.09
Defcon 19 b500 writeup  (0) 2011.06.17
ISEC 2010 level8 random array  (0) 2010.11.10

badcob CTF