This is my code:
[BITS 32]
.section text
global start
start:
xor edx, edx ; Avoids NULL byte
push edx ; MsgBox type
push edx ; MsgBox body
push edx ; MsgBox caption
push edx ; Owner hWnd
mov eax, 0x7E45058A ; Addr of MessageBox, USER32 should be loaded
call eax
Now, that should, theoretically, pop up with a blank messagebox. Right?
I assembled it with:
C:\Documents and Settings\Compaq_Owner>nasmw -fbin -l "stuff.txt" "C:\Documents and Settings\Compaq_Owner\Desktop\k.asm"
I popped open a hex editor, grabbed the bytes, threw them into shellcode, and executed this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char shellcode[] =
"\x31\xD2\x52\x52\x52\x52\xB8\x8A\x05\x45\x7E\xFF\xD0";
int main()
{
int *ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
Not working. Could anybody give me a hand?