-
[HackerSchool] Level12오래된/HackerSchool 2011. 5. 6. 08:00
[level12@ftz level12]$ cat hint
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main( void )
{
char str[256];setreuid( 3093, 3093 );
printf( "문장을 입력하세요.\n" );
gets( str );
printf( "%s\n", str );
}[ level12 hint ]
hint 의 소스를 보면 gets 함수를 이용해서 str 변수에 사용자 입력을 제한없이 받아 들이는 것을 알 수 있다.
따라서, 이것 역시 Buffer Overflow 공격이 가능하다.
단지 입력 받는 방법이 프로그램 인자가 아니라 stdin 형태로 받아 들이기 때문에 공격방법이 약간 달라질 뿐 공격코드의 내용은 동일하다.
(perl -e 'print "~~공격코드~~"';cat)|./attackme
위와 같은 형태로 만들면 되겠다.'오래된 > HackerSchool' 카테고리의 다른 글
[HackerSchool] Level14 (0) 2011.05.10 [HackerSchool] Level13 (0) 2011.05.10 [HackerSchool] Level11 (0) 2011.04.29 [HackerSchool] Level10 (0) 2011.04.29 [HackerSchool] Level9 (0) 2011.04.28