zoukankan      html  css  js  c++  java
  • 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
     

     

  • 相关阅读:
    随笔之过账模版
    随笔之转移日记账
    模式窗口的处理方式
    生产领料的问题
    询问对话框,缓存用户设置
    AX2009 连接外部Orcal与SQL区别
    AX2012全新的批处理方式
    AX调用.dll
    AX在query中添加自己的函数
    Java通过代理上传文件到Azure blob
  • 原文地址:https://www.cnblogs.com/fancystar/p/5856558.html
Copyright © 2011-2022 走看看