• SCTF2014_pwn400 writeup


     
    int sub_804874A()
    {
      unsigned __int8 v1; // [sp+1Fh] [bp-9h]@2
     
      write(1, "1.New note
    ", 0xBu);
      write(1, "2.Show notes list
    ", 0x12u);
      write(1, "3.Show note
    ", 0xCu);
      write(1, "4.Edit note
    ", 0xCu);
      write(1, "5.Delete note
    ", 0xEu);
      write(1, "6.Quit
    ", 7u);
      write(1, "option--->> ", 0xCu);
      do
        v1 = getchar();
      while ( v1 == 10 );
      return v1;
    }
    函数作用:
    1.新建一个note。
    2.遍历note。
    3.查看note,会输出note的首地址。
    4.编辑note的content,其中将输入的内容strcopy到content中发生溢出。
    5.删除一个note,双向链表的指针更改时,可以实现DWORD SHOOT。
     
    note结构:
    4字节:指向自己的指针
    4字节:flink
    4字节:blink
    64字节:title
    32字节:type
    256字节:content
     
    delete函数:
    free()成为shellcode跳板
     
    思路:
    要卸载中间note,所以先建立3个note。(其实两个也行,将第一个note的content伪装成note头)
    在建立第三个note时将shellcode写入content。
    布置要卸载的note的头部(自身地址、flink中写入shellcode地址、blink中写入free()got表地址)
     
     
    我将node2的content布置为node头部
    l32(ptr2+108)+l32(ptr3+108)+l32(free_got_addr-4)
     
    ptr2+108  为node2的content起始地址
    ptr3+108  为node3的content起始地址,即是shellcode地址
     
     

    找到GOT表中free()函数指针
    v1+4=free_got_addr
    *(free_got_addr)=shellcode__addr
    v1=free_got_addr-4
     

     

  • 相关阅读:
    HDFS上传/下载数据的过程和原理
    使用JavaAPI获取文件信息
    jquery 最佳实践
    jQuery ajax
    两中复制表结构
    c#基础知识
    类和结构区别
    访问修饰符
    设计模式详细
    设计模式分类
  • 原文地址:https://www.cnblogs.com/fancystar/p/5856558.html
Copyright © 2020-2023  润新知