zoukankan      html  css  js  c++  java
  • pwnable.kr-bof-Writeup

    MarkdownPad Document

    pwnable.kr-bof-Writeup

    http://pwnable.kr/bin/bof.c得到C代码如下:

     1 #include <stdio.h>
     2 #include <string.h>
     3 #include <stdlib.h>
     4 void func(int key){
     5     char overflowme[32];
     6     printf("overflow me : ");
     7     gets(overflowme);    // smash me!
     8     if(key == 0xcafebabe){
     9         system("/bin/sh");
    10     }
    11     else{
    12         printf("Nah..
    ");
    13     }
    14 }
    15 int main(int argc, char* argv[]){
    16     func(0xdeadbeef);
    17     return 0;
    18 }

    http://pwnable.kr/bin/bof下载文件bof,die查壳如下,无壳,为elf文件

    由题目中的提示Nana told me that buffer overflow is one of the most common software vulnerability. Is that true?可知此题的漏洞为缓冲区溢出,分析C代码:

    • 直接把bof拖到IDA中,通过查找关键字符串跳转到关键函数func:
    • 双击a1与s查看地址如下,则二者的地址相差+0x00000008 - (-0x0000002C) = 0x34 = 52

    • 因为0xCAFEBABE(即IDA中的-889275714)为小端存储,则可以在get(&s)处可构造输入 '0'*52+0xBE0xBA0xFE0xCA,在Linux中检验,可以得到flag为:daddy, I just pwned a buFFer :)

    构造输入时需要注意用 cat - 维持shell;

    2017-2-7 19:52;05

  • 相关阅读:
    在Ubuntu下安装TensorFlow-gpu版本
    ubuntu安装和卸载软件命令
    Window7通过Anaconda安装Tensorflow
    Kaggle Titanic Data Science Solutions
    CNN、RNN和DNN的区别
    卷积神经网络介绍
    大数据随想
    golang omitempty 总结
    LeetCode 856 递归思路详解
    安装Nginx的各种报错的解决
  • 原文地址:https://www.cnblogs.com/WangAoBo/p/6375758.html
Copyright © 2011-2022 走看看