EIP 등에 대한 설명이 이루어져 있다.
gets 함수 다음 다른 구문이 없는 것으로 보아, RET 주소를 변조하여 win 함수를 실행시켜야 할 것 같다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <string.h> void win() { printf("code flow successfully changed\n"); } int main(int argc, char **argv) { char buffer[64]; gets(buffer); } | cs |
Segmentation fault가 발생하지 않는 입력값을 찾아다녔다. A 72개에서는 정상적으로 처리된다.
우선 win 함수의 주소가 필요하니, objdump 명령어를 이용해 win 함수의 주소를 획득하자.
A 76개를 넣은 후 win 함수의 주소를 little endian 방식으로 넣어야 win 함수로 흐름이 변경된다.
EIP와 ESP의 offset 차이가 76인 모양이다.
'[Wargame Write-up] > Exploit-Exercises' 카테고리의 다른 글
[Exploit-Exercises] [Protostar] Stack 3 (0) | 2018.01.04 |
---|---|
[Exploit-Exercises] [Protostar] Stack 2 (0) | 2018.01.04 |
[Exploit-Exercises] [Protostar] Stack 1 (0) | 2018.01.03 |
[Exploit-Exercises] [Protostar] Stack 0 (0) | 2018.01.03 |
[Exploit-Exercises] [Nebula] Level 09 (0) | 2017.11.19 |