隐藏控制台窗口

#pragma comment 指令#

1
2
3
4
5
6
7
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")

#include <windows.h>
int main() {
    MessageBoxA(0, "弹窗!", "Test", 0);
    return 0;
} …

Windows添加用户

CMD#

1
2
net user admin 123456 /add
net localgroup Administrators admin /add

Powershell#

1
2
3
$Password = ConvertTo-SecureString "P@ssw0rd123" -AsPlainText -Force
New-LocalUser -Name "admin" -Password $Password -Description …

PE文件结构

PE#

可移植性可执行文件

PE (Portable Executable) 是 Windows 下的可执行文件格式(主要用于.exe, .dll, .sys),主要使用在32位和64位的Windows操作系统。

硬盘上的 .exe 文件          内存中的进程 (Virtual Memory)
+-----------------+        +-----------------+
| DOS Header      |   ->   | DOS Header      | …

Windows API 调用层级

第一层:Standard Library (标准库层)#

例如:C语言中的

1
    FILE* fp = fopen("test.txt", "w"); // 在这里下断点

或者java中的:

1
new FileOutputStream("test.txt");

第二层:Win32 API / Windows Subsystem (子系统层)#

这是微软官方提供给开发者的一套标准接口,通常位于 Kernel32.dll 、 …

APCLocalInjection

 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
#include <windows.h>

int main() {
    //./msfvenom -p windows/x64/messagebox TEXT="Hello" …

CreateThreadInjection

 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
#include <windows.h>

int main() {
    //./msfvenom -p windows/x64/messagebox TEXT="Hello" TITLE="Test" …

LocalProcessInjection

 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
#include "Windows.h"

int main()
{
    //./msfvenom -p windows/x64/messagebox TEXT="Hello" TITLE="Test" -f c

	unsigned …