ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • format2
    Exploit-Exercise 2016. 8. 18. 00:25
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    #include <stdlib.h>
    #include <unistd.h>
    #include <stdio.h>
    #include <string.h>
     
    int target;
     
    void vuln()
    {
      char buffer[512];
     
      fgets(buffer, sizeof(buffer), stdin);
      printf(buffer);
      
      if(target == 64) {
          printf("you have modified the target :)\n");
      } else {
          printf("target is %d :(\n", target);
      }
    }
     
    int main(int argc, char **argv)
    {
      vuln();
    }
    cs



    입력값받고, 간단하게 전역변수인 target을 64로 바꾸면되는문제다.




    값이 바뀌는건 7번쨰부터니 %7$n으로 맞춰주면되겠고, 전에 출력한 문자열을 더해서 64를 만들어주면되겠다.





    'Exploit-Exercise' 카테고리의 다른 글

    format4  (0) 2016.08.18
    format3  (0) 2016.08.18
    format1  (0) 2016.08.18
    Fusion Level 1  (0) 2016.07.12
    format0  (0) 2015.12.08

    댓글

Designed by Tistory.