ShellCode 定位EIP

算是一个总结 看雪文章也有写。这里做个备份。
链接: ShellCode定位EIP

  • 第一种类型方式1:
[SECTION .text]
 
BITS 32
 
global _start
 
_start:
    fldz
    fnstenv [esp-0x0C]
    pop eax
    add al, 0x07
  • 第一种类型方式2
[SECTION .text]
 
BITS 32
 
global _start
 
_start:
    fldz
    fnstenv [esp-0x0C]
    pop eax
    sub eax, -0x07
  • 第二种方式
[SECTION .text]
 
BITS 32
 
global _start
 
_start:
    jmp label2
    label1:
        jmp getEIP
    label2:
        call label1
    getEIP:
        pop eax

64位下使用

  • 1.1
SECTION .text]
 
BITS 64
 
global _start
 
_start:
    fldz
    fnstenv [rsp-0x0C]
    pop rax
    add rax, 0x07
  • 1.2
[SECTION .text]
 
BITS 64
 
global _start
 
_start:
    jmp label2
    label1:
        jmp getEIP
    label2:
        call label1
    getEIP:
        pop rax
  • 1.3
[SECTION .text]
 
BITS 64
 
default rel
 
global _start
 
_start:
    lea rax, [_start]
posted @ 2022-01-04 19:53  iBinary  阅读(284)  评论(0编辑  收藏  举报