ii4gsp
Exploit Exercises [Protostar - Stack0] 본문
시스템 해킹/Exploit Exercises - Protostar
Exploit Exercises [Protostar - Stack0]
ii4gsp 2020. 1. 16. 19:48#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
volatile int modified;
char buffer[64];
modified = 0;
gets(buffer);
if(modified != 0) {
printf("you have changed the 'modified' variable\n");
} else {
printf("Try again?\n");
}
}
modified 변수가 buffer보다 먼저 선언 되었으니 스택의 구조
if(modified != 0) 조건에서 modified는 0이므로 "Try again?"이라는 문자가 출력된다.
하지만 buffer변수 64byte를 넘어 "A" 65개의 값을 준다면 버퍼가 넘쳐 modified는 "A" 기계어 0x41로 인식되어
"you have changed the 'modified' variable" 문자가 출력될것 이다.
(python -c 'print "A" * 65';cat) | ./stack0
'시스템 해킹 > Exploit Exercises - Protostar' 카테고리의 다른 글
Exploit Exercises [Protostar - Stack5] (0) | 2020.01.16 |
---|---|
Exploit Exercises [Protostar - Stack4] (0) | 2020.01.16 |
Exploit Exercises [Protostar - Stack3] (2) | 2020.01.16 |
Exploit Exercises [Protostar - Stack2] (0) | 2020.01.16 |
Exploit Exercises [Protostar - Stack1] (0) | 2020.01.16 |
Comments