이번에 풀어볼 문제는 Protostar 2번 문제이다.
문제는 아래의 사이트에서 확인할 수 있다.
old.liveoverflow.com/binary_hacking/protostar/format2.html
Format 2 - LiveOverflow
Solving format1 from exploit-exercises.com with a simple Format String vulnerability, exploited with %n.
old.liveoverflow.com
1. 문제 확인
if(target == 64) { printf("you have modified the target :)\n");
이 부분에 주목을 하면 target을 64로 바꿔주어야 한다는 것을 확인할 수 있다.
이렇게 AAAA %08x %08x %08x %08x를 넣어주었더니
target is 0 :( 이렇게 나온다.
objdump -t 명령어를 사용한다.
이것은 target의 주소를 알아낼 때 사용하는 것이다.
target의 주소는 0x080496e4로 나온다.
즉, 페이로드는 4byte + target주소 + %08x%08x%08x%32c%n이 된다.
결국, target의 주소에 64가 저장되어
원하는 출력 값인 "you have modified the targe :)"이 나올 것이다.
'security > 시스템' 카테고리의 다른 글
Protostar - Fromat 4 (0) | 2020.11.05 |
---|---|
Protostar - Format 3 (0) | 2020.11.05 |
Protostar - Format 0 (0) | 2020.11.03 |
Protostar - Stack2 (0) | 2020.09.22 |
Protostar - Stack1 (0) | 2020.09.22 |
댓글