我尝试编写汇编代码并尝试执行/bin/sh
,但它产生了NULL
。
我想保存字符串0x68732f6e
和0x69622f2f
时出错了
global _start
section .text
_start:
xor eax, eax
push edx
mov dword [esp], 4
mov dword [esp+4], 0x68732f6e
mov dword [esp+4], 0x69622f2f
mov edx, 0x20
mov esi, esp
mov edi, ebx
mov eax, 0xb
int 0x80
结果是:
febri@febri-AO725:~/assembly$ strace ./shell
execve("./shell", ["./shell"], [/* 70 vars */]) = 0
execve(NULL, NULL, [/* 0 vars */]) = -1 EFAULT (Bad address)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xfffffff2} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped
febri@febri-AO725:~/assembly$