码迷,mamicode.com
首页 > 其他好文 > 详细

pwnable小结

时间:2017-12-09 13:02:31      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:src   这一   images   learn   cat   font   分享图片   env   http   

这一会闲着没啥事,就把之前做的pwnable上面的题来总结下吧。

0x01 fd:

源码:

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <string.h>
 4 char buf[32];
 5 int main(int argc, char* argv[], char* envp[]){
 6     if(argc<2){
 7         printf("pass argv[1] a number\n");
 8         return 0;
 9     }
10     int fd = atoi( argv[1] ) - 0x1234;
11     int len = 0;
12     len = read(fd, buf, 32);
13     if(!strcmp("LETMEWIN\n", buf)){
14         printf("good job :)\n");
15         system("/bin/cat flag");
16         exit(0);
17     }
18     printf("learn about Linux file IO\n");
19     return 0;
20 
21 }

让read变成标准输入(使fd变成0),然后输入LETMEWIN字符串。

技术分享图片

 

pwnable小结

标签:src   这一   images   learn   cat   font   分享图片   env   http   

原文地址:http://www.cnblogs.com/Yable/p/8011000.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!