v8 = __readfsqword(0x28u); pid = fork(); if ( pid ) { waitpid(pid, &stat_loc, 0); } else { for ( i = 0; i <= strlen(&flag); ++i ) /* 遍历 flag,将其中的i,r替换为 1 */ { if ( *(&flag + i) == 105 || *(&flag + i) == 114 ) *(&flag + i) = 49; } } printf("input the flag:"); __isoc99_scanf("%20s", s2); /*s2 即为我们输入的字符串*/ if ( !strcmp(&flag, s2) ) /*此处 &flag 是被处理过的flag*/ result = puts("this is the right flag!"); else result = puts("wrong flag!"); return result; }
追踪 &flag
1 2 3
.data:0000000000601080 flag db 7Bh ; DATA XREF: main+34↑r .data:0000000000601080 ; main+44↑r ... .data:0000000000601081 aHackingForFun db 'hacking_for_fun}',0