从地址中删除不良字符

时间:2019-02-05 23:01:59

标签: assembly x86 nasm shellcode

我从一段时间开始学习shell编码的美丽艺术。我要从我的shellcode中删除所有不良字符,但是要从分配给寄存器的地址中删除这些不良字符有些困难。我有这段代码,只需先调用sys_read然后调用sys_write

section .data

welcome db 'Insert password: ', 0xA
welcomeLen  dq $-welcome
section .bss
input resb 4

section .text
_start:
mov al, 1
mov dil, 1
mov esi, welcome
mov edx, [welcomeLen]
syscall

; read password
xor al, al
xor dil, dil
mov esi, input
mov dl, 4
syscall

我运行了objdump,这是输出:

  401072:       b0 01                   mov    al,0x1
  401074:       40 b7 01                mov    dil,0x1
  401077:       be 00 20 40 00          mov    esi,0x402000
  40107c:       8b 14 25 18 20 40 00    mov    edx,DWORD PTR ds:0x402018
  401083:       0f 05                   syscall 
  401085:       30 c0                   xor    al,al
  401087:       40 30 ff                xor    dil,dil
  40108a:       be 5c 20 40 00          mov    esi,0x40205c
  40108f:       b2 04                   mov    dl,0x4
  401091:       0f 05                   syscall 

您可以看到我仅有的坏字符在以下行中:

mov esi, welcome
mov edx, [welcomeLen]
mov esi, input

您能解释一下如何从那里删除00吗?

0 个答案:

没有答案