栈迁移/栈劫持

例子https://github.com/scwuaptx/HITCON-Training/tree/master/LAB/lab6#include <stdio.h>#include <stdlib.h>#include <unistd.h>int count = 1337 ;int main(){ if(count != 13...
摘要由CSDN通过智能技术生成

例子

https://github.com/scwuaptx/HITCON-Training/tree/master/LAB/lab6

 

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int count = 1337 ;
int main(){
    if(count != 1337)
        exit(1);
    count++;
    char buf[40];
    setvbuf(stdout,0,2,0);
    puts("Try your best :");
    read(0,buf,64);
    return 0;   
}
gcc -m32 -z relro -z now -fno-stack-protector -mpreferred-stack-boundary=2 -no-pie a.c -o a

 

之前方法的问题

buf只有40B,但是却read了64B,这里发生了栈溢出

实际测试得到offset=44,所以只有20B可以写exp

ret2text没有对应的函数

ret2shellcode有read函数,bss有写权限,可以read在bss中写入shellcode,然后write返回到bss,但是长度超过了24B

ret2libc:泄露地址什么的可以使用puts泄露地址,c

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值