-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunsupported_capa_rules.yml
3949 lines (3793 loc) · 149 KB
/
unsupported_capa_rules.yml
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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
rule:
meta:
name: contain pusha popa sequence
author: [email protected]
lib: true
scope: function
examples:
- a5c70086b3bc4fe64f4e7a0aa452e620:0x35007200
features:
- and:
- or:
- count(mnemonic(pusha)): 2 or more
# vivisect
- count(mnemonic(pushad)): 2 or more
- or:
- count(mnemonic(popa)): 2 or more
# vivisect
- count(mnemonic(popad)): 2 or more
Reason: Range (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/contain-pusha-popa-sequence.yml
----------------------------------------------
rule:
meta:
name: validate payment card number using luhn algorithm with no lookup table
author: "@_re_fox"
lib: true
scope: function
mbc:
- Data::Checksum::Luhn [C0032.002]
examples:
- 6fcc13563aad936c7d0f3165351cb453:0x4026C0
features:
- and:
- characteristic: loop
description: Iterate over CC digits
- or:
- basic block:
- and:
- or:
- mnemonic: add
- and:
- mnemonic: shl
- number: 0x1
- and:
- mnemonic: imul
- number: 0x2
- mnemonic: cmp
- number: 0x9
- description: Digital Root check number*2 < 0x9
- and:
- basic block:
- and:
- mnemonic: cmp
- number: 0x9
- description: Compare number to 0x9 for Digital Root
- basic block:
- or:
- mnemonic: add
- and:
- mnemonic: imul
- number: 0x2
- and:
- mnemonic: shl
- number: 0x1
- description: 2*Number for Digital Root
- basic block:
- or:
- and:
- number: 0x30
- mnemonic: sub
- description: Conversion of chr to int (SUB 0x30)
- and:
- mnemonic: lea
- offset: -0x30
- description: Conversion of chr to int (LEA REG,[REG+ -0x30])
- basic block:
- or:
- and:
- or:
- mnemonic: div
- and:
- mnemonic: idiv
- mnemonic: cdq
- number: 0xa
- optional:
- mnemonic: neg
- description: Final section returning checkum % 10
- and:
- mnemonic: shr
- mnemonic: imul
- number: 0x66666667
- number: 0x1f
- number: 0x2
- optional:
- mnemonic: neg
- description: Compiler optimized returning checkum % 10
Reason: characteristic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/validate-payment-card-number-using-luhn-algorithm-with-no-lookup-table.yml
----------------------------------------------
rule:
meta:
name: contain loop
author: [email protected]
lib: true
scope: function
examples:
- 08AC667C65D36D6542917655571E61C8:0x406EAA
features:
- or:
- characteristic: loop
- characteristic: tight loop
- characteristic: recursive call
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "characteristic" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/contain-loop.yml
----------------------------------------------
rule:
meta:
name: calculate modulo 256 via x86 assembly
author: [email protected]
lib: true
scope: basic block
mbc:
- Data::Modulo [C0058]
examples:
- 9324D1A8AE37A36AE560C37448C9705A:0x4049A9
features:
# and ecx, 800000FFh
# and ecx, 0FFh
- and:
- mnemonic: and
- or:
- number: 0x800000FF
- number: 0xFF
Reason: mnemonic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/calculate-modulo-256-via-x86-assembly.yml
----------------------------------------------
rule:
meta:
name: validate payment card number using luhn algorithm with lookup table
author: "@_re_fox"
lib: true
scope: function
mbc:
- Data::Checksum::Luhn [C0032.002]
examples:
- 1d8fd13c890060464019c0f07b928b1a:0x401920
- 60abaef3fda131ffa20df480cb3f8029:0x4048e0
features:
- and:
- not:
- characteristic: nzxor
- characteristic: loop
description: Iterate over CC digits
- basic block:
- or:
- 8 or more:
- description: Digital root lookup table
- number: 0x0
- number: 0x2
- number: 0x4
- number: 0x6
- number: 0x8
- number: 0x1
- number: 0x3
- number: 0x5
- number: 0x7
- number: 0x9
- 8 or more:
- description: Digital root lookup table via neg numbers
- number: 0x0
- number: 0x1
- number: 0x2
- number: 0x3
- number: 0x4
- number: 0xfffffffc
- number: 0xfffffffd
- number: 0xfffffffe
- number: 0xffffffff
- basic block:
- or:
- and:
- description: Conversion of chr to int (SUB 0x30)
- number: 0x30
- mnemonic: sub
- and:
- description: Conversion of chr to int (LEA REG,[REG+ -0x30])
- mnemonic: lea
- offset: -0x30
- basic block:
- or:
- and:
- description: Final section returning checkum % 10
- mnemonic: idiv
- mnemonic: cdq
- number: 0xa
- optional:
- mnemonic: neg
- and:
- description: Compiler optimized returning checkum % 10
- mnemonic: shr
- mnemonic: imul
- number: 0x66666667
- number: 0x1f
- number: 0x2
- optional:
- mnemonic: neg
Reason: characteristic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/validate-payment-card-number-using-luhn-algorithm-with-lookup-table.yml
----------------------------------------------
rule:
meta:
name: allocate RW memory
author: [email protected]
lib: true
scope: basic block
mbc:
- Memory::Allocate Memory [C0007]
examples:
- Practical Malware Analysis Lab 17-02.dll_:0x1000D10D
features:
- and:
- match: allocate memory
- number: 0x4 = PAGE_READWRITE
Reason: Number too short (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/allocate-rw-memory.yml
----------------------------------------------
rule:
meta:
name: PEB access
author: [email protected]
lib: true
scope: basic block
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Process Environment Block [B0001.019]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/NtGlobalFlag.cpp
examples:
- al-khaser_x86.exe_:0x420D20
features:
- or:
- characteristic: peb access
- and:
# https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/NtGlobalFlag.cpp#L41
- characteristic: fs access
- or:
- offset/x32: 0x30
- and:
- number/x32: 0x30
- mnemonic: add
- and:
- characteristic: gs access
- or:
- offset/x64: 0x60
- and:
- number/x64: 0x60
- mnemonic: add
- and:
# WoW64 PEB address is fetched via the WoW64 Thread Environment Block (TEB) at FS:[0x18]-0x2000
# https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/NtGlobalFlag.cpp#L45
- characteristic: fs access
- mnemonic: sub
- number: 0x2000
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "And" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/lib/peb-access.yml
----------------------------------------------
rule:
meta:
name: overwrite Master Boot Record (MBR)
namespace: impact/wipe-disk/wipe-mbr
author: [email protected]
scope: function
att&ck:
- Impact::Disk Wipe::Disk Structure Wipe [T1561.002]
examples:
- 39C05B15E9834AC93F206BC114D0A00C357C888DB567BA8F5345DA0529CBED41:0x100070A0
features:
- and:
- string: "\\\\.\\PHYSICALDRIVE0"
- api: kernel32.WriteFile
# MBR/sector size in bytes
- number: 0x200
- or:
# MBR signature constant
- number: 0x55
# MBR signature constant
- number: 0xAA
- optional:
- api: kernel32.CreateFile
Reason: Number too short (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/impact/wipe-disk/wipe-mbr/overwrite-master-boot-record-mbr.yml
----------------------------------------------
rule:
meta:
name: execute shell command and capture output
namespace: c2/shell
author: [email protected]
scope: function
att&ck:
- Execution::Command and Scripting Interpreter::Windows Command Shell [T1059.003]
references:
- https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
examples:
- Practical Malware Analysis Lab 14-02.exe_:0x4011C0
features:
- and:
- match: create a process with modified I/O handles and window
- match: create pipe
- or:
- match: get COMSPEC environment variable
- string: "\\cmd.exe"
- string: "cmd.exe"
- string: "cmd.exe /c "
- string: "C:\\Windows\\system32\\cmd.exe"
- optional:
- api: kernel32.GetSystemDirectory
- api: kernel32.SetCurrentDirectory
- match: create thread
- match: read pipe
Reason: needed sub-rule not converted (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/c2/shell/execute-shell-command-and-capture-output.yml
----------------------------------------------
rule:
meta:
name: patch process command line
namespace: anti-analysis/anti-forensic
author:
- '@_re_fox'
scope: function
references:
- https://stackoverflow.com/q/24754844/87207
- https://blog.xpnsec.com/how-to-argue-like-cobalt-strike/
examples:
- e353d3fbfb5c3738a77a622adff9a416:0x401626
features:
- or:
- and:
- basic block:
# example:
# mov rbx, gs:60h
# lea r9, [rsp+4A0h+flOldProtect] ; lpflOldProtect
# mov edx, 8 ; dwSize
# mov rcx, [rbx+20h]
# add rcx, 70h ; 'p' ; lpAddress
# lea r8d, [rdx-4] ; flNewProtect
# call cs:VirtualProtect
# test eax, eax
- and:
- characteristic: gs access
- offset/x64: 0x60 = PEB
- offset/x64: 0x20 = PEB->ProcessParameters
- offset/x64: 0x70 = PEB->ProcessParameters->CommandLine
- api: VirtualProtect
- count(api(VirtualProtect)): 2 or more
- and:
- characteristic: indirect call
- api: GetProcAddress
- string: "NtQueryInformationProcess"
- api: ReadProcessMemory
- or:
- and:
- offset/x32: 0x10 = PEB->ProcessParameters
- offset/x32: 0x40 = PEB->ProcessParameters->CommandLine
- and:
- offset/x64: 0x20 = PEB->ProcessParameters
- offset/x64: 0x70 = PEB->ProcessParameters->CommandLine
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "And" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-forensic/patch-process-command-line.yml
----------------------------------------------
rule:
meta:
name: crash the Windows event logging service
namespace: anti-analysis/anti-forensic
author: [email protected]
scope: basic block
att&ck:
- Defense Evasion::Impair Defenses::Disable Windows Event Logging [T1562.002]
references:
- https://github.com/limbenjamin/LogServiceCrash
examples:
- 82BF6347ACF15E5D883715DC289D8A2B:0x14005E0C0
features:
- and:
- count(api(advapi32.ElfClearEventLogFileW)): 3 or more
- count(api(advapi32.OpenEventLogA)): 1 or more
Reason: Range (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-forensic/crash-the-windows-event-logging-service.yml
----------------------------------------------
rule:
meta:
name: contain obfuscated stackstrings
namespace: anti-analysis/obfuscation/string/stackstring
author: [email protected]
scope: basic block
att&ck:
- Defense Evasion::Obfuscated Files or Information::Indicator Removal from Tools [T1027.005]
mbc:
- Anti-Static Analysis::Disassembler Evasion::Argument Obfuscation [B0012.001]
examples:
- Practical Malware Analysis Lab 16-03.exe_:0x4013D0
features:
- characteristic: stack string
Reason: characteristic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/obfuscation/string/stackstring/contain-obfuscated-stackstrings.yml
----------------------------------------------
rule:
meta:
name: contain anti-disasm techniques
namespace: anti-analysis/anti-disasm
author: [email protected]
scope: file
mbc:
- Anti-Static Analysis::Disassembler Evasion [B0012]
examples:
- a5c70086b3bc4fe64f4e7a0aa452e620
features:
- or:
- count(match(contain pusha popa sequence)): 10 or more
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "Range" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-disasm/contain-anti-disasm-techniques.yml
----------------------------------------------
rule:
meta:
name: 64-bit execution via heavens gate
namespace: anti-analysis/anti-disasm
author: '@recvfrom'
description: Looks for instructions related to executing 64-bit code from a 32-bit process (Heaven's Gate)
scope: function
mbc:
- Defense Evasion::Disable or Evade Security Tools::Heavens Gate [F0004.008]
references:
- https://download.bitdefender.com/resources/files/News/CaseStudies/study/318/Bitdefender-TRR-Whitepaper-Maze-creat4351-en-EN-GenericUse.pdf
- https://www.malwaretech.com/2014/02/the-0x33-segment-selector-heavens-gate.html
examples:
- 79abd17391adc6251ecdc58d13d76baf:0x10002385
features:
- and:
- and:
- or:
- mnemonic: push = 'push 33h'
- mnemonic: mov = cover any mov ESP / EBP equivalents
- number: 0x33 = set up retf to push 0x33 to CS indicating 64-bit mode
- mnemonic: call = 'call $+5' pushes the current EIP onto the stack, +5 to jump past call insn bytes
- and:
- mnemonic: add = 'add dword ptr[esp], 5' updates the return address to point after retf
- number: 0x5 = length of add + retf insn bytes
- mnemonic: retf = set EIP = [ESP] and CS = [ESP+4]
Reason: mnemonic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-disasm/64-bit-execution-via-heavens-gate.yml
----------------------------------------------
rule:
meta:
name: packed with generic packer
namespace: anti-analysis/packer/generic
author: [email protected]
scope: function
att&ck:
- Defense Evasion::Obfuscated Files or Information::Software Packing [T1027.002]
mbc:
- Anti-Static Analysis::Software Packing::Standard Compression [F0001.002]
examples:
- Practical Malware Analysis Lab 18-01.exe_:0x409dc0
features:
- and:
- or:
- mnemonic: pusha
- mnemonic: pushad # vivisect
- or:
- mnemonic: popa
- mnemonic: popad # vivisect
- characteristic: cross section flow
- not:
- match: contain pusha popa sequence
Reason: mnemonic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/packer/generic/packed-with-generic-packer.yml
----------------------------------------------
rule:
meta:
name: check for windows sandbox via dns suffix
namespace: anti-analysis/anti-vm/vm-detection
author: "@_re_fox"
scope: function
att&ck:
- Defense Evasion::Virtualization/Sandbox Evasion::System Checks [T1497.001]
mbc:
- Anti-Behavioral Analysis::Virtual Machine Detection [B0009]
references:
- https://github.com/LloydLabs/wsb-detect
examples:
- 773290480d5445f11d3dc1b800728966:0x140001140
features:
- and:
- api: GetAdaptersAddresses
- string: "mshome.net"
- offset: 0x38 = DnsSuffix
- match: contain loop
Reason: offset (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-vm/vm-detection/check-for-windows-sandbox-via-dns-suffix.yml
----------------------------------------------
rule:
meta:
name: execute anti-VM instructions
namespace: anti-analysis/anti-vm/vm-detection
author: [email protected]
scope: basic block
att&ck:
- Defense Evasion::Virtualization/Sandbox Evasion::System Checks [T1497.001]
mbc:
- Anti-Behavioral Analysis::Virtual Machine Detection::Instruction Testing [B0009.029]
examples:
- Practical Malware Analysis Lab 17-03.exe_:0x401A80
features:
- or:
- mnemonic: sidt
- mnemonic: sgdt
- mnemonic: sldt
- mnemonic: smsw
- mnemonic: str
- mnemonic: in
# many misleading hits in runtime code, see #194
# - mnemonic: cpuid
- mnemonic: vpcext
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "mnemonic" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-vm/vm-detection/execute-anti-vm-instructions.yml
----------------------------------------------
rule:
meta:
name: check for unmoving mouse cursor
namespace: anti-analysis/anti-vm/vm-detection
author: BitsOfBinary
scope: function
att&ck:
- Defense Evasion::Virtualization/Sandbox Evasion::User Activity Based Checks [T1497.002]
mbc:
- Anti-Behavioral Analysis::Virtual Machine Detection::Human User Check [B0009.012]
references:
- https://www.joesecurity.org/blog/5852460122427342172
examples:
- d7ff81ff775d4ab50d31ac1e962c8c4dea7ff9f280aa2b42ddd06760a5665002:0x401118
features:
- and:
- count(api(user32.GetCursorPos)): 2 or more
Reason: Range (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-vm/vm-detection/check-for-unmoving-mouse-cursor.yml
----------------------------------------------
rule:
meta:
name: check for windows sandbox via genuine state
namespace: anti-analysis/anti-vm/vm-detection
author: "@_re_fox"
scope: function
att&ck:
- Defense Evasion::Virtualization/Sandbox Evasion::System Checks [T1497.001]
mbc:
- Anti-Behavioral Analysis::Virtual Machine Detection [B0009]
references:
- https://github.com/LloydLabs/wsb-detect
examples:
- 773290480d5445f11d3dc1b800728966:0x140001140
features:
- and:
- basic block:
- and:
- api: SLIsGenuineLocal
- basic block:
- and:
- api: UuidFromString
- string: "55c92734-d682-4d71-983e-d6ec3f16059f"
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-vm/vm-detection/check-for-windows-sandbox-via-genuine-state.yml
----------------------------------------------
rule:
meta:
name: check for unexpected memory writes
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: basic block
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Memory Write Watching [B0001.010]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/WriteWatch.cpp
examples:
- al-khaser_x86.exe_:0x431EBC
features:
- and:
- api: kernel32.GetWriteWatch
- number: 0x0
Reason: Number too short (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-unexpected-memory-writes.yml
----------------------------------------------
rule:
meta:
name: check for software breakpoints
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Software Breakpoints [B0001.025]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/SoftwareBreakpoints.cpp
examples:
- al-khaser_x86.exe_:0x431020
features:
- and:
- basic block:
- and:
- mnemonic: cmp
- or:
- number: 0xCC
- and:
- number: 0xCD
- number: 0x3
- match: contain loop
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-software-breakpoints.yml
----------------------------------------------
rule:
meta:
name: execute anti-debugging instructions
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Anti-debugging Instructions [B0001.034]
examples:
- Practical Malware Analysis Lab 16-03.exe_:0x401300
features:
- or:
- count(mnemonic(rdtsc)): 2 or more
- mnemonic: icebp
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "mnemonic" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/execute-anti-debugging-instructions.yml
----------------------------------------------
rule:
meta:
name: check for PEB BeingDebugged flag
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: basic block
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Process Environment Block BeingDebugged [B0001.035]
references:
- Practical Malware Analysis, Chapter 16, p. 353
examples:
- Practical Malware Analysis Lab 16-01.exe_:0x403530
features:
- and:
- match: PEB access
- offset: 2 = PEB.BeingDebugged
Reason: needed sub-rule not converted (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-peb-beingdebugged-flag.yml
----------------------------------------------
rule:
meta:
name: check for protected handle exception
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::SetHandleInformation [B0001.024]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/SetHandleInformation_API.cpp
examples:
- al-khaser_x86.exe_:0x430D20
features:
- and:
- basic block:
- and:
- count(number(2)): 2 or more
- api: SetHandleInformation
- api: CloseHandle
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-protected-handle-exception.yml
----------------------------------------------
rule:
meta:
name: check for hardware breakpoints
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Hardware Breakpoints [B0001.005]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/HardwareBreakpoints.cpp
examples:
- al-khaser_x86.exe_:0x42035D
features:
- and:
- api: kernel32.GetThreadContext
- number: 0x10010 = CONTEXT_DEBUG_REGISTERS
- offset: 0x4 = DR0
- offset: 0x8 = DR1
- offset: 0xC = DR2
- offset: 0x10 = DR3
- count(mnemonic(cmp)): 4 or more
Reason: Number too short (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-hardware-breakpoints.yml
----------------------------------------------
rule:
meta:
name: check for PEB NtGlobalFlag flag
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Process Environment Block NtGlobalFlag [B0001.036]
references:
- Practical Malware Analysis, Chapter 16, p. 355
- https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb/index.htm
examples:
- Practical Malware Analysis Lab 16-01.exe_:0x403530
features:
- and:
- basic block:
- and:
- match: PEB access
- or:
- or:
- offset/x32: 0x68 = PEB.NtGlobalFlag
- offset/x64: 0xBC = PEB.NtGlobalFlag
- and:
- mnemonic: add
- or:
- number/x32: 0x68 = PEB.NtGlobalFlag
- number/x64: 0xBC = PEB.NtGlobalFlag
- number: 0x70 = (FLG_HEAP_ENABLE_TAIL_CHECK | FLG_HEAP_ENABLE_FREE_CHECK | FLG_HEAP_VALIDATE_PARAMETERS)
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-peb-ntglobalflag-flag.yml
----------------------------------------------
rule:
meta:
name: check for trap flag exception
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: basic block
mbc:
- Anti-Behavioral Analysis::Debugger Detection [B0001]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/TrapFlag.cpp
examples:
- al-khaser_x86.exe_:0x431680
- al-khaser_x64.exe_:0x140030CB0
features:
- and:
- or:
- description: read/write EFLAGS register
- and:
- mnemonic: pushf
- mnemonic: popf
- and:
- mnemonic: pushfd
- mnemonic: popfd
- and:
- mnemonic: pushfq
- mnemonic: popfq
- or:
- description: set trap flag
- and:
- mnemonic: or
- number: 0x100
- and:
- mnemonic: bts
- number: 0x8
Reason: mnemonic (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-trap-flag-exception.yml
----------------------------------------------
rule:
meta:
name: check for time delay via GetTickCount
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Timing/Delay Check GetTickCount [B0001.032]
examples:
- Practical Malware Analysis Lab 16-03.exe_:0x4013d0
features:
- and:
- count(api(kernel32.GetTickCount)): 2 or more
Reason: Range (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-time-delay-via-gettickcount.yml
----------------------------------------------
rule:
meta:
name: check process job object
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection [B0001]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/ProcessJob.cpp
examples:
- al-khaser_x86.exe_:0x426730
features:
- and:
- match: contain loop
- basic block:
- and:
- api: kernel32.QueryInformationJobObject
- number: 0x3 = JobObjectBasicProcessIdList
- basic block:
- and:
- api: kernel32.OpenProcess
- number: 0x400 = PROCESS_QUERY_INFORMATION
Reason: needed sub-rule not converted (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-process-job-object.yml
----------------------------------------------
rule:
meta:
name: check for kernel debugger via shared user data structure
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection [B0001]
references:
- https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser/AntiDebug/SharedUserData_KernelDebugger.cpp
- http://www.geoffchappell.com/studies/windows/km/ntoskrnl/structs/kuser_shared_data.htm
examples:
- al-khaser_x86.exe_:0x430E60
features:
- and:
- number: 0x7FFE02D4 = UserSharedData->KdDebuggerEnabled
- basic block:
- and:
- mnemonic: and
- number: 0x2 = KdDebuggerNotPresent
- basic block:
- and:
- mnemonic: and
- number: 0x1 = KdDebuggerEnabled
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-kernel-debugger-via-shared-user-data-structure.yml
----------------------------------------------
rule:
meta:
name: check for time delay via QueryPerformanceCounter
namespace: anti-analysis/anti-debugging/debugger-detection
author: [email protected]
scope: function
mbc:
- Anti-Behavioral Analysis::Debugger Detection::Timing/Delay Check QueryPerformanceCounter [B0001.033]
examples:
- Practical Malware Analysis Lab 16-03.exe_:0x4011e0
features:
- and:
- count(api(kernel32.QueryPerformanceCounter)): 2 or more
Reason: Range (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/anti-analysis/anti-debugging/debugger-detection/check-for-time-delay-via-queryperformancecounter.yml
----------------------------------------------
rule:
meta:
name: contain an embedded PE file
namespace: executable/subfile/pe
author: [email protected]
scope: file
mbc:
- Execution::Install Additional Program [B0023]
examples:
- Practical Malware Analysis Lab 01-04.exe_:0x4060
features:
- or:
- count(characteristic(embedded pe)): 1 or more
- count(string(This program cannot be run in DOS mode.)): 2 or more
Reason: Multiple statements inside "- or:" where all unsupported, the last one was "Range" (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/executable/subfile/pe/contain-an-embedded-pe-file.yml
----------------------------------------------
rule:
meta:
name: read file via mapping
namespace: host-interaction/file-system/read
author: [email protected]
scope: function
examples:
- Practical Malware Analysis Lab 01-01.exe_:0x401440
features:
- and:
- basic block:
- and:
- api: kernel32.MapViewOfFile
- number: 4 = FILE_MAP_READ
- optional:
- api: kernel32.UnmapViewOfFile
- and:
- match: get file size
- basic block:
- and:
- api: kernel32.CreateFileMapping
- number: 2 = PAGE_READONLY
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/host-interaction/file-system/read-file-via-mapping.yml
----------------------------------------------
rule:
meta:
name: get Program Files directory
namespace: host-interaction/file-system
author: [email protected]
scope: basic block
att&ck:
- Discovery::File and Directory Discovery [T1083]
examples:
- BC452CC1128CCF7FA9F76D83CDA79132740414973600FED14509749FE946816E:0x407880
features:
- and:
- or:
- number: 0x26 = CSIDL_PROGRAM_FILES
- number: 0x2A = CSIDL_PROGRAM_FILESX86
- or:
- api: shell32.SHGetFolderPath
- api: shell32.SHGetFolderLocation
- api: shell32.SHGetSpecialFolderPath
- api: shell32.SHGetSpecialFolderLocation
Reason: Number too short (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/host-interaction/file-system/get-program-files-directory.yml
----------------------------------------------
rule:
meta:
name: bypass Windows File Protection
namespace: host-interaction/file-system/windows-file-protection
author: [email protected]
scope: function
mbc:
- Defense Evasion::Disable or Evade Security Tools::Bypass Windows File Protection [F0004.007]
examples:
- Practical Malware Analysis Lab 01-04.exe_:0x401174
features:
- and:
- string: "sfc_os.dll" # System File Checker
- number: 0x2 # SfcTerminateWatcherThread
- match: link function at runtime
Reason: Number too short (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/host-interaction/file-system/windows-file-protection/bypass-windows-file-protection.yml
----------------------------------------------
rule:
meta:
name: enumerate files via ntdll functions
namespace: host-interaction/file-system/files/list
author: [email protected]
scope: function
att&ck:
- Discovery::File and Directory Discovery [T1083]
references:
- https://github.com/hfiref0x/TDL/blob/cc4b46ae1c939b14a22a734a727b163f873a41b5/Source/Furutaka/sup.c#L315
examples:
- 563653399B82CD443F120ECEFF836EA3678D4CF11D9B351BB737573C2D856299:0x14000203C
features:
- and:
- basic block:
- and:
- number: 1 = DIRECTORY_QUERY
- api: ntdll.NtOpenDirectoryObject
- api: ntdll.NtQueryDirectoryObject
- optional:
- api: RtlAllocateHeap
- match: contain loop
- characteristic: indirect call
Reason: Depending on myself = basic block (there might be multiple unsupported things in this rule, this is the 1st one encountered)
https://github.com/fireeye/capa-rules/blob/master/host-interaction/file-system/files/list/enumerate-files-via-ntdll-functions.yml
----------------------------------------------
rule:
meta:
name: enumerate files recursively
namespace: host-interaction/file-system/files/list