【发布时间】:2014-10-21 22:33:00
【问题描述】:
我是 StackOverflow 的新手。最近,我开始学习汇编,对汇编还很陌生,对 shellcode 完全陌生。我正在使用 RadAsm 使用 MASM 汇编器进行编译,我尝试从这个网站上学习 shellcode Shellcoding for Linux and Windows
我在 64 位 Windows 上使用 RadAsm。我使用的代码几乎相同,只是我使用函数的绝对名称而不是DLL中的函数地址。 shellcode应该使用参数5000的sleep函数。
这是我在 MASM 中使用的代码。
.386
.model flat, stdcall
option casemap:none
include kernel32.inc
includelib kernel32.lib
.code
_start:
xor eax, eax ; zero out eax
mov ebx, Sleep ; function sleep goes in ebx
mov ax, 5000 ; parameter goes in ax
push eax ; parameter on stack
call ebx ; call Sleep
end _start
end
这在 MASM 中没有错误组装。
生成的shellcode为空值,与网站略有不同。如下。
我使用objdump -d nameofexecutable.exe 进行反汇编。
Disassembly of section .text
00401000 <.text>:
401000: 33 c0 xor %eax,%eax
401002: bb 0e 10 40 00 mov $0x40100e,%
401007: 66 b8 88 13 mov $0x1388,%ax
40100b: 50 push %eax
40100c: ff d3 call *%ebx
40100e: ff 25 00 20 40 00 jmp *0x402000
但在网站中,没有00 十六进制代码。
Disassembly of section .text:
08048080 <_start>:
8048080: 31 c0 xor %eax,%eax
8048082: bb ea 1b e6 77 mov $0x77e61bea,%ebx
8048087: 66 b8 88 13 mov $0x1388,%ax
804808b: 50 push %eax
804808c: ff d3 call *%ebx
可能是我使用x64编译还是间接调用了函数?
任何帮助将不胜感激,谢谢。
【问题讨论】:
-
也有可能是MASM/NASM版本不同。
标签: assembly nasm masm shellcode