forked from d4rksystem/VBoxCloak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVBoxCloak.ps1
358 lines (229 loc) · 13.8 KB
/
VBoxCloak.ps1
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#################################################
## VBoxCloak.ps1: A script that attempts to hide the VirtualBox hypervisor from malware by modifying registry keys, killing associated processes, and removing uneeded driver/system files.
## Written and tested on Windows 7 and Windows 10. Should work for Windows 11 as well!
## Many thanks to pafish for some of the ideas - https://github.com/a0rtega/pafish
##################################################
## Author: d4rksystem (Kyle Cucci)
## Version: 0.6
##################################################
# Define command line parameters
param (
[switch]$all = $false,
[switch]$reg = $false,
[switch]$procs = $false,
[switch]$files = $false
)
if ($all) {
$reg = $true
$procs = $true
$files = $true
}
# Menu / Helper stuff
Write-Output "VBoxCloak.ps1 by @d4rksystem (Kyle Cucci)"
Write-Output "Usage: VBoxCloak.ps1 -<option>"
Write-Output "Example Usage: VBoxCloak.ps1 -all"
Write-Output "Options:"
Write-Output "all: Enable all options."
Write-Output "reg: Make registry changes."
Write-Output "procs: Kill processes."
Write-Output "files: Make file system changes."
Write-Output "Tips: Run as Admin or you will get a lot of errors!"
Write-Output "Warning: Only run in a virtual machine!"
Write-Output "*****************************************"
# -------------------------------------------------------------------------------------------------------
# Define random string generator function
function Get-RandomString {
$charSet = "abcdefghijklmnopqrstuvwxyz0123456789".ToCharArray()
for ($i = 0; $i -lt 10; $i++ ) {
$randomString += $charSet | Get-Random
}
return $randomString
}
# -------------------------------------------------------------------------------------------------------
# Stop VBox Processes
$process_list = "VBoxTray", "VBoxService", "VBoxControl"
if ($procs) {
Write-Output "[*] Attempting to kill VMware processes..."
foreach ($p in $process_list) {
$process = Get-Process "$p" -ErrorAction SilentlyContinue
if ($process) {
$process | Stop-Process -Force
Write-Output "[+] $p process killed!"
}
if (!$process) {
Write-Output "[!] $p process does not exist!"
}
}
}
# -------------------------------------------------------------------------------------------------------
# Modify VBox registry keys
if ($reg) {
# Modify system BIOS version
if (Get-ItemProperty -Path "HKLM:\HARDWARE\Description\System" -Name "SystemBiosVersion" -ErrorAction SilentlyContinue) {
Write-Output "[+] Modifying Reg Key HKLM:\HARDWARE\Description\System\SystemBiosVersion..."
Set-ItemProperty -Path "HKLM:\HARDWARE\Description\System" -Name "SystemBiosVersion" -Value $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\HARDWARE\Description\System\SystemBiosVersion does not seem to exist! Skipping this one..."
}
# Modify CurrentControlSet BIOS info
if (Get-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SystemInformation" -ErrorAction SilentlyContinue) {
Write-Output "[+] Modifying Reg Key Values in HKLM:\SYSTEM\CurrentControlSet\Control\SystemInformation..."
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SystemInformation" -Name "BIOSVersion" -Value $(Get-RandomString)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SystemInformation" -Name "BIOSReleaseDate" -Value $(Get-RandomString)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SystemInformation" -Name "BIOSProductName" -Value $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SYSTEM\CurrentControlSet\Control\SystemInformation does not seem to exist! Skipping this one..."
}
# Modify system BIOS date
if (Get-ItemProperty -Path "HKLM:\HARDWARE\Description\System" -Name "SystemBiosDate" -ErrorAction SilentlyContinue) {
Write-Output "[+] Modifying Reg Key HKLM:\HARDWARE\Description\System\SystemBiosDate"
Set-ItemProperty -Path "HKLM:\HARDWARE\Description\System" -Name "SystemBiosDate" -Value $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\HARDWARE\Description\System\SystemBiosDate does not seem to exist! Skipping this one..."
}
# Modify system BIOS Video Version
if (Get-ItemProperty -Path "HKLM:\HARDWARE\Description\System" -Name "VideoBiosVersion" -ErrorAction SilentlyContinue) {
Write-Output "[+] Modifying Reg Key HKLM:\HARDWARE\Description\System\VideoBiosVersion"
Set-ItemProperty -Path "HKLM:\HARDWARE\Description\System" -Name "VideoBiosVersion" -Value $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\HARDWARE\Description\System\VideoBiosVersion does not seem to exist! Skipping this one..."
}
# Rename Guest Additions Reg Key
if (Get-Item -Path "HKLM:\SOFTWARE\Oracle\VirtualBox Guest Additions" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SOFTWARE\Oracle\VirtualBox Guest Additions"
Rename-Item -Path "HKLM:\SOFTWARE\Oracle\VirtualBox Guest Additions" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SOFTWARE\Oracle\VirtualBox Guest Additions does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename ACPI DSDT Reg Key
if (Get-Item -Path "HKLM:\HARDWARE\ACPI\DSDT\VBOX__" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\HARDWARE\ACPI\DSDT\VBOX__"
Rename-Item -Path "HKLM:\HARDWARE\ACPI\DSDT\VBOX__" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\HARDWARE\ACPI\DSDT\VBOX__ does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename ACPI FADT Reg Key
if (Get-Item -Path "HKLM:\HARDWARE\ACPI\FADT\VBOX__" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\HARDWARE\ACPI\FADT\VBOX__"
Rename-Item -Path "HKLM:\HARDWARE\ACPI\FADT\VBOX__" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\HARDWARE\ACPI\FADT\VBOX__ does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename ACPI RSDT Reg Key
if (Get-Item -Path "HKLM:\HARDWARE\ACPI\RSDT\VBOX__" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\HARDWARE\ACPI\RSDT\VBOX__"
Rename-Item -Path "HKLM:\HARDWARE\ACPI\RSDT\VBOX__" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\HARDWARE\ACPI\RSDT\VBOX__ does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBoxMouse Reg Key
if (Get-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxMouse" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxMouse"
Rename-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxMouse" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxMouse does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBoxService Reg Key
if (Get-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxService" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxService"
Rename-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxService" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxService does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBoxSF Reg Key
if (Get-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxSF" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxSF"
Write-Output "[!] Warning: This will disconnect VM shared folders. You will need to reconnect them later..."
Rename-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxSF" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxSF does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBoxVideo Reg Key
if (Get-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxVideo" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxVideo"
Rename-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxVideo" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxVideo does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBoxGuest Reg Key
if (Get-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxGuest" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxGuest"
Rename-Item -Path "HKLM:\SYSTEM\ControlSet001\services\VBoxGuest" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SYSTEM\ControlSet001\services\VBoxGuest does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBoxTray Reg Key
if (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "VBoxTray" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\VBoxTray"
Rename-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "VBoxTray" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\VBoxTray does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBox Uninstaller Reg Key
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oracle VM VirtualBox Guest Additions" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oracle VM VirtualBox Guest Additions"
Rename-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oracle VM VirtualBox Guest Additions" -NewName $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oracle VM VirtualBox Guest Additions does not seem to exist, or has already been renamed! Skipping this one..."
}
# Rename VBox logical unit ID
if (Get-ItemProperty "HKLM:\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0" -Name "Identifier" -ErrorAction SilentlyContinue) {
Write-Output "[+] Renaming Reg Key HKLM:\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"
Set-ItemProperty "HKLM:\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0" -Name "Identifier" -Value $(Get-RandomString)
} Else {
Write-Output "[!] Reg Key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oracle VM VirtualBox Guest Additions does not seem to exist, or has already been renamed! Skipping this one..."
}
}
# -------------------------------------------------------------------------------------------------------
# Rename VBox Files
if ($files) {
# Rename driver files
$file_list = "VBoxMouse.sys", "VBoxSF.sys", "VBoxWddm.sys", "VBoxGuest.sys"
Write-Output "[*] Attempting to rename VirtualBox driver files..."
foreach ($f in $file_list) {
Write-Output "[+] Attempting to rename $f..."
try {
Rename-Item "C:\Windows\System32\drivers\$f" "C:\Windows\System32\drivers\$(Get-RandomString).sys" -ErrorAction Stop
}
catch {
Write-Output "[!] File does not seem to exist! Skipping..."
}
}
# Rename system32 executable files
Write-Output "[*] Attempting to rename System32 VirtualBox executable files..."
$file_list = "VBoxTray.exe", "VBoxControl.exe", "VBoxService.exe", "VBoxMRXNP.dll", "VBoxSVGA.dll", "VBoxHook.dll", "VBoxNine.dll", "VBoxGL.dll", "VBoxDispD3D.dll", "VBoxICD.dll"
foreach ($f in $file_list) {
Write-Output "[+] Attempting to rename $f..."
try {
Rename-Item "C:\Windows\System32\$f" "C:\Windows\System32\$(Get-RandomString).sys" -ErrorAction Stop
}
catch {
Write-Output "[!] File does not seem to exist! Skipping..."
}
}
# Rename SysWOW64 executable files
Write-Output "[*] Attempting to rename SysWOW64 VirtualBox executable files..."
$file_list = "VBoxGL-x86.dll", "VBoxMRXNP.dll", "VBoxDispD3D-x86.dll", "VBoxICD-x86.dll", "VBoxSVGA-x86.dll", "VBoxNine-x86.dll"
foreach ($f in $file_list) {
Write-Output "[+] Attempting to rename $f..."
try {
Rename-Item "C:\Windows\SysWOW64\$f" "C:\Windows\SysWOW64\$(Get-RandomString).sys" -ErrorAction Stop
}
catch {
Write-Output "[!] File does not seem to exist! Skipping..."
}
}
# Rename program directory
Write-Output "[+] Attempting to rename VirtualBox program directory..."
$vboxDir = Get-ChildItem "C:\Program Files\Oracle\VirtualBox*"
# Check for existence of files.
if ($vboxDir) {
Rename-Item "C:\Program Files\Oracle\VirtualBox Guest Additions" "C:\Program Files\Oracle\$(Get-RandomString)" -ErrorAction SilentlyContinue
}
else {
Write-Output "[!] Directory does not appear to exist! Skipping..."
}
}
Write-Output ""
Write-Output "** Done! Did you recieve a lot of errors? You need to run as Admin!"
Write-Output "** Spot any bugs or issues? DM me on Twitter or open an issues on Github! :)"