pdfalyzer 1.16.6__py3-none-any.whl → 1.16.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfalyzer might be problematic. Click here for more details.

@@ -1,4 +1,6 @@
1
+ import "hash"
1
2
  import "math"
3
+ import "pe"
2
4
 
3
5
 
4
6
  // rule pdf: PDF
@@ -19,8 +21,7 @@ import "math"
19
21
  // }
20
22
 
21
23
 
22
- rule Cobaltgang_PDF_Metadata_Rev_A
23
- {
24
+ rule Cobaltgang_PDF_Metadata_Rev_A {
24
25
  meta:
25
26
  description = "Find documents saved from the same potential Cobalt Gang PDF template"
26
27
  author = "Palo Alto Networks Unit 42"
@@ -33,8 +34,7 @@ rule Cobaltgang_PDF_Metadata_Rev_A
33
34
  }
34
35
 
35
36
 
36
- rule PDF_Embedded_Exe : PDF
37
- {
37
+ rule PDF_Embedded_Exe : PDF {
38
38
  meta:
39
39
  ref = "https://github.com/jacobsoo/Yara-Rules/blob/master/PDF_Embedded_Exe.yar"
40
40
  strings:
@@ -53,7 +53,6 @@ rule SUSP_Bad_PDF {
53
53
  reference = "Internal Research"
54
54
  date = "2018-05-03"
55
55
  hash1 = "d8c502da8a2b8d1c67cb5d61428f273e989424f319cfe805541304bdb7b921a8"
56
-
57
56
  strings:
58
57
  $s1 = " /F (http//" ascii
59
58
  $s2 = " /F (\\\\\\\\" ascii
@@ -63,8 +62,7 @@ rule SUSP_Bad_PDF {
63
62
  }
64
63
 
65
64
 
66
- rule malicious_author : PDF
67
- {
65
+ rule malicious_author : PDF {
68
66
  meta:
69
67
  author = "Glenn Edwards (@hiddenillusion)"
70
68
  version = "0.1"
@@ -80,8 +78,7 @@ rule malicious_author : PDF
80
78
  }
81
79
 
82
80
 
83
- rule suspicious_version : PDF
84
- {
81
+ rule suspicious_version : PDF {
85
82
  meta:
86
83
  author = "Glenn Edwards (@hiddenillusion)"
87
84
  version = "0.1"
@@ -95,8 +92,7 @@ rule suspicious_version : PDF
95
92
  }
96
93
 
97
94
 
98
- rule suspicious_creation : PDF
99
- {
95
+ rule suspicious_creation : PDF {
100
96
  meta:
101
97
  author = "Glenn Edwards (@hiddenillusion)"
102
98
  version = "0.1"
@@ -112,8 +108,7 @@ rule suspicious_creation : PDF
112
108
  }
113
109
 
114
110
 
115
- rule suspicious_title : PDF
116
- {
111
+ rule suspicious_title : PDF {
117
112
  meta:
118
113
  author = "Glenn Edwards (@hiddenillusion)"
119
114
  version = "0.1"
@@ -131,8 +126,7 @@ rule suspicious_title : PDF
131
126
  }
132
127
 
133
128
 
134
- rule suspicious_author : PDF
135
- {
129
+ rule suspicious_author : PDF {
136
130
  meta:
137
131
  author = "Glenn Edwards (@hiddenillusion)"
138
132
  version = "0.1"
@@ -150,8 +144,7 @@ rule suspicious_author : PDF
150
144
  }
151
145
 
152
146
 
153
- rule suspicious_producer : PDF
154
- {
147
+ rule suspicious_producer : PDF {
155
148
  meta:
156
149
  author = "Glenn Edwards (@hiddenillusion)"
157
150
  version = "0.1"
@@ -168,17 +161,14 @@ rule suspicious_producer : PDF
168
161
  }
169
162
 
170
163
 
171
- rule suspicious_creator : PDF
172
- {
164
+ rule suspicious_creator : PDF {
173
165
  meta:
174
166
  author = "Glenn Edwards (@hiddenillusion)"
175
167
  version = "0.1"
176
168
  weight = 3
177
-
178
169
  strings:
179
170
  $magic = { 25 50 44 46 }
180
171
  $header = /%PDF-1\.(3|4|6)/
181
-
182
172
  $creator0 = "yen vaw"
183
173
  $creator1 = "Scribus"
184
174
  $creator2 = "Viraciregavi"
@@ -187,40 +177,12 @@ rule suspicious_creator : PDF
187
177
  }
188
178
 
189
179
 
190
- rule possible_exploit : PDF
191
- {
192
- meta:
193
- author = "Glenn Edwards (@hiddenillusion)"
194
- version = "0.1"
195
- weight = 3
196
-
197
- strings:
198
- $magic = { 25 50 44 46 }
199
-
200
- $attrib0 = /\/JavaScript /
201
- $attrib3 = /\/ASCIIHexDecode/
202
- $attrib4 = /\/ASCII85Decode/
203
-
204
- $action0 = /\/Action/
205
- $action1 = "Array"
206
- $shell = "A"
207
- $cond0 = "unescape"
208
- $cond1 = "String.fromCharCode"
209
-
210
- $nop = "%u9090%u9090"
211
- condition:
212
- $magic in (0..1024) and (2 of ($attrib*)) or ($action0 and #shell > 10 and 1 of ($cond*)) or ($action1 and $cond0 and $nop)
213
- }
214
-
215
-
216
- rule shellcode_blob_metadata : PDF
217
- {
180
+ rule shellcode_blob_metadata : PDF {
218
181
  meta:
219
182
  author = "Glenn Edwards (@hiddenillusion)"
220
183
  version = "0.1"
221
184
  description = "When there's a large Base64 blob inserted into metadata fields it often indicates shellcode to later be decoded"
222
185
  weight = 4
223
-
224
186
  strings:
225
187
  $magic = { 25 50 44 46 }
226
188
  $reg_keyword = /\/Keywords.?\(([a-zA-Z0-9]{200,})/ //~6k was observed in BHEHv2 PDF exploits holding the shellcode
@@ -233,13 +195,12 @@ rule shellcode_blob_metadata : PDF
233
195
  $magic in (0..1024) and 1 of ($reg*)
234
196
  }
235
197
 
236
- rule multiple_filtering : PDF
237
- {
198
+
199
+ rule multiple_filtering : PDF {
238
200
  meta:
239
201
  author = "Glenn Edwards (@hiddenillusion)"
240
202
  version = "0.2"
241
203
  weight = 3
242
-
243
204
  strings:
244
205
  $magic = { 25 50 44 46 }
245
206
  $attrib = /\/Filter.*?(\/ASCIIHexDecode\W+?|\/LZWDecode\W+?|\/ASCII85Decode\W+?|\/FlateDecode\W+?|\/RunLengthDecode){2}?/
@@ -248,32 +209,12 @@ rule multiple_filtering : PDF
248
209
  $magic in (0..1024) and $attrib
249
210
  }
250
211
 
251
- rule suspicious_js : PDF
252
- {
253
- meta:
254
- author = "Glenn Edwards (@hiddenillusion)"
255
- version = "0.1"
256
- weight = 3
257
212
 
258
- strings:
259
- $magic = { 25 50 44 46 }
260
- $attrib0 = /\/OpenAction /
261
- $attrib1 = /\/JavaScript /
262
- $js0 = "eval"
263
- $js1 = "Array"
264
- $js2 = "String.fromCharCode"
265
- condition:
266
- $magic in (0..1024) and all of ($attrib*) and 2 of ($js*)
267
- }
268
-
269
-
270
- rule suspicious_launch_action : PDF
271
- {
213
+ rule suspicious_launch_action : PDF {
272
214
  meta:
273
215
  author = "Glenn Edwards (@hiddenillusion)"
274
216
  version = "0.1"
275
217
  weight = 2
276
-
277
218
  strings:
278
219
  $magic = { 25 50 44 46 }
279
220
  $attrib0 = /\/Launch/
@@ -285,8 +226,7 @@ rule suspicious_launch_action : PDF
285
226
  }
286
227
 
287
228
 
288
- rule suspicious_embed : PDF
289
- {
229
+ rule suspicious_embed : PDF {
290
230
  meta:
291
231
  author = "Glenn Edwards (@hiddenillusion)"
292
232
  version = "0.1"
@@ -294,7 +234,6 @@ rule suspicious_embed : PDF
294
234
  weight = 2
295
235
  strings:
296
236
  $magic = { 25 50 44 46 }
297
-
298
237
  $meth0 = /\/Launch/
299
238
  $meth1 = /\/GoTo(E|R)/ //means go to embedded or remote
300
239
  $attrib0 = /\/URL /
@@ -305,13 +244,11 @@ rule suspicious_embed : PDF
305
244
  }
306
245
 
307
246
 
308
- rule suspicious_obfuscation : PDF
309
- {
247
+ rule suspicious_obfuscation : PDF {
310
248
  meta:
311
249
  author = "Glenn Edwards (@hiddenillusion)"
312
250
  version = "0.1"
313
251
  weight = 2
314
-
315
252
  strings:
316
253
  $magic = { 25 50 44 46 }
317
254
  $reg = /\/\w#[a-zA-Z0-9]{2}#[a-zA-Z0-9]{2}/
@@ -320,8 +257,7 @@ rule suspicious_obfuscation : PDF
320
257
  }
321
258
 
322
259
 
323
- rule invalid_XObject_js : PDF
324
- {
260
+ rule invalid_XObject_js : PDF {
325
261
  meta:
326
262
  author = "Glenn Edwards (@hiddenillusion)"
327
263
  description = "XObject's require v1.4+"
@@ -331,7 +267,6 @@ rule invalid_XObject_js : PDF
331
267
  strings:
332
268
  $magic = { 25 50 44 46 }
333
269
  $ver = /%PDF-1\.[4-9]/
334
-
335
270
  $attrib0 = /\/XObject/
336
271
  $attrib1 = /\/JavaScript/
337
272
  condition:
@@ -339,13 +274,11 @@ rule invalid_XObject_js : PDF
339
274
  }
340
275
 
341
276
 
342
- rule invalid_trailer_structure : PDF
343
- {
277
+ rule invalid_trailer_structure : PDF {
344
278
  meta:
345
279
  author = "Glenn Edwards (@hiddenillusion), @malvidin"
346
280
  version = "0.2"
347
281
  weight = 1
348
-
349
282
  strings:
350
283
  $magic = "%PDF" // Required for a valid PDF
351
284
  $reg0 = /trailer[ \r\n]*<<.{0,1000}\/Size\b/s
@@ -355,8 +288,7 @@ rule invalid_trailer_structure : PDF
355
288
  }
356
289
 
357
290
 
358
- rule multiple_versions : PDF
359
- {
291
+ rule multiple_versions : PDF {
360
292
  meta:
361
293
  author = "Glenn Edwards (@hiddenillusion)"
362
294
  version = "0.1"
@@ -372,15 +304,13 @@ rule multiple_versions : PDF
372
304
  }
373
305
 
374
306
 
375
- rule js_wrong_version : PDF
376
- {
307
+ rule js_wrong_version : PDF {
377
308
  meta:
378
309
  author = "Glenn Edwards (@hiddenillusion)"
379
310
  description = "JavaScript was introduced in v1.3"
380
311
  ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
381
312
  version = "0.1"
382
313
  weight = 2
383
-
384
314
  strings:
385
315
  $magic = { 25 50 44 46 }
386
316
  $js = /\/JavaScript/
@@ -390,8 +320,7 @@ rule js_wrong_version : PDF
390
320
  }
391
321
 
392
322
 
393
- rule JBIG2_wrong_version : PDF
394
- {
323
+ rule JBIG2_wrong_version : PDF {
395
324
  meta:
396
325
  author = "Glenn Edwards (@hiddenillusion)"
397
326
  description = "JBIG2 was introduced in v1.4"
@@ -408,8 +337,7 @@ rule JBIG2_wrong_version : PDF
408
337
  }
409
338
 
410
339
 
411
- rule FlateDecode_wrong_version : PDF
412
- {
340
+ rule FlateDecode_wrong_version : PDF {
413
341
  meta:
414
342
  author = "Glenn Edwards (@hiddenillusion)"
415
343
  description = "Flate was introduced in v1.2"
@@ -426,15 +354,13 @@ rule FlateDecode_wrong_version : PDF
426
354
  }
427
355
 
428
356
 
429
- rule embed_wrong_version : PDF
430
- {
357
+ rule embed_wrong_version : PDF {
431
358
  meta:
432
359
  author = "Glenn Edwards (@hiddenillusion)"
433
360
  description = "EmbeddedFiles were introduced in v1.3"
434
361
  ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
435
362
  version = "0.1"
436
363
  weight = 1
437
-
438
364
  strings:
439
365
  $magic = { 25 50 44 46 }
440
366
  $embed = /\/EmbeddedFiles/
@@ -444,8 +370,7 @@ rule embed_wrong_version : PDF
444
370
  }
445
371
 
446
372
 
447
- rule invalid_xref_numbers : PDF
448
- {
373
+ rule invalid_xref_numbers : PDF {
449
374
  meta:
450
375
  author = "Glenn Edwards (@hiddenillusion)"
451
376
  version = "0.1"
@@ -462,14 +387,12 @@ rule invalid_xref_numbers : PDF
462
387
  }
463
388
 
464
389
 
465
- rule js_splitting : PDF
466
- {
390
+ rule js_splitting : PDF {
467
391
  meta:
468
392
  author = "Glenn Edwards (@hiddenillusion)"
469
393
  version = "0.1"
470
394
  description = "These are commonly used to split up JS code"
471
395
  weight = 2
472
-
473
396
  strings:
474
397
  $magic = { 25 50 44 46 }
475
398
  $js = /\/JavaScript/
@@ -482,8 +405,7 @@ rule js_splitting : PDF
482
405
  }
483
406
 
484
407
 
485
- rule header_evasion : PDF
486
- {
408
+ rule header_evasion : PDF {
487
409
  meta:
488
410
  author = "Glenn Edwards (@hiddenillusion)"
489
411
  description = "3.4.1, 'File Header' of Appendix H states that ' Acrobat viewers require only that the header appear somewhere within the first 1024 bytes of the file.' Therefore, if you see this trigger then any other rule looking to match the magic at 0 won't be applicable"
@@ -498,8 +420,7 @@ rule header_evasion : PDF
498
420
  }
499
421
 
500
422
 
501
- rule BlackHole_v2 : PDF
502
- {
423
+ rule BlackHole_v2 : PDF {
503
424
  meta:
504
425
  author = "Glenn Edwards (@hiddenillusion)"
505
426
  version = "0.1"
@@ -547,8 +468,7 @@ rule blackhole2_pdf : EK PDF{
547
468
  18 of them
548
469
  }
549
470
 
550
- rule XDP_embedded_PDF : PDF
551
- {
471
+ rule XDP_embedded_PDF : PDF {
552
472
  meta:
553
473
  author = "Glenn Edwards (@hiddenillusion)"
554
474
  version = "0.1"
@@ -564,27 +484,12 @@ rule XDP_embedded_PDF : PDF
564
484
  all of ($s*) and 1 of ($header*)
565
485
  }
566
486
 
567
- // rule pdfjs_hunter
568
- // {
569
- // strings:
570
- // $pdf_header = "%PDF"
571
- // condition:
572
- // new_file and
573
- // (
574
- // file_type contains "pdf" or
575
- // $pdf_header in (0..1024)
576
- // )
577
- // and tags contains "js-embedded"
578
- // }
579
-
580
487
 
581
- rule PDF_Document_with_Embedded_IQY_File
582
- {
488
+ rule PDF_Document_with_Embedded_IQY_File {
583
489
  meta:
584
490
  Author = "InQuest Labs"
585
491
  Description = "This signature detects IQY files embedded within PDF documents which use a JavaScript OpenAction object to run the IQY."
586
492
  Reference = "https://blog.inquest.net"
587
-
588
493
  strings:
589
494
  $pdf_magic = "%PDF"
590
495
  $efile = /<<\/JavaScript [^\x3e]+\/EmbeddedFile/
@@ -629,29 +534,13 @@ rule PDF_Document_with_Embedded_IQY_File
629
534
  $pdf_magic in (0..60) and all of them
630
535
  }
631
536
 
632
- // rule malpdf_hunter
633
- // {
634
- // strings:
635
- // $pdf_header = "%PDF"
636
- // $encrypted = "/Encrypt"
637
- // condition:
638
- // new_file and
639
- // (
640
- // file_type contains "pdf" or
641
- // $pdf_header in (0..1024)
642
- // )
643
- // and (positives > 0 or $encrypted)
644
- // }
645
537
 
646
-
647
- rule Base64_Encoded_Powershell_Directives
648
- {
538
+ rule Base64_Encoded_Powershell_Directives {
649
539
  meta:
650
540
  Author = "InQuest Labs"
651
541
  Reference = "https://inquest.net/blog/2019/07/19/base64-encoded-powershell-pivots"
652
542
  Samples = "https://github.com/InQuest/malware-samples/tree/master/2019-07-Base64-Encoded-Powershell-Directives"
653
543
  Description = "This signature detects base64 encoded Powershell directives."
654
-
655
544
  strings:
656
545
  // Copy-Item
657
546
  $enc01 = /(Q\x32\x39weS\x31JdGVt[\x2b\x2f-\x39A-Za-z]|[\x2b\x2f-\x39A-Za-z][\x2b\x2f-\x39A-Za-z][\x31\x35\x39BFJNRVZdhlptx]Db\x33B\x35LUl\x30ZW[\x30-\x33]|[\x2b\x2f-\x39A-Za-z][\x30EUk]NvcHktSXRlb[Q-Za-f])/
@@ -692,27 +581,6 @@ rule Base64_Encoded_Powershell_Directives
692
581
  }
693
582
 
694
583
 
695
- // any office or PDF documents with a phishing hit.
696
- // rule phish_hunter
697
- // {
698
- // strings:
699
- // $pdf_header = "%PDF"
700
- // condition:
701
- // new_file and
702
- // (
703
- // file_type contains "office" or
704
- // file_type contains "pdf" or
705
- // tags contains "office" or
706
- // tags contains "pdf" or
707
- // $pdf_header in (0..1024)
708
- // )
709
- // and
710
- // (
711
- // signatures matches /phish/i
712
- // )
713
- // }
714
-
715
-
716
584
  rule APT_APT29_NOBELIUM_BoomBox_PDF_Masq_May21_1 {
717
585
  meta:
718
586
  description = "Detects PDF documents as used by BoomBox as described in APT29 NOBELIUM report"
@@ -729,7 +597,7 @@ rule APT_APT29_NOBELIUM_BoomBox_PDF_Masq_May21_1 {
729
597
  $fp2 = "endstream" ascii
730
598
  $fp3 = { 20 6F 62 6A 0A } /* obj\x0a */
731
599
  condition:
732
- $ah1 at 0 and $af1 at (filesize - 7) and filesize < 100KB
600
+ $ah1 at 0 and $af1 at (filesize - 7) and filesize < 100KB
733
601
  and math.entropy(16, filesize) > 7
734
602
  and not 1 of ($fp*)
735
603
  }
@@ -768,14 +636,12 @@ rule PDF_Containing_JavaScript {
768
636
  labs_reference = "N/A"
769
637
  labs_pivot = "N/A"
770
638
  samples = "c82e29dcaed3c71e05449cb9463f3efb7114ea22b6f45b16e09eae32db9f5bef"
771
-
772
639
  strings:
773
640
  $pdf_tag1 = /\x25\x50\x44\x46\x2d/
774
641
  $js_tag1 = "/JavaScript" fullword
775
642
  $js_tag2 = "/JS" fullword
776
643
  condition:
777
644
  $pdf_tag1 in (0..1024) and ($js_tag1 or $js_tag2)
778
-
779
645
  }
780
646
 
781
647
 
@@ -789,7 +655,6 @@ rule JS_PDF_Data_Submission {
789
655
  labs_reference = "N/A"
790
656
  labs_pivot = "N/A"
791
657
  samples = "a0adbe66e11bdeaf880b81b41cd63964084084a413069389364c98da0c4d2a13"
792
-
793
658
  strings:
794
659
  $pdf_header = "%PDF-"
795
660
  $js = /(\/JS|\/JavaScript)/ nocase
@@ -797,8 +662,8 @@ rule JS_PDF_Data_Submission {
797
662
  $inq_tail = "INQUEST-PP=pdfparser"
798
663
  condition:
799
664
  ($pdf_header in (0..1024) or $inq_tail in (filesize-30..filesize))
800
- and $js
801
- and $a1
665
+ and $js
666
+ and $a1
802
667
  }
803
668
 
804
669
 
@@ -845,7 +710,6 @@ rule PDF_Launch_Function {
845
710
  labs_reference = "N/A"
846
711
  labs_pivot = "N/A"
847
712
  samples = "c2f2d1de6bf973b849725f1069c649ce594a907c1481566c0411faba40943ee5"
848
-
849
713
  strings:
850
714
  $pdf_header = "%PDF-"
851
715
  $launch = "/Launch" nocase
@@ -923,12 +787,12 @@ example three:
923
787
  Multiple protocols supported for the /F include, both http and UNC.
924
788
  */
925
789
 
790
+
926
791
  rule NTLM_Credential_Theft_via_PDF {
927
792
  meta:
928
793
  Author = "InQuest Labs"
929
794
  URL = "https://github.com/InQuest/yara-rules"
930
795
  Description = "This signature detects Adobe PDF files that reference a remote UNC object for the purpose of leaking NTLM hashes."
931
-
932
796
  strings:
933
797
  // we have three regexes here so that we catch all possible orderings but still meet the requirement of all three parts.
934
798
  $badness1 = /\s*\/AA\s*<<\s*\/[OC]\s*<<((\s*\/\D\s*\[[^\]]+\])(\s*\/S\s*\/GoTo[ER])|(\s*\/S\s*\/GoTo[ER])(\s*\/\D\s*\[[^\]]+\]))\s*\/F\s*\((\\\\\\\\[a-z0-9]+\.[^\\]+\\\\[a-z0-9]+|https?:\/\/[^\)]+)\)/ nocase
@@ -939,8 +803,7 @@ rule NTLM_Credential_Theft_via_PDF {
939
803
  }
940
804
 
941
805
 
942
- rule PDF_with_Launch_Action_Function
943
- {
806
+ rule PDF_with_Launch_Action_Function {
944
807
  meta:
945
808
  author = "InQuest Labs"
946
809
  description = "This signature detects the launch function within a PDF file. This function allows the document author to attach an executable file."
@@ -950,7 +813,6 @@ rule PDF_with_Launch_Action_Function
950
813
  labs_reference = "N/A"
951
814
  labs_pivot = "N/A"
952
815
  samples = "a9fbb50dedfd84e1f4a3507d45b1b16baa43123f5ae98dae6aa9a5bebeb956a8"
953
-
954
816
  strings:
955
817
  $pdf_header = "%PDF-"
956
818
  $a = "<</S/Launch/Type/Action/Win<</F"
@@ -959,8 +821,7 @@ rule PDF_with_Launch_Action_Function
959
821
  }
960
822
 
961
823
 
962
- rule PDF_JS_guillemet_close_in_Adobe_Type1_font
963
- {
824
+ rule PDF_JS_guillemet_close_in_Adobe_Type1_font {
964
825
  meta:
965
826
  author = "Michel de Cryptadamus"
966
827
  description = "Found in a PDF that caused a security breach. Exact mechanism unknown but /F means URL, JS is JS, backticks are backticks, and bb is the closing guillemet quote (the one used in PDF docs to close objects). Taken together the sequence is basically shorthand PDF speak for \"close the PDF object prematurely\"."
@@ -970,7 +831,6 @@ rule PDF_JS_guillemet_close_in_Adobe_Type1_font
970
831
  breach_description = "https://cryptadamus.substack.com/p/the-hack-at-the-end-of-the-universe"
971
832
  samples = "61d47fbfe855446d77c7da74b0b3d23dbcee4e4e48065a397bbf09a7988f596e"
972
833
  in_the_wild = true
973
-
974
834
  strings:
975
835
  // "/FJS`\xbb`"
976
836
  $url_js_backtick_close_obj = {2F 46 4A 53 60 BB 60}
@@ -1083,3 +943,864 @@ rule GIFTEDCROOK {
1083
943
  uint32(0) == 0x25504446 and
1084
944
  any of them
1085
945
  }
946
+
947
+
948
+ rule PK_AdobePDF_hse : Adobe {
949
+ meta:
950
+ description = "Phishing Kit impersonating Adobe PDF online"
951
+ licence = "GPL-3.0"
952
+ author = "Thomas 'tAd' Damonneville"
953
+ date = "2021-07-25"
954
+ comment = "Phishing Kit - Adobe PDF Online - 'Hades Silent Exploits'"
955
+ strings:
956
+ // the zipfile working on
957
+ $zip_file = { 50 4b 03 04 }
958
+ // specific directory found in PhishingKit
959
+ $spec_dir = "adobe"
960
+ // specific file found in PhishingKit
961
+ $spec_file = "index.php"
962
+ $spec_file2 = "login.php"
963
+ $spec_file3 = "logg.html"
964
+ condition:
965
+ // look for the ZIP header
966
+ uint32(0) == 0x04034b50 and
967
+ // make sure we have a local file header
968
+ $zip_file and
969
+ $spec_dir and
970
+ // check for file
971
+ all of ($spec_file*)
972
+ }
973
+
974
+
975
+ rule PK_AdobePDF_antenna : Adobe {
976
+ meta:
977
+ description = "Phishing Kit impersonating Adobe PDF Online"
978
+ licence = "AGPL-3.0"
979
+ author = "Thomas 'tAd' Damonneville"
980
+ reference = ""
981
+ date = "2024-04-15"
982
+ comment = "Phishing Kit - Adobe PDF Online - contain antenna.css file"
983
+ strings:
984
+ // the zipfile working on
985
+ $zip_file = { 50 4b 03 04 }
986
+ // specific directory found in PhishingKit
987
+ $spec_dir = "core"
988
+ // specific file found in PhishingKit
989
+ $spec_file = "antenna.css"
990
+ $spec_file2 = "screenshot_23.png"
991
+ $spec_file3 = "fx.js"
992
+ $spec_file4 = "post.php"
993
+ $spec_file5 = "22222222222.png"
994
+ $spec_file6 = "gh-adobe-impersonation-scam-loginwindow.png"
995
+ condition:
996
+ // look for the ZIP header
997
+ uint32(0) == 0x04034b50 and
998
+ // make sure we have a local file header
999
+ $zip_file and
1000
+ all of ($spec_dir*) and
1001
+ // check for file
1002
+ all of ($spec_file*)
1003
+ }
1004
+
1005
+
1006
+ rule PK_AdobePDF_dotloop : Adobe {
1007
+ meta:
1008
+ description = "Phishing Kit impersonating Adobe PDF Online"
1009
+ licence = "AGPL-3.0"
1010
+ author = "Thomas 'tAd' Damonneville"
1011
+ date = "2024-08-28"
1012
+ comment = "Phishing Kit - Adobe PDF Online - 'From: Dotloop'"
1013
+ strings:
1014
+ // the zipfile working on
1015
+ $zip_file = { 50 4b 03 04 }
1016
+ // specific directory found in PhishingKit
1017
+ $spec_dir = "asset"
1018
+ // specific file found in PhishingKit
1019
+ $spec_file = "signin.php"
1020
+ $spec_file2 = "contract.jpg"
1021
+ $spec_file3 = "Microsoft_Edge_logo_(2019).svg.png"
1022
+ $spec_file4 = "KYC-ENG (confidential).pdf"
1023
+ condition:
1024
+ // look for the ZIP header
1025
+ uint32(0) == 0x04034b50 and
1026
+ // make sure we have a local file header
1027
+ $zip_file and
1028
+ all of ($spec_dir*) and
1029
+ // check for file
1030
+ all of ($spec_file*)
1031
+ }
1032
+
1033
+
1034
+ rule APT_NGO_wuaclt_PDF{
1035
+ meta:
1036
+ author = "AlienVault Labs"
1037
+ license = "GPL-2.0"
1038
+ reference = "https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/APT_NGO.yar#L30"
1039
+ strings:
1040
+ $pdf = "%PDF" nocase
1041
+ $comment = {3C 21 2D 2D 0D 0A 63 57 4B 51 6D 5A 6C 61 56 56 56 56 56 56 56 56 56 56 56 56 56 63 77 53 64 63 6A 4B 7A 38 35 6D 37 4A 56 6D 37 4A 46 78 6B 5A 6D 5A 6D 52 44 63 5A 58 41 73 6D 5A 6D 5A 7A 42 4A 31 79 73 2F 4F 0D 0A}
1042
+ condition:
1043
+ $pdf at 0 and $comment in (0..200)
1044
+ }
1045
+
1046
+
1047
+ rule LokiBot_Dropper_ScanCopyPDF_Feb18 {
1048
+ meta:
1049
+ description = "Auto-generated rule - file Scan Copy.pdf.com (https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/crime_loki_bot.yar)"
1050
+ license = "https://creativecommons.org/licenses/by-nc/4.0/"
1051
+ author = "Florian Roth"
1052
+ reference = "https://app.any.run/tasks/401df4d9-098b-4fd0-86e0-7a52ce6ddbf5"
1053
+ date = "2018-02-14"
1054
+ hash1 = "6f8ff26a5daf47effdea5795cdadfff9265c93a0ebca0ce5a4144712f8cab5be"
1055
+ strings:
1056
+ $x1 = "Win32 Scan Copy.pdf " fullword wide
1057
+ $a1 = "C:\\Program Files (x86)\\Microsoft Visual Studio\\VB98\\VB6.OLB" fullword ascii
1058
+ $s1 = "Compiling2.exe" fullword wide
1059
+ $s2 = "Unstalled2" fullword ascii
1060
+ $s3 = "Compiling.exe" fullword wide
1061
+ condition:
1062
+ uint16(0) == 0x5a4d and filesize < 1000KB and $x1 or
1063
+ ( $a1 and 1 of ($s*) )
1064
+ }
1065
+
1066
+
1067
+ rule Docm_in_PDF {
1068
+ meta:
1069
+ description = "Detects an embedded DOCM in PDF combined with OpenAction"
1070
+ license = "https://creativecommons.org/licenses/by-nc/4.0/"
1071
+ author = "Florian Roth"
1072
+ reference = "Internal Research https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/general_officemacros.yar"
1073
+ date = "2017-05-15"
1074
+ strings:
1075
+ $a1 = /<<\/Names\[\([\w]{1,12}.docm\)/ ascii
1076
+ $a2 = "OpenAction" ascii fullword
1077
+ $a3 = "JavaScript" ascii fullword
1078
+ condition:
1079
+ uint32(0) == 0x46445025 and all of them
1080
+ }
1081
+
1082
+
1083
+ rule HKTL_EmbeddedPDF {
1084
+ meta:
1085
+ description = "Detects Embedded PDFs which can start malicious content (https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/thor-hacktools.yar#L4437)"
1086
+ author = "Tobias Michalski"
1087
+ reference = "https://twitter.com/infosecn1nja/status/1021399595899731968?s=12"
1088
+ date = "2018-07-25"
1089
+ strings:
1090
+ $x1 = "/Type /Action\n /S /JavaScript\n /JS (this.exportDataObject({" fullword ascii
1091
+ $s1 = "(This PDF document embeds file" fullword ascii
1092
+ $s2 = "/Names << /EmbeddedFiles << /Names" fullword ascii
1093
+ $s3 = "/Type /EmbeddedFile" fullword ascii
1094
+ condition:
1095
+ uint16(0) == 0x5025 and
1096
+ 2 of ($s*) and $x1
1097
+ }
1098
+
1099
+
1100
+ rule suspicious_js {
1101
+ meta:
1102
+ severity = 6
1103
+ type = "pdf"
1104
+ author = "Glenn Edwards (@hiddenillusion)"
1105
+ version = "0.1"
1106
+ weight = 3
1107
+ description = "possible exploit"
1108
+ reference = "https://github.com/a232319779/mmpi/blob/master/mmpi/data/yara/pdf/pdf.yara"
1109
+ strings:
1110
+ $magic = { 25 50 44 46 }
1111
+ $attrib0 = /\/OpenAction /
1112
+ $attrib1 = /\/JavaScript /
1113
+ $js0 = "eval"
1114
+ $js1 = "Array"
1115
+ $js2 = "String.fromCharCode"
1116
+ condition:
1117
+ $magic at 0 and all of ($attrib*) and 2 of ($js*)
1118
+ }
1119
+
1120
+
1121
+ rule possible_exploit {
1122
+ meta:
1123
+ severity = 9
1124
+ type = "pdf"
1125
+ author = "Glenn Edwards (@hiddenillusion)"
1126
+ version = "0.1"
1127
+ weight = 3
1128
+ url = "https://github.com/hiddenillusion/AnalyzePDF/blob/master/pdf_rules.yara"
1129
+ description = "possible exploit"
1130
+ reference = "https://github.com/a232319779/mmpi/blob/master/mmpi/data/yara/pdf/pdf.yara"
1131
+ strings:
1132
+ $magic = { 25 50 44 46 }
1133
+
1134
+ $attrib0 = /\/JavaScript /
1135
+ $attrib3 = /\/ASCIIHexDecode/
1136
+ $attrib4 = /\/ASCII85Decode/
1137
+
1138
+ $action0 = /\/Action/
1139
+ $action1 = "Array"
1140
+ $shell = "A"
1141
+ $cond0 = "unescape"
1142
+ $cond1 = "String.fromCharCode"
1143
+
1144
+ $nop = "%u9090%u9090"
1145
+ condition:
1146
+ $magic at 0 and (2 of ($attrib*)) or ($action0 and #shell > 10 and 1 of ($cond*)) or ($action1 and $cond0 and $nop)
1147
+ }
1148
+
1149
+
1150
+ rule Detect_JavaScript {
1151
+ meta:
1152
+ description = "Detects embedded JavaScript in PDF files"
1153
+ type = "JavaScript"
1154
+ strings:
1155
+ $js1 = /\/JavaScript/i
1156
+ $js2 = /\/JS/i
1157
+ $js3 = /\/AA\s*<<\s*\/O\s*<<\s*\/S\s*\/JavaScript\s*\/JS\s*\(/i
1158
+ $js4 = /app\.alert/i
1159
+ $js5 = /this\.execute/i
1160
+ $js6 = /this\.print/i
1161
+ $js7 = /this\.saveAs/i
1162
+ $js8 = /util\.printd/i
1163
+ $js9 = /app\.setTimeOut/i
1164
+ $js10 = /event\.target/i
1165
+ condition:
1166
+ $js1 or $js2 or $js3 or $js4 or $js5 or $js6 or $js7 or $js8 or $js9 or $js10
1167
+ }
1168
+
1169
+
1170
+ rule Detect_Launch_Action {
1171
+ meta:
1172
+ description = "Detects Launch actions in PDF files"
1173
+ type = "Launch"
1174
+ strings:
1175
+ $launch1 = /\/Launch/i
1176
+ $launch2 = /\/Action\s*>>\s*\/Type\s*\/Action/i
1177
+ $launch3 = /\/S\s*\/Launch/i
1178
+ $launch4 = /\/Launch\s*<<\s*\/S\s*\/Launch/i
1179
+ $launch5 = /\/Launch\s*<<\s*\/F\s*<<\s*\/S\s*\/Launch/i
1180
+ $launch6 = /\/Launch\s*\/F\s*\(/i
1181
+ $launch7 = /\/Launch\s*<<\s*\/F\s*\(/i
1182
+ $launch8 = /\/Launch\s*<<\s*\/Win\s*\(/i
1183
+ $launch9 = /\/Launch\s*<<\s*\/Mac\s*\(/i
1184
+ $launch10 = /\/Launch\s*\/Win\s*\(/i
1185
+ condition:
1186
+ $launch1 or $launch2 or $launch3 or $launch4 or $launch5 or $launch6 or $launch7 or $launch8 or $launch9 or $launch10
1187
+ }
1188
+
1189
+
1190
+ rule Detect_OpenAction {
1191
+ meta:
1192
+ description = "Detects OpenAction in PDF files"
1193
+ type = "OpenAction"
1194
+ strings:
1195
+ $openAction1 = /\/OpenAction/i
1196
+ $openAction2 = /\/AA/i
1197
+ $openAction3 = /\/OpenAfterSave/i
1198
+ $openAction4 = /\/OpenDocument/i
1199
+ $openAction5 = /\/Open/i
1200
+ $openAction6 = /\/O\s*<<\s*\/S\s*\/JavaScript\s*\/JS\s*\(/i
1201
+ $openAction7 = /\/O\s*<<\s*\/S\s*\/JavaScript\s*\/JS/i
1202
+ $openAction8 = /\/O\s*<<\s*\/JS\s*\(/i
1203
+ $openAction9 = /\/O\s*<<\s*\/JS/i
1204
+ $openAction10 = /\/Open\s*<<\s*\/JavaScript\s*\/JS\s*\(/i
1205
+ condition:
1206
+ $openAction1 or $openAction2 or $openAction3 or $openAction4 or $openAction5 or $openAction6 or $openAction7 or $openAction8 or $openAction9 or $openAction10
1207
+ }
1208
+
1209
+
1210
+ rule Detect_Embedded_Files {
1211
+ meta:
1212
+ description = "Detects embedded files in PDF files"
1213
+ type = "EmbeddedFile"
1214
+ strings:
1215
+ $embed1 = /\/EmbeddedFile/i
1216
+ $embed2 = /\/FileAttachment/i
1217
+ $embed3 = /\/Type\s*\/EmbeddedFile/i
1218
+ $embed4 = /\/EF\s*<<\s*\/F\s*<<\s*\/Type\s*\/EmbeddedFile/i
1219
+ $embed5 = /\/EmbeddedFile\s*<<\s*\/Type\s*\/EmbeddedFile/i
1220
+ $embed6 = /\/Filespec\s*<<\s*\/EF\s*<<\s*\/F\s*<<\s*\/Type\s*\/EmbeddedFile/i
1221
+ $embed7 = /\/EmbeddedFile\s*\/Filespec/i
1222
+ $embed8 = /\/EmbeddedFile\s*\/Names/i
1223
+ $embed9 = /\/EmbeddedFile\s*\/Names\s*<<\s*\/Type\s*\/EmbeddedFile/i
1224
+ $embed10 = /\/EmbeddedFile\s*\/Names\s*<<\s*\/Type\s*\/EmbeddedFile\s*\/Filespec/i
1225
+ condition:
1226
+ $embed1 or $embed2 or $embed3 or $embed4 or $embed5 or $embed6 or $embed7 or $embed8 or $embed9 or $embed10
1227
+ }
1228
+
1229
+
1230
+ rule Detect_Shellcode {
1231
+ meta:
1232
+ description = "Detects suspicious shellcode patterns in PDF files"
1233
+ type = "Shellcode"
1234
+ strings:
1235
+ $shellcode1 = { 6a 60 68 63 61 6c 63 54 59 66 83 e9 ff 33 d2 64 8b 52 30 8b 52 0c 8b 52 14 8b 72 28 }
1236
+ $shellcode2 = { 31 c0 50 68 2e 65 78 65 68 63 61 6c 63 8b dc 88 04 24 50 53 51 52 83 ec 04 }
1237
+ $shellcode3 = { 50 51 52 56 57 53 89 e5 83 e4 f0 31 c0 64 8b 40 30 8b 40 0c 8b 70 1c ad 8b 40 08 }
1238
+ $shellcode4 = { 89 e5 81 ec a0 00 00 00 31 c0 50 50 50 50 40 89 e1 50 89 e2 57 51 52 50 83 ec 04 }
1239
+ $shellcode5 = { 31 c0 50 68 2e 64 61 74 61 68 5c 64 61 74 61 68 63 61 6c 63 89 e3 8b 53 3c }
1240
+ $shellcode6 = { 31 d2 52 68 78 2e 74 78 68 2e 64 61 74 68 5c 5c 5c 68 2e 5c 5c 5c 68 5c 5c 5c }
1241
+ $shellcode7 = { 68 5c 61 5c 61 5c 61 68 74 2e 74 78 68 2e 64 61 74 68 5c 5c 5c 68 2e 5c 5c 5c }
1242
+ $shellcode8 = { 68 5c 61 5c 61 5c 61 68 78 2e 74 78 68 2e 64 61 74 68 5c 5c 5c 68 2e 5c 5c 5c }
1243
+ $shellcode9 = { 68 61 5c 61 5c 68 61 5c 68 74 2e 78 68 2e 61 74 68 5c 5c 68 2e 5c 68 5c 5c }
1244
+ $shellcode10 = { 68 61 5c 61 5c 61 68 74 2e 74 68 2e 64 68 5c 5c 5c 68 2e 5c 5c 68 5c 5c 68 }
1245
+ condition:
1246
+ $shellcode1 or $shellcode2 or $shellcode3 or $shellcode4 or $shellcode5 or $shellcode6 or $shellcode7 or $shellcode8 or $shellcode9 or $shellcode10
1247
+ }
1248
+
1249
+
1250
+ rule Detect_URLs {
1251
+ meta:
1252
+ description = "Detects suspicious URLs in PDF files"
1253
+ type = "URL"
1254
+ strings:
1255
+ $url1 = /ftp:\/\/[^\s]+/ nocase
1256
+ $url2 = /file:\/\/[^\s]+/ nocase
1257
+ $url3 = /:\/\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ nocase
1258
+ condition:
1259
+ $url1 or $url2 or $url3
1260
+ }
1261
+
1262
+
1263
+ rule Detect_PDF_Embedded_Files {
1264
+ meta:
1265
+ atk_type = "Macro"
1266
+ description = "Detects embedded files in PDF files"
1267
+ author = "groommang"
1268
+ date = "2024-06-25"
1269
+ strings:
1270
+ $pdf_header = {25 50 44 46}
1271
+ $embedded_file = /EmbeddedFile/
1272
+ condition:
1273
+ $pdf_header at 0 and $embedded_file
1274
+ }
1275
+
1276
+
1277
+ rule Detect_PDF_Suspicious_AcroForms {
1278
+ meta:
1279
+ atk_type = "Macro"
1280
+ description = "Detects suspicious AcroForms in PDF files"
1281
+ author = "groommang"
1282
+ date = "2024-06-25"
1283
+ strings:
1284
+ $pdf_header = {25 50 44 46}
1285
+ $acroform = /AcroForm/
1286
+ condition:
1287
+ $pdf_header at 0 and $acroform
1288
+ }
1289
+
1290
+
1291
+ rule oAuth_Phishing_PDF {
1292
+ meta:
1293
+ id = "789YmThaTvLDaE1V2Oqx7q"
1294
+ fingerprint = "c367bca866de0b066e291b4e45216cbb68cc23297b002a29ca3c8d640a7db78e"
1295
+ version = "1.0"
1296
+ creation_date = "2022-01-01"
1297
+ first_imported = "2022-02-03"
1298
+ last_modified = "2022-02-03"
1299
+ status = "RELEASED"
1300
+ sharing = "TLP:WHITE"
1301
+ source = "BARTBLAZE"
1302
+ author = "@bartblaze"
1303
+ description = "Identifies potential phishing PDFs that target oAuth."
1304
+ category = "MALWARE"
1305
+ reference = "https://twitter.com/ffforward/status/1484127442679836676"
1306
+ strings:
1307
+ $pdf = {25504446} //%PDF
1308
+ $s1 = "/URI (https://login.microsoftonline.com/common/oauth2/" ascii wide nocase
1309
+ $s2 = "/URI (https://login.microsoftonline.com/consumers/oauth2" ascii wide nocase
1310
+ $s3 = "/URI (https://accounts.google.com/o/oauth2" ascii wide nocase
1311
+ condition:
1312
+ $pdf at 0 and any of ($s*)
1313
+ }
1314
+
1315
+
1316
+ rule Adobe_XMP_Identifier {
1317
+ meta:
1318
+ author = "InQuest Labs"
1319
+ description = "This signature identifies Adobe Extensible Metadata Platform (XMP) identifiers embedded within files. Defined as a standard for mapping graphical asset relationships, XMP allows for tracking of both parent-child relationships and individual revisions. There are three categories of identifiers: original document, document, and instance. Generally, XMP data is stored in XML format, updated on save/copy, and embedded within the graphical asset. These identifiers can be used to track both malicious and benign graphics within common Microsoft and Adobe document lures."
1320
+ created_date = "2022-03-15"
1321
+ updated_date = "2022-03-15"
1322
+ blog_reference = "http://wwwimages.adobe.com/content/dam/acom/en/products/xmp/Pdfs/XMPAssetRelationships.pdf"
1323
+ labs_reference = "https://labs.inquest.net/dfi/sha256/1030710f6f18950f01b1a55d50a5169717e48567aa13a0a769f5451423280b4d"
1324
+ labs_pivot = "https://labs.inquest.net/dfi/search/ioc/xmpid/xmp.did%3AEDC9411A6A5F11E2838BB9184F90E845##eyJyZXN1bHRzIjpbIn4iLCJmaXJzdFNlZW4iLDEsIiIsW11dfQ=="
1325
+ samples = "1030710f6f18950f01b1a55d50a5169717e48567aa13a0a769f5451423280b4d"
1326
+ strings:
1327
+ $xmp_md5 = /xmp\.[dio]id[-: _][a-f0-9]{32}/ nocase ascii wide
1328
+ $xmp_guid = /xmp\.[dio]id[-: _][a-f0-9]{36}/ nocase ascii wide
1329
+ condition:
1330
+ any of them
1331
+ }
1332
+
1333
+
1334
+ rule Generic_Phishing_PDF {
1335
+ meta:
1336
+ atk_type = "Generic_Phishing_PDF"
1337
+ id = "6iE0XEqqhVGNED6Z8xIMr1"
1338
+ fingerprint = "f3f31ec9651ee41552d41dbd6650899d7a33beea46ed1c3329c3bbd023fe128e"
1339
+ version = "1.0"
1340
+ creation_date = "2019-03-01"
1341
+ first_imported = "2021-12-30"
1342
+ last_modified = "2021-12-30"
1343
+ status = "RELEASED"
1344
+ sharing = "TLP:WHITE"
1345
+ source = "BARTBLAZE"
1346
+ author = "@bartblaze"
1347
+ description = "Identifies generic phishing PDFs."
1348
+ category = "MALWARE"
1349
+ reference = "https://bartblaze.blogspot.com/2019/03/analysing-massive-office-365-phishing.html"
1350
+ strings:
1351
+ $pdf = {25504446}
1352
+ $s1 = "<xmp:CreatorTool>RAD PDF</xmp:CreatorTool>"
1353
+ $s2 = "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"DynaPDF"
1354
+ condition:
1355
+ $pdf at 0 and all of ($s*)
1356
+ }
1357
+
1358
+
1359
+ rule Embedded_EXE_Cloaking : maldoc {
1360
+ meta:
1361
+ description = "Detects an embedded executable in a non-executable file"
1362
+ author = "Florian Roth"
1363
+ date = "2015/02/27"
1364
+ score = 80
1365
+ strings:
1366
+ $noex_png = { 89 50 4E 47 }
1367
+ $noex_pdf = { 25 50 44 46 }
1368
+ $noex_rtf = { 7B 5C 72 74 66 31 }
1369
+ $noex_jpg = { FF D8 FF E0 }
1370
+ $noex_gif = { 47 49 46 38 }
1371
+ $mz = { 4D 5A }
1372
+ $a1 = "This program cannot be run in DOS mode"
1373
+ $a2 = "This program must be run under Win32"
1374
+ condition:
1375
+ (
1376
+ ( $noex_png at 0 ) or
1377
+ ( $noex_pdf at 0 ) or
1378
+ ( $noex_rtf at 0 ) or
1379
+ ( $noex_jpg at 0 ) or
1380
+ ( $noex_gif at 0 )
1381
+ )
1382
+ and
1383
+ for any i in (1..#mz): ( @a1 < ( @mz[i] + 200 ) or @a2 < ( @mz[i] + 200 ) )
1384
+ }
1385
+
1386
+
1387
+ rule PDF_EMBEDDED_DOCM {
1388
+ meta:
1389
+ description = "Find pdf files that have an embedded docm with openaction"
1390
+ author = "Brian Carter"
1391
+ last_modified = "May 11, 2017"
1392
+ strings:
1393
+ $magic = { 25 50 44 46 2d }
1394
+ $txt1 = "EmbeddedFile"
1395
+ $txt2 = "docm)"
1396
+ $txt3 = "JavaScript" nocase
1397
+ condition:
1398
+ $magic at 0 and all of ($txt*)
1399
+ }
1400
+
1401
+
1402
+ rule pdf_fake_password {
1403
+ meta:
1404
+ date = "2022-11-23"
1405
+ description = "Detects PDF obfuscated via /Encrypt and /AuthEvent/DocOpen but opens without password"
1406
+ author = "Paul Melson @pmelson"
1407
+ hash = "0e182afae5301ac3097ae3955aa8c894ec3a635acbec427d399ccc4aac3be3d6"
1408
+ strings:
1409
+ $docopen = "<</CF<</StdCF<</AuthEvent/DocOpen/" ascii
1410
+ $ownerpass = /\/Filter\/Standard\/Length (40|128|256)\/O\(/
1411
+ $userpass = "/StmF/StdCF/StrF/StdCF/U(" ascii
1412
+ $perms = { 2f 50 65 72 6d 73 28 5b 07 ec 96 e8 68 ef 35 2e 75 02 16 0f 5c 5c 22 d1 29 }
1413
+ condition:
1414
+ uint32(0) == 0x46445025 and
1415
+ all of them
1416
+ }
1417
+
1418
+
1419
+ rule pdf_mal_script {
1420
+ strings:
1421
+ $magic = { 25 50 44 46 }
1422
+ $action0 = "<</S/Launch/Type/Action/Win<<" nocase ascii
1423
+ $action1 = "/Type/Action>>" nocase ascii
1424
+ $action2 = "/OpenAction" nocase ascii
1425
+ $action3 = "<< /Type /Action" nocase ascii
1426
+ $action4 = "/Type /Action" nocase ascii
1427
+ $uri = "/S /URI /Type /Action /URI"
1428
+ $launch = "/S /Launch /Win" nocase ascii
1429
+ $cmd = "(cmd.exe)" nocase ascii
1430
+ $ps = "powershell" nocase ascii
1431
+ $pscom0 = "DownloadFile" nocase ascii
1432
+ $pscom1 = "payload" nocase ascii
1433
+ $homepath = "%HOMEPATH%" nocase ascii
1434
+ $start0 = "start" nocase ascii
1435
+ $start1 = "startxref" nocase ascii
1436
+ $js0 = "<</S/JavaScript/JS" nocase ascii
1437
+ $js1 = /\/JS \([^)]+?\\/
1438
+ $js2 = "/JavaScript" nocase ascii
1439
+ $emb0 = "/EmbeddedFiles" nocase ascii
1440
+ $emb1 = "/EmbeddedFile" nocase ascii
1441
+ $url0 = "https://shapeupfitnessdkk-my.sharepoint.com/:b:/g/personal/michelle_shapeupfitness_dk/Ebd2GDh2N8JErL23JmMNmw8BQA7JVpGiS_C6TGkERpma4A?e=xBbtrV"
1442
+ $url1 = "https://ipfs.io/ipfs/QmSyYCjyTMyo1dM2dWBY6ExTmodmU1oSBWTdmEDTLrEenC#http://www.booking.com/"
1443
+ $url2 = "https://romacul.com.br/workshop/wp-content/mail.outlookoffice365.com.html"
1444
+ $url3 = "https://www.hitplus.fr/2018/click.php?url=https://cutt.ly/seU8MT6t#F8i_bfW"
1445
+ $url4 = "https://etehadshipping.com/"
1446
+ $url5 = "https://afarm.net/"
1447
+ $url6 = "https://portals.checkfedexexp.com"
1448
+ $url7 = "https://otcworldmedia.com"
1449
+ $url8 = "http://tiny.cc/"
1450
+ $url9 = "http://128.199.7.40/"
1451
+ $invoc = "%%Invocation:" nocase ascii
1452
+ $op0 = "-sOutputFile=" nocase ascii
1453
+ $op1 = "-dNumRenderingThreads=" nocase ascii
1454
+ $op2 = "-sDEVICE=" nocase ascii
1455
+ $op3 = "-dAutoRotatePages=" nocase ascii
1456
+ $script0 = "<script" nocase ascii
1457
+ $script1 = "</script>" nocase ascii
1458
+ $tag0 = "<event" nocase ascii
1459
+ $tag1 = "</event>" nocase ascii
1460
+ $event0 = "event.target.exportXFAData" nocase ascii
1461
+ $event1 = "activity=" nocase ascii
1462
+ condition:
1463
+ ($magic at 0 and (8 of them)) or
1464
+ ($magic at 0 and ($action0 or $action1 or $action2) and ($cmd or $ps) or ($pscom0 or $pscom1) and ($start0 or $start1) and $launch and $homepath and $js0) or
1465
+ ($magic at 0 and ($action2 or $action3) and (1 of ($emb*))) or
1466
+ ($magic at 0 and ( 1 of($url*))) or
1467
+ ($magic at 0 and $action4 and ($js1 or $js2)) or
1468
+ ($magic at 0 and $invoc and (2 of ($op*))) or
1469
+ ($magic at 0 and $uri) or
1470
+ ($magic at 0 and (2 of ($script*)) and ((2 of($event*)) and (2 of ($tag*))))
1471
+ }
1472
+
1473
+
1474
+ rule IconMismatch_PE_PDF {
1475
+ meta:
1476
+ description = "Icon mismatch: PE executable with PDF icons"
1477
+ author = "albertzsigovits"
1478
+ condition:
1479
+ uint16(0) == 0x5A4D
1480
+ and uint32(uint32(0x3C)) == 0x00004550
1481
+ and (
1482
+ hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "0da488a59ce7c34b5362e2c3e900ebaa48c2fa182c183166d290c0c6f10f97c1" // PDF red icon #1
1483
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "42cb714195c0255523313f41629c9d6a123d93f9789f8a8764e52cad405ea199" // PDF red icon #2
1484
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "56cc2dea455f34271b031b51ff2b439a8a8083f4848b5308d4b42c827ba22c1f" // PDF red icon #3
1485
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "683370eb202be9c57e6fe038e4a234c7a4e1f353dfbfe64d8f33397a5a0f0e81" // PDF red icon #4
1486
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "68f1550f74d5cf2a52f1cf3780037facf60a6254e133fcc503a12e1ea5106184" // PDF red icon #5
1487
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "9f12f3b8937665385f43f28caab2ded4469cefbec166d83e57d70e5a7b380067" // PDF red icon #6
1488
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "a27b7e5c64c784418daa27bebb7ffcedbc919649d1a5b6446cd8c02516ba6da6" // PDF red icon #7
1489
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "f7e6bb934282eae0225f37b2d05e81c7bfa95acbf11d1eb9c9662ed3accf5708" // PDF red icon #8
1490
+ )
1491
+ }
1492
+
1493
+
1494
+ rule PDF_Exploit_Enhanced {
1495
+ meta:
1496
+ description = "Detects common PDF exploits and embedded malware test files"
1497
+ strings:
1498
+ $aa = "/OpenAction"
1499
+ $acroform = "/AcroForm"
1500
+ $embedded_file = "/EmbeddedFile"
1501
+ $js = "/JS"
1502
+ $javascript = "/JavaScript"
1503
+ $launch = "/Launch"
1504
+ $eicar_pdf = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" nocase
1505
+ condition:
1506
+ (any of ($js, $javascript, $aa, $acroform, $embedded_file, $launch) or $eicar_pdf)
1507
+ }
1508
+
1509
+
1510
+ rule SPICA__Strings {
1511
+ meta:
1512
+ author = "Google TAG"
1513
+ date = "2024-01-15"
1514
+ description = "Rust backdoor using websockets for c2 and embedded decoy PDF"
1515
+ hash = "37c52481711631a5c73a6341bd8bea302ad57f02199db7624b580058547fb5a9"
1516
+ strings:
1517
+ $s1 = "os_win.c:%d: (%lu) %s(%s) - %s"
1518
+ $s2 = "winWrite1"
1519
+ $s3 = "winWrite2"
1520
+ $s4 = "DNS resolution panicked"
1521
+ $s5 = "struct Dox"
1522
+ $s6 = "struct Telegram"
1523
+ $s8 = "struct Download"
1524
+ $s9 = "spica"
1525
+ $s10 = "Failed to open the subkey after setting the value."
1526
+ $s11 = "Card Holder: Bull Gayts"
1527
+ $s12 = "Card Number: 7/ 3310 0195 4865"
1528
+ $s13 = "CVV: 592"
1529
+ $s14 = "Card Expired: 03/28"
1530
+
1531
+ $a0 = "agent\\src\\archive.rs"
1532
+ $a1 = "agent\\src\\main.rs"
1533
+ $a2 = "agent\\src\\utils.rs"
1534
+ $a3 = "agent\\src\\command\\dox.rs"
1535
+ $a4 = "agent\\src\\command\\shell.rs"
1536
+ $a5 = "agent\\src\\command\\telegram.rs"
1537
+ $a6 = "agent\\src\\command\\mod.rs"
1538
+ $a7 = "agent\\src\\command\\mod.rs"
1539
+ $a8 = "agent\\src\\command\\cookie\\mod.rs"
1540
+ $a9 = "agent\\src\\command\\cookie\\browser\\mod.rs"
1541
+ $a10 = "agent\\src\\command\\cookie\\browser\\browser_name.rs"
1542
+ condition:
1543
+ 7 of ($s*) or 5 of ($a*)
1544
+ }
1545
+
1546
+
1547
+ rule G_Backdoor_TOUGHPROGRESS_LNK_1 {
1548
+ meta:
1549
+ author = "GTIG"
1550
+ date_created = "2025-04-29"
1551
+ date_modified = "2025-04-29"
1552
+ md5 = "65da1a9026cf171a5a7779bc5ee45fb1"
1553
+ rev = 1
1554
+ strings:
1555
+ $marker = { 4C 00 00 00 }
1556
+ $str1 = "rundll32.exe" ascii wide
1557
+ $str2 = ".\\image\\7.jpg,plus" wide
1558
+ $str3 = "%PDF-1"
1559
+ $str4 = "PYL="
1560
+ condition:
1561
+ $marker at 0 and all of them
1562
+ }
1563
+
1564
+
1565
+ rule LNK_Dropper_Russian_APT_Feb2024 {
1566
+ meta:
1567
+ Description = "Detects LNK dropper samples used by a Russian APT during a past campaign"
1568
+ Author = "RustyNoob619"
1569
+ Reference = "https://blog.cluster25.duskrise.com/2024/01/30/russian-apt-opposition"
1570
+ Hash = "114935488cc5f5d1664dbc4c305d97a7d356b0f6d823e282978792045f1c7ddb"
1571
+ SampleTesting = "Matches all five LNK Dropper Samples from the Blog"
1572
+ strings:
1573
+ $lnk = { 4C 00 00 00 01 14 02 00 }
1574
+ $pwrsh1 = "powershell.exe"
1575
+ $pwrsh2 = "WindowsPowerShell"
1576
+ $pwrsh3 = "powershell"
1577
+ $cmd = "cmd.exe"
1578
+ $ext1 = ".pdf.lnk"
1579
+ $ext2 = ".pdfx.lnk"
1580
+ $ext3 = "pdf.lnk" base64
1581
+ $scrpt1 = "Select-String -pattern \"JEVycm9yQWN0aW9uUH\" "
1582
+ $scrpt2 = "findstr /R 'JVBERi0xLjcNJeLjz9'" base64
1583
+ $blob1 = "$ErrorActionPreference = \"Continue\"" base64
1584
+ $blob2 = "$ProgressPreference = \"SilentlyContinue\"" base64
1585
+ $blob3 = "New-Alias -name pwn -Value iex -Force" base64
1586
+ $blob4 = "if ($pwd.path.toLower() -ne \"c:\\windows\\system32\")" base64
1587
+ $blob5 = "Copy-Item $env:tmp\\Temp.jpg $env:userprofile\\Temp.jpg" base64
1588
+ $blob6 = "attrib +h $env:userprofile\\Temp.jpg" base64
1589
+ $blob7 = "Start-Process $env:tmp\\Important.pdf" base64
1590
+ $net1 = "$userAgent = \"Mozilla/6.4 (Windows NT 11.1) Gecko/2010102 Firefox/99.0\"" base64
1591
+ $net2 = "$redirectors = \"6" base64
1592
+ $net3 = "$sleeps = 5" base64
1593
+ $http1 = "$request.Headers[\"X-Request-ID\"] = $request_token" base64
1594
+ $http2 = "$request.ContentType = \"application/x-www-form-urlencoded\"" base64
1595
+ $http3 = "$response1 = $(Send-HttpRequest \"$server/api/v1/Client/Info\" \"POST\" \"Info: $getenv64\")" base64
1596
+ $http4 = "$response = $($token = Send-HttpRequest \"$server/api/v1/Client/Token\" \"GET\")" base64
1597
+ $server1 = "$server = \"api-gate.xyz\"" base64
1598
+ $server2 = "$server = \"pdf-online.top\"" base64
1599
+ $unknown = "$server = " base64
1600
+ condition:
1601
+ $lnk at 0 //LNK File Header
1602
+ and (any of ($pwrsh*) or $cmd) //searches for CMD or PowerShell execution
1603
+ and any of ($ext*) //Fake Double Extension mimicing a PDF
1604
+ and any of ($scrpt*) //Searches for a unique string to locate execution code
1605
+ and 5 of ($blob*) //Base64 encoded execution blob
1606
+ and 2 of ($net*)
1607
+ and 3 of ($http*)
1608
+ and (any of ($server*) or $unknown) // C2 dommain config (Optional, can be removed)
1609
+ }
1610
+
1611
+
1612
+ private rule PDF_Structure
1613
+ {
1614
+ meta:
1615
+ description = "Detects valid, readable PDF files"
1616
+ reference_files = "minimal.pdf (4a6f4ff8596321eea6fa482e7adbed01)"
1617
+ author = "ThreatFlux"
1618
+ date = "2024-12-31"
1619
+ version = "1.1"
1620
+ file_type = "PDF"
1621
+ strings:
1622
+ $header = "%PDF-"
1623
+ $eof_marker = "%%EOF"
1624
+ $startxref = "startxref"
1625
+ $xref = "xref"
1626
+ $trailer = "trailer"
1627
+ condition:
1628
+ // Header validation
1629
+ $header at 0 and
1630
+ uint8(5) >= 0x31 and // Major version >= 1
1631
+ uint8(5) <= 0x37 and // Major version <= 7
1632
+ uint8(7) == 0x2E and // Decimal point
1633
+ uint8(8) >= 0x30 and // Minor version >= 0
1634
+ uint8(8) <= 0x37 and // Minor version <= 7
1635
+ // Basic structure requirements
1636
+ filesize > 32 and // Minimum size for valid PDF
1637
+ $eof_marker in (filesize-10..filesize) and // EOF marker near end
1638
+ // Required PDF elements
1639
+ $xref and // Must have cross-reference table
1640
+ $trailer and // Must have trailer
1641
+ $startxref and // Must have startxref pointer
1642
+ // Basic binary check
1643
+ uint8(1) == 0x50 and // 'P'
1644
+ uint8(2) == 0x44 and // 'D'
1645
+ uint8(3) == 0x46 // 'F'
1646
+ }
1647
+
1648
+
1649
+ rule DETECT_CommandShell_PDF_Execution
1650
+ {
1651
+ meta:
1652
+ description = "Detects Windows Command Shell execution artifacts in PDF files"
1653
+ author = "ThreatFlux"
1654
+ date = "2024-01-03"
1655
+ version = "2.1"
1656
+ // Classification
1657
+ threat_level = "Medium"
1658
+ category = "SUSPICIOUS_BEHAVIOR"
1659
+ malware_type = "PDF.CommandExecution"
1660
+ tlp = "WHITE"
1661
+ // MITRE ATT&CK Mapping
1662
+ mitre_attack = "T1059.003" // Windows Command Shell
1663
+ mitre_techniques = "T1204.002" // User Execution: Malicious File
1664
+ mitre_tactics = "Execution"
1665
+ // Detection Details
1666
+ detection_name = "PDF.Suspicious.CommandExecution"
1667
+ detection_rate = "Medium-High"
1668
+ false_positive_rate = "Medium"
1669
+ bypass_attempts = "String obfuscation, encoding variations"
1670
+ // File Characteristics
1671
+ file_type = "PDF"
1672
+ min_size = "1KB"
1673
+ max_size = "10MB"
1674
+ // References
1675
+ ref1 = "https://attack.mitre.org/techniques/T1059/003/"
1676
+ ref2 = "https://attack.mitre.org/techniques/T1204/002/"
1677
+ // Sample Metadata
1678
+ sample_hash1 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
1679
+ strings:
1680
+ // Command Shell Artifacts
1681
+ $cmd1 = "cmd.exe" nocase ascii
1682
+ $cmd2 = "cmd /c" nocase ascii
1683
+ $cmd3 = "cmd /k" nocase ascii
1684
+ $cmd4 = "%comspec%" nocase ascii
1685
+
1686
+ // Suspicious PDF Elements
1687
+ $suspc1 = "/JavaScript" ascii
1688
+ $suspc2 = "/OpenAction" ascii
1689
+ $suspc3 = "/Launch" ascii
1690
+ condition:
1691
+ PDF_Structure and
1692
+ (
1693
+ // Command Shell Reference
1694
+ any of ($cmd*) and
1695
+ // Supporting Suspicious Elements
1696
+ any of ($suspc*)
1697
+ )
1698
+ }
1699
+
1700
+
1701
+ rule apt_MuddyWater_malicious_pdf {
1702
+ meta:
1703
+ id = "77983aea-47cb-4436-b773-faf7be430339"
1704
+ version = "1.0"
1705
+ intrusion_set = "MuddyWater"
1706
+ description = "Detects malicious PDF used by MuddyWater"
1707
+ source = "Sekoia.io"
1708
+ creation_date = "2024-06-10"
1709
+ classification = "TLP:WHITE"
1710
+ strings:
1711
+ $ = "egnyte.com/fl/"
1712
+ $ = "/Type/Pages/Count 1"
1713
+ condition:
1714
+ uint32be(0) == 0x25504446 and
1715
+ filesize < 300KB and
1716
+ all of them
1717
+ }
1718
+
1719
+
1720
+ rule Bad_PDF {
1721
+ meta:
1722
+ description = "Detection patterns for the tool 'Bad-PDF' taken from the ThreatHunting-Keywords github project"
1723
+ author = "@mthcht"
1724
+ reference = "https://github.com/mthcht/ThreatHunting-Keywords"
1725
+ tool = "Bad-PDF"
1726
+ rule_category = "offensive_tool_keyword"
1727
+ strings:
1728
+ // Description: Bad-PDF create malicious PDF file to steal NTLM(NTLMv1/NTLMv2) Hashes from windows machines. it utilize vulnerability disclosed by checkpoint team to create the malicious PDF file. Bad-Pdf reads the NTLM hashes using Responder listener.
1729
+ // Reference: https://github.com/deepzec/Bad-Pdf
1730
+ $string1 = "Bad-Pdf" nocase ascii wide
1731
+ condition:
1732
+ any of them
1733
+ }
1734
+
1735
+
1736
+ rule DetectMaliciousScriptInPDF {
1737
+ meta:
1738
+ description = "Detects a PDF containing the text 'malicious_script'"
1739
+ author = "Kasthuri"
1740
+ date = "2024-09-28"
1741
+ strings:
1742
+ $eval = "eval("
1743
+ $js_function = "function("
1744
+ $malicious_js = "document.write(unescape("
1745
+ condition:
1746
+ $js_function or $eval or $malicious_js
1747
+ }
1748
+
1749
+
1750
+ rule DetectMaliciousURLs {
1751
+ meta:
1752
+ description = "Detects potentially malicious URLs in a PDF"
1753
+ author = "Kasthuri"
1754
+ date = "2024-09-28"
1755
+ strings:
1756
+ $phishing_url = /example\.com.*example\.com|example\.com.*secure|paypal\.com.*login/
1757
+ $url_shortener = /bit\.ly|tinyurl\.com|goo\.gl/
1758
+ $suspicious_extension = /\.exe|\.php\.exe|\.js\.exe/
1759
+ $redirect_chain = /redirect\?url=/
1760
+ $suspicious_path = /admin|config|login|wp-admin/
1761
+ // $obfuscated_url = /%[0-9A-Fa-f]{2}/
1762
+ // $base64_encoded_url = /[a-zA-Z0-9+\/=]{20,}/
1763
+ condition:
1764
+ $phishing_url
1765
+ or $url_shortener
1766
+ or $suspicious_extension
1767
+ or $redirect_chain
1768
+ or $suspicious_path
1769
+ // or $obfuscated_url
1770
+ // or $base64_encoded_url
1771
+ }
1772
+
1773
+
1774
+ rule MAL_DarkCloud_Phishing_PDF_IOC {
1775
+ meta:
1776
+ description = "Detects a specific malicious PDF file used in DarkCloud Stealer phishing campaigns based on its SHA256 hash."
1777
+ date = "2025-07-24"
1778
+ version = 1
1779
+ reference = "https://unit42.paloaltonetworks.com/darkcloud-stealer-and-obfuscated-autoit-scripting/"
1780
+ hash = "bf3b43f5e4398ac810f005200519e096349b2237587d920d3c9b83525bb6bafc"
1781
+ tags = "CRIME, INFOSTEALER, DARKCLOUD, FILE"
1782
+ mitre_attack = "T1566.001"
1783
+ malware_family = "DarkCloud"
1784
+ malware_type = "Infostealer"
1785
+ condition:
1786
+ // Match the specific SHA256 hash of the malicious PDF file.
1787
+ hash.sha256(0, filesize) == "bf3b43f5e4398ac810f005200519e096349b2237587d920d3c9b83525bb6bafc"
1788
+ }
1789
+
1790
+
1791
+ rule PDF_Javascript_Exploit {
1792
+ meta:
1793
+ description = "Detect potentially malicious PDF with JavaScript"
1794
+ author = "Cyberion Security"
1795
+ date = "2025-01-01"
1796
+ severity = "medium"
1797
+ category = "pdf"
1798
+ strings:
1799
+ $pdf = "%PDF"
1800
+ $js1 = "/JavaScript" nocase
1801
+ $js2 = "/JS" nocase
1802
+ $js3 = "eval(" nocase
1803
+ $js4 = "unescape(" nocase
1804
+ condition:
1805
+ $pdf at 0 and (1 of ($js*))
1806
+ }