Creating the smallest possible Windows executable using assembly language
Using nasm, we can build the smallest possible native exe (without using a packer, dropper or anything like that) file that will work on all Windows versions. This is what one of the possible solution binary looks like:
The code for this little cutie:
IMAGEBASE equ 400000h BITS 32 ORG IMAGEBASE ; IMAGE_DOS_HEADER dw "MZ" ; e_magic dw 0 ; e_cblp ; IMAGE_NT_HEADERS - lowest possible start is at 0x4 Signature: dw 'PE',0 ; Signature ; IMAGE_FILE_HEADER dw 0x14c ; Machine = IMAGE_FILE_MACHINE_I386 dw 0 ; NumberOfSections user32.