-
Notifications
You must be signed in to change notification settings - Fork 10
/
anti_sandboxing.yar
554 lines (507 loc) · 16.8 KB
/
anti_sandboxing.yar
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
/* Unprotect Project Yara Rule to detect evasion techniques - Thomas Roccia - @fr0gger */
import "pe"
rule Qemu_Detection
{
meta:
Author = "Thomas Roccia - @fr0gger_ - Unprotect Project"
Description = "Checks for QEMU Registry Key"
strings:
$desc1 = "HARDWARE\\Description\\System" nocase wide ascii
$desc2 = "SystemBiosVersion" nocase wide ascii
$desc3 = "QEMU" wide nocase ascii
$dev1 = "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0" nocase wide ascii
$dev2 = "Identifier" nocase wide ascii
$dev3 = "QEMU" wide nocase ascii
condition:
any of ($desc*) or any of ($dev*)
}
rule VBox_Detection
{
meta:
Author = "Thomas Roccia - @fr0gger_ - Unprotect Project"
Description = "Checks for VBOX Registry Key"
strings:
$desc1 = "HARDWARE\\Description\\System" nocase wide ascii
$desc2 = "SystemBiosVersion" nocase wide ascii
$desc3 = "VideoBiosVersion" nocase wide ascii
$data1 = "VBOX" nocase wide ascii
$data2 = "VIRTUALBOX" nocase wide ascii
$dev1 = "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0" nocase wide ascii
$dev2 = "Identifier" nocase wide ascii
$dev3 = "VBOX" nocase wide ascii
$soft1 = "SOFTWARE\\Oracle\\VirtualBox Guest Additions"
$soft2 = "HARDWARE\\ACPI\\DSDT\\VBOX__"
$soft3 = "HARDWARE\\ACPI\\FADT\\VBOX__"
$soft4 = "HARDWARE\\ACPI\\RSDT\\VBOX__"
$soft5 = "SYSTEM\\ControlSet001\\Services\\VBoxGuest"
$soft6 = "SYSTEM\\ControlSet001\\Services\\VBoxService"
$soft7 = "SYSTEM\\ControlSet001\\Services\\VBoxMouse"
$soft8 = "SYSTEM\\ControlSet001\\Services\\VBoxVideo"
$virtualbox1 = "VBoxHook.dll" nocase
$virtualbox2 = "VBoxService" nocase
$virtualbox3 = "VBoxTray" nocase
$virtualbox4 = "VBoxMouse" nocase
$virtualbox5 = "VBoxGuest" nocase
$virtualbox6 = "VBoxSF" nocase
$virtualbox7 = "VBoxGuestAdditions" nocase
$virtualbox8 = "VBOX HARDDISK" nocase
$virtualbox9 = "VBoxVideo" nocase
$virtualbox10 = "vboxhook" nocase
$virtualbox11 = "vboxmrxnp" nocase
$virtualbox12 = "vboxogl" nocase
$virtualbox13 = "vboxoglarrayspu" nocase
$virtualbox14 = "vboxoglcrutil"
$virtualbox15 = "vboxoglerrorspu" nocase
$virtualbox16 = "vboxoglfeedbackspu" nocase
$virtualbox17 = "vboxoglpackspu" nocase
$virtualbox18 = "vboxoglpassthroughspu" nocase
$virtualbox19 = "vboxcontrol" nocase
// VirtualBox Mac Address
$virtualbox_mac_1a = "08-00-27"
$virtualbox_mac_1b = "08:00:27"
$virtualbox_mac_1c = "080027"
condition:
any of ($desc*) and
1 of ($data*) or
any of ($dev*) or
any of ($soft*) or
any of ($virtualbox*)
}
rule VMWare_Detection
{
meta:
Author = "Thomas Roccia - @fr0gger_ - Unprotect Project"
Description = "Checks for VMWARE Registry Key"
strings:
$dev1 = "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0" wide ascii nocase
$dev2 = "Identifier" wide nocase ascii
$dev3 = "VMware" wide nocase ascii
$soft ="SOFTWARE\\VMware, Inc.\\VMware Tools" nocase ascii wide
// Random strings related to Vmware
$vmware = {56 4D 58 68}
$vmware1 = "VMXh"
$vmware2 = "Ven_VMware_" nocase
$vmware3 = "Prod_VMware_Virtual_" nocase
$vmware4 = "hgfs.sys" nocase
$vmware5 = "vmhgfs.sys" nocase
$vmware6 = "prleth.sys" nocase
$vmware7 = "prlfs.sys" nocase
$vmware8 = "prlmouse.sys" nocase
$vmware9 = "prlvideo.sys" nocase
$vmware10 = "prl_pv32.sys" nocase
$vmware11 = "vpc-s3.sys" nocase
$vmware12 = "vmsrvc.sys" nocase
$vmware13 = "vmx86.sys" nocase
$vmware14 = "vmnet.sys" nocase
$vmware15 = "vmicheartbeat" nocase
$vmware16 = "vmicvss" nocase
$vmware17 = "vmicshutdown" nocase
$vmware18 = "vmicexchange" nocase
$vmware19 = "vmdebug" nocase
$vmware20 = "vmmouse" nocase
$vmware21 = "vmtools" nocase
$vmware22 = "VMMEMCTL" nocase
$vmware23 = "vmx86" nocase
$vmware24 = "vmware" nocase
$vmware25 = "vmware.exe" nocase
$vmware26 = "vmware-authd.exe" nocase
$vmware27 = "vmware-hostd.exe" nocase
$vmware28 = "vmware-tray.exe" nocase
$vmware29 = "vmware-vmx.exe" nocase
$vmware30 = "vmnetdhcp.exe" nocase
$vmware31 = "vpxclient.exe" nocase
$vmware32 = { b868584d56bb00000000b90a000000ba58560000ed }
$vmware34 = "VMware Virtual IDE Hard Drive" ascii wide
$vmware35 = "VMwareService.exe" nocase
$vmware36 = "Vmwaretray.exe" nocase
$vmware37 = "TPAutoConnSvc.exe" nocase
$vmware38 = "Vmwareuser.exe" nocase
// Vmware Mac Address
$vmware_mac_1a = "00-05-69"
$vmware_mac_1b = "00:05:69"
$vmware_mac_1c = "000569"
$vmware_mac_2a = "00-50-56"
$vmware_mac_2b = "00:50:56"
$vmware_mac_2c = "005056"
$vmware_mac_3a = "00-0C-29" nocase
$vmware_mac_3b = "00:0C:29" nocase
$vmware_mac_3c = "000C29" nocase
$vmware_mac_4a = "00-1C-14" nocase
$vmware_mac_4b = "00:1C:14" nocase
$vmware_mac_4c = "001C14" nocase
condition:
any of ($dev*) or $soft or
any of ($vmware*)
}
rule VM_Detect_VirtualPC_XEN_Wine
{
meta:
author = "Thomas Roccia - @fr0gger_ - Unprotect Project"
description = "Xen detection, VirtualPC, Red Pill, Wine and other"
strings:
// Binary tricks
$virtualpc = {0F 3F 07 0B}
$ssexy = {66 0F 70 ?? ?? 66 0F DB ?? ?? ?? ?? ?? 66 0F DB ?? ?? ?? ?? ?? 66 0F EF}
$vmcheckdll = {45 C7 00 01}
$redpill = {0F 01 0D 00 00 00 00 C3}
$virtualpc1 = "vpcbus" nocase
$virtualpc2 = "vpc-s3" nocase
$virtualpc3 = "vpcuhub" nocase
$virtualpc4 = "msvmmouf" nocase
$xen1 = "xenevtchn" nocase
$xen2 = "xennet" nocase
$xen3 = "xennet6" nocase
$xen4 = "xensvc" nocase
$xen5 = "xenvdb" nocase
$xen6 = "XenVMM" nocase
$xen7 = "xenservice.exe" nocase
$wine1 = "wine_get_unix_file_name" ascii wide
condition:
any of them
}
rule VM_Detect_Username_Filepath_DriveSize
{
meta:
Author = "Thomas Roccia - @fr0gger_ - Unprotect Project"
Description = "Check filepaths and drive size and Sandbox usernames"
strings:
// Filepaths
$path1 = "SANDBOX" wide ascii
$path2 = "\\SAMPLE" wide ascii
$path3 = "\\VIRUS" wide ascii
// Drive Size
$physicaldrive = "\\\\.\\PhysicalDrive0" wide ascii nocase
$dwIoControlCode = {68 5c 40 07 00 [0-5] FF 15} //push 7405ch ; push esi (handle) then call deviceoiocontrol IOCTL_DISK_GET_LENGTH_INFO
// Sandbox usernames
$user1 = "MALTEST" wide ascii
$user2 = "TEQUILABOOMBOOM" wide ascii
$user3 = "SANDBOX" wide ascii
$user4 = "VIRUS" wide ascii
$user5 = "MALWARE" wide ascii
condition:
all of ($path*) and pe.imports("kernel32.dll","GetModuleFileNameA") or
pe.imports("kernel32.dll","CreateFileA") and
pe.imports("kernel32.dll","DeviceIoControl") and
$dwIoControlCode and $physicaldrive or
all of ($user*) and pe.imports("advapi32.dll","GetUserNameA")
}
rule Anti_Automated_Sandbox
{
meta:
Author = "Thomas Roccia - @fr0gger_ - Unprotect Project"
Description = "Check JoeSandbox, Anubis, Threat Expert, Sandboxie, Cwsandbox"
strings:
// joe sandbox
$joe1 = "Software\\Microsoft\\Windows\\CurrentVersion" nocase
$joe2 = "RegQueryValue"
$joe3 = "55274-640-2673064-23950"
// anubis
$p1 = "Software\\Microsoft\\Windows\\CurrentVersion" nocase
$c1 = "RegQueryValue"
$s1 = "76487-337-8429955-22614"
$s2 = "76487-640-1457236-23837"
// threat expert
$f1 = "dbghelp.dll" nocase
// sandboxie
$f2 = "SbieDLL.dll" nocase
// cwsandbox
$var1 = "Software\\Microsoft\\Windows\\CurrentVersion" nocase
$var2 = "76487-644-3177037-23510"
condition:
any of ($joe*) or
$p1 and $c1 and 1 of ($s*) or
1 of ($f*) or
all of ($var*)
}
rule antisb_joesanbox {
meta:
author = "x0r"
description = "Anti-Sandbox checks for Joe Sandbox"
version = "0.1"
strings:
$p1 = "Software\\Microsoft\\Windows\\CurrentVersion" nocase
$c1 = "RegQueryValue"
$s1 = "55274-640-2673064-23950"
condition:
all of them
}
rule antisb_anubis {
meta:
author = "x0r"
description = "Anti-Sandbox checks for Anubis"
version = "0.1"
strings:
$p1 = "Software\\Microsoft\\Windows\\CurrentVersion" nocase
$c1 = "RegQueryValue"
$s1 = "76487-337-8429955-22614"
$s2 = "76487-640-1457236-23837"
condition:
$p1 and $c1 and 1 of ($s*)
}
rule antisb_threatExpert {
meta:
author = "x0r"
description = "Anti-Sandbox checks for ThreatExpert"
version = "0.1"
strings:
$f1 = "dbghelp.dll" nocase
condition:
all of them
}
rule antisb_sandboxie {
meta:
author = "x0r"
description = "Anti-Sandbox checks for Sandboxie"
version = "0.1"
strings:
$f1 = "SbieDLL.dll" nocase
condition:
all of them
}
rule antisb_cwsandbox {
meta:
author = "x0r"
description = "Anti-Sandbox checks for CWSandbox"
version = "0.1"
strings:
$p1 = "Software\\Microsoft\\Windows\\CurrentVersion" nocase
$s1 = "76487-644-3177037-23510"
condition:
all of them
}
rule antivm_vmware {
meta:
author = "x0r"
description = "AntiVM checks for VMWare"
version = "0.1"
strings:
$s1 = "vmware.exe" nocase
$s2 = "vmware-authd.exe" nocase
$s3 = "vmware-hostd.exe" nocase
$s4 = "vmware-tray.exe" nocase
$s5 = "vmware-vmx.exe" nocase
$s6 = "vmnetdhcp.exe" nocase
$s7 = "vpxclient.exe" nocase
$s8 = { b868584d56bb00000000b90a000000ba58560000ed }
condition:
any of them
}
rule antivm_bios {
meta:
author = "x0r"
description = "AntiVM checks for Bios version"
version = "0.2"
strings:
$p1 = "HARDWARE\\DESCRIPTION\\System" nocase
$p2 = "HARDWARE\\DESCRIPTION\\System\\BIOS" nocase
$c1 = "RegQueryValue"
$r1 = "SystemBiosVersion"
$r2 = "VideoBiosVersion"
$r3 = "SystemManufacturer"
condition:
1 of ($p*) and 1 of ($c*) and 1 of ($r*)
}
rule Check_DriveSize
{
meta:
Author = "Nick Hoffman"
Description = "Rule tries to catch uses of DeviceIOControl being used to get the drive size"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$physicaldrive = "\\\\.\\PhysicalDrive0" wide ascii nocase
$dwIoControlCode = {68 5c 40 07 00 [0-5] FF 15} //push 7405ch ; push esi (handle) then call deviceoiocontrol IOCTL_DISK_GET_LENGTH_INFO
condition:
pe.imports("kernel32.dll","CreateFileA") and
pe.imports("kernel32.dll","DeviceIoControl") and
$dwIoControlCode and
$physicaldrive
}
rule Check_FilePaths
{
meta:
Author = "Nick Hoffman"
Description = "Checks for filepaths containing popular sandbox names"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$path1 = "SANDBOX" wide ascii
$path2 = "\\SAMPLE" wide ascii
$path3 = "\\VIRUS" wide ascii
condition:
all of ($path*) and pe.imports("kernel32.dll","GetModuleFileNameA")
}
rule Check_UserNames
{
meta:
Author = "Nick Hoffman"
Description = "Looks for malware checking for common sandbox usernames"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$user1 = "MALTEST" wide ascii
$user2 = "TEQUILABOOMBOOM" wide ascii
$user3 = "SANDBOX" wide ascii
$user4 = "VIRUS" wide ascii
$user5 = "MALWARE" wide ascii
condition:
all of ($user*) and pe.imports("advapi32.dll","GetUserNameA")
}
rule Check_Dlls
{
meta:
Author = "Nick Hoffman"
Description = "Checks for common sandbox dlls"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$dll1 = "sbiedll.dll" wide nocase ascii fullword
$dll2 = "dbghelp.dll" wide nocase ascii fullword
$dll3 = "api_log.dll" wide nocase ascii fullword
$dll4 = "dir_watch.dll" wide nocase ascii fullword
$dll5 = "pstorec.dll" wide nocase ascii fullword
$dll6 = "vmcheck.dll" wide nocase ascii fullword
$dll7 = "wpespy.dll" wide nocase ascii fullword
condition:
2 of them
}
rule Check_VBox_DeviceMap
{
meta:
Author = "Nick Hoffman"
Description = "Checks Vbox registry keys"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$key = "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0" nocase wide ascii
$value = "Identifier" nocase wide ascii
$data = "VBOX" nocase wide ascii
condition:
all of them
}
rule Check_VBox_VideoDrivers
{
meta:
Author = "Nick Hoffman"
Description = "Checks for reg keys of Vbox video drivers"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$key = "HARDWARE\\Description\\System" nocase wide ascii
$value = "VideoBiosVersion" wide nocase ascii
$data = "VIRTUALBOX" nocase wide ascii
condition:
all of them
}
rule Check_VmTools
{
meta:
Author = "Nick Hoffman"
Description = "Checks for the existence of VmTools reg key"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$ ="SOFTWARE\\VMware, Inc.\\VMware Tools" nocase ascii wide
condition:
any of them
}
rule Check_Wine
{
meta:
Author = "Nick Hoffman"
Description = "Checks for the existence of Wine"
Sample = "de1af0e97e94859d372be7fcf3a5daa5"
strings:
$ ="wine_get_unix_file_name"
condition:
any of them
}
rule vmdetect
{
meta:
author = "nex"
description = "Possibly employs anti-virtualization techniques"
strings:
// Binary tricks
$vmware = {56 4D 58 68}
$virtualpc = {0F 3F 07 0B}
$ssexy = {66 0F 70 ?? ?? 66 0F DB ?? ?? ?? ?? ?? 66 0F DB ?? ?? ?? ?? ?? 66 0F EF}
$vmcheckdll = {45 C7 00 01}
$redpill = {0F 01 0D 00 00 00 00 C3}
// Random strings
$vmware1 = "VMXh"
$vmware2 = "Ven_VMware_" nocase
$vmware3 = "Prod_VMware_Virtual_" nocase
$vmware4 = "hgfs.sys" nocase
$vmware5 = "mhgfs.sys" nocase
$vmware6 = "prleth.sys" nocase
$vmware7 = "prlfs.sys" nocase
$vmware8 = "prlmouse.sys" nocase
$vmware9 = "prlvideo.sys" nocase
$vmware10 = "prl_pv32.sys" nocase
$vmware11 = "vpc-s3.sys" nocase
$vmware12 = "vmsrvc.sys" nocase
$vmware13 = "vmx86.sys" nocase
$vmware14 = "vmnet.sys" nocase
$vmware15 = "vmicheartbeat" nocase
$vmware16 = "vmicvss" nocase
$vmware17 = "vmicshutdown" nocase
$vmware18 = "vmicexchange" nocase
$vmware19 = "vmdebug" nocase
$vmware20 = "vmmouse" nocase
$vmware21 = "vmtools" nocase
$vmware22 = "VMMEMCTL" nocase
$vmware23 = "vmx86" nocase
$vmware24 = "vmware" nocase
$virtualpc1 = "vpcbus" nocase
$virtualpc2 = "vpc-s3" nocase
$virtualpc3 = "vpcuhub" nocase
$virtualpc4 = "msvmmouf" nocase
$xen1 = "xenevtchn" nocase
$xen2 = "xennet" nocase
$xen3 = "xennet6" nocase
$xen4 = "xensvc" nocase
$xen5 = "xenvdb" nocase
$xen6 = "XenVMM" nocase
$virtualbox1 = "VBoxHook.dll" nocase
$virtualbox2 = "VBoxService" nocase
$virtualbox3 = "VBoxTray" nocase
$virtualbox4 = "VBoxMouse" nocase
$virtualbox5 = "VBoxGuest" nocase
$virtualbox6 = "VBoxSF" nocase
$virtualbox7 = "VBoxGuestAdditions" nocase
$virtualbox8 = "VBOX HARDDISK" nocase
// MAC addresses
$vmware_mac_1a = "00-05-69"
$vmware_mac_1b = "00:05:69"
$vmware_mac_1c = "000569"
$vmware_mac_2a = "00-50-56"
$vmware_mac_2b = "00:50:56"
$vmware_mac_2c = "005056"
$vmware_mac_3a = "00-0C-29" nocase
$vmware_mac_3b = "00:0C:29" nocase
$vmware_mac_3c = "000C29" nocase
$vmware_mac_4a = "00-1C-14" nocase
$vmware_mac_4b = "00:1C:14" nocase
$vmware_mac_4c = "001C14" nocase
$virtualbox_mac_1a = "08-00-27"
$virtualbox_mac_1b = "08:00:27"
$virtualbox_mac_1c = "080027"
condition:
any of them
}
rule WMI_VM_Detect : WMI_VM_Detect
{
meta:
version = 2
threat = "Using WMI to detect virtual machines via querying video card information"
behaviour_class = "Evasion"
author = "Joe Giron"
date = "2015-09-25"
description = "Detection of Virtual Appliances through the use of WMI for use of evasion."
strings:
$selstr = "SELECT Description FROM Win32_VideoController" nocase ascii wide
$selstr2 = "SELECT * FROM Win32_VideoController" nocase ascii wide
$vm1 = "virtualbox graphics adapter" nocase ascii wide
$vm2 = "vmware svga ii" nocase ascii wide
$vm3 = "vm additions s3 trio32/64" nocase ascii wide
$vm4 = "parallel" nocase ascii wide
$vm5 = "remotefx" nocase ascii wide
$vm6 = "cirrus logic" nocase ascii wide
$vm7 = "matrox" nocase ascii wide
condition:
any of ($selstr*) and any of ($vm*)
}