我在教程中发现了以下装配线,但我不明白:
xor eax, eax => clear, I know that, it makes eax = 0
push eax => push 0 on the stack
push 0x68732f2f => push "//sh" to the stack (the numbers are opcodes I guess, output of hexdump)
push 0x6e69622f => push "/bin" to the stack (again opcodes, representing "/bin" )
mov ebx, esp => put address of "/bin//sh\0" into ebx, via esp
....
我的问题: 为什么我们通过 esp 使用 mov ebx, esp 行将“/bin//sh”的地址放入 ebx 中?
我画个草图:
| |
|------------------------|<-----ESP (I know that ESP always points to the top)
(a) | 0x6e69622f ("//sh") |
|------------------------|
(b) | 0x68732f2f ("/bin") |
|------------------------|
(c) | 0 |
|------------------------|
我如何尝试向自己解释(我不确定它是否正确,但我想在我在这里的论坛上提问之前想了一下):
ESP 是一个 32 位寄存器,因此它足够大以包含 (a)、(b) 和 (c)(我在上面标记的)处的地址。
是对的吗?我希望有人可以帮助我?
最好的祝福,