【发布时间】:2014-12-02 08:32:46
【问题描述】:
我有以下汇编代码可以从 Erickson 的漏洞利用书中生成一个 shell:
; execve(const char *filename, char *const argv [], char *const envp[])
xor eax, eax ; Zero out eax.
push eax ; Push some nulls for string termination.
push 0x68732f2f ; Push "//sh" to the stack.
push 0x6e69622f ; Push "/bin" to the stack.
mov ebx, esp ; Put the address of "/bin//sh" into ebx, via esp.
push eax ; Push 32-bit null terminator to stack.
mov edx, esp ; This is an empty array for envp.
push ebx ; Push string addr to stack above null terminator.
mov ecx, esp ; This is the argv array with string ptr.
mov al, 11 ; Syscall #11.
int 0x80 ; Do it.
但是,我的 linux 机器没有 nasm,要获得它需要我让管理员下载软件包。还有其他方法可以将其转换为十六进制吗?我知道 GCC 使用 AT&T,但我不知道任何支持 Intel x86 的方法。
【问题讨论】:
-
请参阅stackoverflow.com/questions/9347909/… 如果这不起作用,并且您觉得让您的管理员让您下载 nasm 太麻烦,您可以用 AT&T 语法重写代码。
-
原谅我的 Linux foo,但那会是 gcc assem.s -masm=intel objFileToGetHexed.o 吗?我正在运行 .o 文件的 No such 文件或目录,这对我来说没有意义......
-
不,我相信您会在源文件中添加它。
-
你不能安装
nasm,也许是从源代码编译它并安装在你的私有目录中(例如你的$HOME/bin/)??