I am new to StackOverflow. Recently, I began studying assembly and am fairly new to assembly, completely new to shellcode. I am using RadAsm to compile using MASM assembler and I tried studying shellcode from this website Shellcoding for Linux and Windows
I am using RadAsm on Windows 64-bit. The code I used is almost the same, except that I use the absolute name of the function rather than the address of the function in the DLL. The shellcode is supposed to use the sleep function with the parameter 5000
.
This is the code that I am using in 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
This assembles with no errors in MASM.
The shellcode generated has null values and is slightly different from the website. It is as follows.
I used objdump -d nameofexecutable.exe
to get the disassembly.
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
But in the website, there are no 00
hex codes.
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
Could it be because I am using x64 to compile or because I am calling the function indirectly?
Any help would be appreciated, thank you.