반응형
#include<stdio.h>

void echo()
{       
        char buf[4]; // small
        gets(buf);
        puts(buf);
}       

int main()
{
        printf("Type a string:");
        echo();
        return 0;
}   

=> gets시 4byte보다 큰 값이 입력되면 버퍼가 넘치게 된다. 따라서 saved ebp, return address에 덮여씌여지게 된다.

만약 abcdef입력시)

728x90
반응형

'공부 > 보안' 카테고리의 다른 글

BOF 원정대 level 16  (0) 2021.05.03
BOF 원정대 level 18  (0) 2021.05.03
Data type, Array operations, Byte ordering  (0) 2021.04.28
MyEtherWallet 해킹사건 분석  (0) 2021.04.18
보안개론 정리(2) - software 취약점  (0) 2021.04.16
블로그 이미지

아상관없어

,