首页
社区
课程
招聘
[讨论]linux下的一个问题,大家有没有好的思路
发表于: 2017-10-17 16:33 5376

[讨论]linux下的一个问题,大家有没有好的思路

2017-10-17 16:33
5376
   ```
    代码所执行的环境是Linux kalilocal 4.9.0-kali1-amd64 (2017-01-30) x86_64 GNU/Linux
    如果编译命令是gcc test.c -o test ,请你写出可以获取secret 的所有方法
    
    #include <fcntl.h>
    #include <unistd.h>
    #include <stdio.h>
    char secret[10];
    int create_secret(){
        int fd;
        fd = open("secret",O_RDONLY);
        read(fd,secret,10);
        return 0;
    }
    int main(){
        char format[10] = "%s";
        char username[10];
        create_secret();
        scanf(format,username);
        printf(format,username);
        return 0;
    }
    ```

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 27
活跃值: (637)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
2
ssp  leak  和  format  string  vulnerability

话说好像是一个笔试题吧...印象里TX的?
2017-10-20 18:19
0
雪    币: 42
活跃值: (202)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
1.smashing  stack  protector溢出覆盖到栈上保存argv[0]的位置,改为全局变量的地址,实现任意地址读
2.感觉上username应该在format之前,可以溢出到format实现格式化字符串漏洞任意地址读,但是实际编译的时候好像优化把username放到format后面了。
3.........
2018-3-16 12:46
0
游客
登录 | 注册 方可回帖
返回