pdfalyzer 1.16.6__py3-none-any.whl → 1.16.8__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,16 +34,15 @@ rule Cobaltgang_PDF_Metadata_Rev_A
33
34
  }
34
35
 
35
36
 
36
- rule PDF_Embedded_Exe : PDF
37
- {
38
- meta:
39
- ref = "https://github.com/jacobsoo/Yara-Rules/blob/master/PDF_Embedded_Exe.yar"
40
- strings:
41
- $header = {25 50 44 46}
42
- $Launch_Action = {3C 3C 2F 53 2F 4C 61 75 6E 63 68 2F 54 79 70 65 2F 41 63 74 69 6F 6E 2F 57 69 6E 3C 3C 2F 46}
37
+ rule PDF_Embedded_Exe : PDF {
38
+ meta:
39
+ ref = "https://github.com/jacobsoo/Yara-Rules/blob/master/PDF_Embedded_Exe.yar"
40
+ strings:
41
+ $header = {25 50 44 46}
42
+ $Launch_Action = {3C 3C 2F 53 2F 4C 61 75 6E 63 68 2F 54 79 70 65 2F 41 63 74 69 6F 6E 2F 57 69 6E 3C 3C 2F 46}
43
43
  $exe = {3C 3C 2F 45 6D 62 65 64 64 65 64 46 69 6C 65 73}
44
44
  condition:
45
- $header at 0 and $Launch_Action and $exe
45
+ $header at 0 and $Launch_Action and $exe
46
46
  }
47
47
 
48
48
 
@@ -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,164 +62,127 @@ rule SUSP_Bad_PDF {
63
62
  }
64
63
 
65
64
 
66
- rule malicious_author : PDF
67
- {
68
- meta:
69
- author = "Glenn Edwards (@hiddenillusion)"
70
- version = "0.1"
71
- weight = 5
65
+ rule malicious_author : PDF {
66
+ meta:
67
+ author = "Glenn Edwards (@hiddenillusion)"
68
+ version = "0.1"
69
+ weight = 5
72
70
 
73
- strings:
74
- $magic = { 25 50 44 46 }
75
- $reg0 = /Creator.?\(yen vaw\)/
76
- $reg1 = /Title.?\(who cis\)/
77
- $reg2 = /Author.?\(ser pes\)/
78
- condition:
79
- $magic in (0..1024) and all of ($reg*)
71
+ strings:
72
+ $magic = { 25 50 44 46 }
73
+ $reg0 = /Creator.?\(yen vaw\)/
74
+ $reg1 = /Title.?\(who cis\)/
75
+ $reg2 = /Author.?\(ser pes\)/
76
+ condition:
77
+ $magic in (0..1024) and all of ($reg*)
80
78
  }
81
79
 
82
80
 
83
- rule suspicious_version : PDF
84
- {
85
- meta:
86
- author = "Glenn Edwards (@hiddenillusion)"
87
- version = "0.1"
88
- weight = 3
81
+ rule suspicious_version : PDF {
82
+ meta:
83
+ author = "Glenn Edwards (@hiddenillusion)"
84
+ version = "0.1"
85
+ weight = 3
89
86
 
90
- strings:
91
- $magic = { 25 50 44 46 }
92
- $ver = /%PDF-1.\d{1}/
93
- condition:
94
- $magic in (0..1024) and not $ver
87
+ strings:
88
+ $magic = { 25 50 44 46 }
89
+ $ver = /%PDF-1.\d{1}/
90
+ condition:
91
+ $magic in (0..1024) and not $ver
95
92
  }
96
93
 
97
94
 
98
- rule suspicious_creation : PDF
99
- {
100
- meta:
101
- author = "Glenn Edwards (@hiddenillusion)"
102
- version = "0.1"
103
- weight = 2
95
+ rule suspicious_creation : PDF {
96
+ meta:
97
+ author = "Glenn Edwards (@hiddenillusion)"
98
+ version = "0.1"
99
+ weight = 2
104
100
 
105
- strings:
106
- $magic = { 25 50 44 46 }
107
- $header = /%PDF-1\.(3|4|6)/
108
- $create0 = /CreationDate \(D:20101015142358\)/
109
- $create1 = /CreationDate \(2008312053854\)/
110
- condition:
111
- $magic in (0..1024) and $header and 1 of ($create*)
101
+ strings:
102
+ $magic = { 25 50 44 46 }
103
+ $header = /%PDF-1\.(3|4|6)/
104
+ $create0 = /CreationDate \(D:20101015142358\)/
105
+ $create1 = /CreationDate \(2008312053854\)/
106
+ condition:
107
+ $magic in (0..1024) and $header and 1 of ($create*)
112
108
  }
113
109
 
114
110
 
115
- rule suspicious_title : PDF
116
- {
117
- meta:
118
- author = "Glenn Edwards (@hiddenillusion)"
119
- version = "0.1"
120
- weight = 4
121
-
122
- strings:
123
- $magic = { 25 50 44 46 }
124
- $header = /%PDF-1\.(3|4|6)/
125
-
126
- $title0 = "who cis"
127
- $title1 = "P66N7FF"
128
- $title2 = "Fohcirya"
129
- condition:
130
- $magic in (0..1024) and $header and 1 of ($title*)
131
- }
132
-
111
+ rule suspicious_title : PDF {
112
+ meta:
113
+ author = "Glenn Edwards (@hiddenillusion)"
114
+ version = "0.1"
115
+ weight = 4
133
116
 
134
- rule suspicious_author : PDF
135
- {
136
- meta:
137
- author = "Glenn Edwards (@hiddenillusion)"
138
- version = "0.1"
139
- weight = 4
117
+ strings:
118
+ $magic = { 25 50 44 46 }
119
+ $header = /%PDF-1\.(3|4|6)/
140
120
 
141
- strings:
142
- $magic = { 25 50 44 46 }
143
- $header = /%PDF-1\.(3|4|6)/
144
- $author0 = "Ubzg1QUbzuzgUbRjvcUb14RjUb1"
145
- $author1 = "ser pes"
146
- $author2 = "Miekiemoes"
147
- $author3 = "Nsarkolke"
148
- condition:
149
- $magic in (0..1024) and $header and 1 of ($author*)
121
+ $title0 = "who cis"
122
+ $title1 = "P66N7FF"
123
+ $title2 = "Fohcirya"
124
+ condition:
125
+ $magic in (0..1024) and $header and 1 of ($title*)
150
126
  }
151
127
 
152
128
 
153
- rule suspicious_producer : PDF
154
- {
155
- meta:
156
- author = "Glenn Edwards (@hiddenillusion)"
157
- version = "0.1"
158
- weight = 2
159
-
160
- strings:
161
- $magic = { 25 50 44 46 }
162
- $header = /%PDF-1\.(3|4|6)/
129
+ rule suspicious_author : PDF {
130
+ meta:
131
+ author = "Glenn Edwards (@hiddenillusion)"
132
+ version = "0.1"
133
+ weight = 4
163
134
 
164
- $producer0 = /Producer \(Scribus PDF Library/
165
- $producer1 = "Notepad"
166
- condition:
167
- $magic in (0..1024) and $header and 1 of ($producer*)
135
+ strings:
136
+ $magic = { 25 50 44 46 }
137
+ $header = /%PDF-1\.(3|4|6)/
138
+ $author0 = "Ubzg1QUbzuzgUbRjvcUb14RjUb1"
139
+ $author1 = "ser pes"
140
+ $author2 = "Miekiemoes"
141
+ $author3 = "Nsarkolke"
142
+ condition:
143
+ $magic in (0..1024) and $header and 1 of ($author*)
168
144
  }
169
145
 
170
146
 
171
- rule suspicious_creator : PDF
172
- {
173
- meta:
174
- author = "Glenn Edwards (@hiddenillusion)"
175
- version = "0.1"
176
- weight = 3
147
+ rule suspicious_producer : PDF {
148
+ meta:
149
+ author = "Glenn Edwards (@hiddenillusion)"
150
+ version = "0.1"
151
+ weight = 2
177
152
 
178
- strings:
179
- $magic = { 25 50 44 46 }
180
- $header = /%PDF-1\.(3|4|6)/
153
+ strings:
154
+ $magic = { 25 50 44 46 }
155
+ $header = /%PDF-1\.(3|4|6)/
181
156
 
182
- $creator0 = "yen vaw"
183
- $creator1 = "Scribus"
184
- $creator2 = "Viraciregavi"
185
- condition:
186
- $magic in (0..1024) and $header and 1 of ($creator*)
157
+ $producer0 = /Producer \(Scribus PDF Library/
158
+ $producer1 = "Notepad"
159
+ condition:
160
+ $magic in (0..1024) and $header and 1 of ($producer*)
187
161
  }
188
162
 
189
163
 
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)
164
+ rule suspicious_creator : PDF {
165
+ meta:
166
+ author = "Glenn Edwards (@hiddenillusion)"
167
+ version = "0.1"
168
+ weight = 3
169
+ strings:
170
+ $magic = { 25 50 44 46 }
171
+ $header = /%PDF-1\.(3|4|6)/
172
+ $creator0 = "yen vaw"
173
+ $creator1 = "Scribus"
174
+ $creator2 = "Viraciregavi"
175
+ condition:
176
+ $magic in (0..1024) and $header and 1 of ($creator*)
213
177
  }
214
178
 
215
179
 
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,120 +209,91 @@ 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
-
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
- {
272
- meta:
273
- author = "Glenn Edwards (@hiddenillusion)"
274
- version = "0.1"
275
- weight = 2
276
212
 
277
- strings:
278
- $magic = { 25 50 44 46 }
279
- $attrib0 = /\/Launch/
280
- $attrib1 = /\/URL /
281
- $attrib2 = /\/Action/
282
- $attrib3 = /\/F /
283
- condition:
284
- $magic in (0..1024) and 3 of ($attrib*)
213
+ rule suspicious_launch_action : PDF {
214
+ meta:
215
+ author = "Glenn Edwards (@hiddenillusion)"
216
+ version = "0.1"
217
+ weight = 2
218
+ strings:
219
+ $magic = { 25 50 44 46 }
220
+ $attrib0 = /\/Launch/
221
+ $attrib1 = /\/URL /
222
+ $attrib2 = /\/Action/
223
+ $attrib3 = /\/F /
224
+ condition:
225
+ $magic in (0..1024) and 3 of ($attrib*)
285
226
  }
286
227
 
287
228
 
288
- rule suspicious_embed : PDF
289
- {
290
- meta:
291
- author = "Glenn Edwards (@hiddenillusion)"
292
- version = "0.1"
293
- ref = "https://feliam.wordpress.com/2010/01/13/generic-pdf-exploit-hider-embedpdf-py-and-goodbye-av-detection-012010/"
294
- weight = 2
295
- strings:
296
- $magic = { 25 50 44 46 }
297
-
298
- $meth0 = /\/Launch/
299
- $meth1 = /\/GoTo(E|R)/ //means go to embedded or remote
300
- $attrib0 = /\/URL /
301
- $attrib1 = /\/Action/
302
- $attrib2 = /\/Filespec/
303
- condition:
304
- $magic in (0..1024) and 1 of ($meth*) and 2 of ($attrib*)
229
+ rule suspicious_embed : PDF {
230
+ meta:
231
+ author = "Glenn Edwards (@hiddenillusion)"
232
+ version = "0.1"
233
+ ref = "https://feliam.wordpress.com/2010/01/13/generic-pdf-exploit-hider-embedpdf-py-and-goodbye-av-detection-012010/"
234
+ weight = 2
235
+ strings:
236
+ $magic = { 25 50 44 46 }
237
+ $meth0 = /\/Launch/
238
+ $meth1 = /\/GoTo(E|R)/ //means go to embedded or remote
239
+ $attrib0 = /\/URL /
240
+ $attrib1 = /\/Action/
241
+ $attrib2 = /\/Filespec/
242
+ condition:
243
+ $magic in (0..1024) and 1 of ($meth*) and 2 of ($attrib*)
305
244
  }
306
245
 
307
246
 
308
- rule suspicious_obfuscation : PDF
309
- {
310
- meta:
311
- author = "Glenn Edwards (@hiddenillusion)"
312
- version = "0.1"
313
- weight = 2
314
-
315
- strings:
316
- $magic = { 25 50 44 46 }
317
- $reg = /\/\w#[a-zA-Z0-9]{2}#[a-zA-Z0-9]{2}/
318
- condition:
319
- $magic in (0..1024) and #reg > 5
247
+ rule suspicious_obfuscation : PDF {
248
+ meta:
249
+ author = "Glenn Edwards (@hiddenillusion)"
250
+ version = "0.1"
251
+ weight = 2
252
+ strings:
253
+ $magic = { 25 50 44 46 }
254
+ $reg = /\/\w#[a-zA-Z0-9]{2}#[a-zA-Z0-9]{2}/
255
+ condition:
256
+ $magic in (0..1024) and #reg > 5
320
257
  }
321
258
 
322
259
 
323
- rule invalid_XObject_js : PDF
324
- {
325
- meta:
326
- author = "Glenn Edwards (@hiddenillusion)"
327
- description = "XObject's require v1.4+"
328
- ref = "https://blogs.adobe.com/ReferenceXObjects/"
329
- version = "0.1"
330
- weight = 2
331
- strings:
332
- $magic = { 25 50 44 46 }
333
- $ver = /%PDF-1\.[4-9]/
334
-
335
- $attrib0 = /\/XObject/
336
- $attrib1 = /\/JavaScript/
337
- condition:
338
- $magic in (0..1024) and not $ver and all of ($attrib*)
260
+ rule invalid_XObject_js : PDF {
261
+ meta:
262
+ author = "Glenn Edwards (@hiddenillusion)"
263
+ description = "XObject's require v1.4+"
264
+ ref = "https://blogs.adobe.com/ReferenceXObjects/"
265
+ version = "0.1"
266
+ weight = 2
267
+ strings:
268
+ $magic = { 25 50 44 46 }
269
+ $ver = /%PDF-1\.[4-9]/
270
+ $attrib0 = /\/XObject/
271
+ $attrib1 = /\/JavaScript/
272
+ condition:
273
+ $magic in (0..1024) and not $ver and all of ($attrib*)
339
274
  }
340
275
 
341
276
 
342
- rule invalid_trailer_structure : PDF
343
- {
344
- meta:
345
- author = "Glenn Edwards (@hiddenillusion), @malvidin"
346
- version = "0.2"
347
- weight = 1
348
-
277
+ rule invalid_trailer_structure : PDF {
278
+ meta:
279
+ author = "Glenn Edwards (@hiddenillusion), @malvidin"
280
+ version = "0.2"
281
+ weight = 1
349
282
  strings:
350
- $magic = "%PDF" // Required for a valid PDF
351
- $reg0 = /trailer[ \r\n]*<<.{0,1000}\/Size\b/s
352
- $reg1 = /\/Root\b.{0,1000}[ \r\n]*.{0,500}startxref[ \r\n]*.{0,500}[ \r\n]*%%EOF/s
353
- condition:
354
- $magic in (0..1024) and not ($reg0 or $reg1)
283
+ $magic = "%PDF" // Required for a valid PDF
284
+ $reg0 = /trailer[ \r\n]*<<.{0,1000}\/Size\b/s
285
+ $reg1 = /\/Root\b.{0,1000}[ \r\n]*.{0,500}startxref[ \r\n]*.{0,500}[ \r\n]*%%EOF/s
286
+ condition:
287
+ $magic in (0..1024) and not ($reg0 or $reg1)
355
288
  }
356
289
 
357
290
 
358
- rule multiple_versions : PDF
359
- {
360
- meta:
361
- author = "Glenn Edwards (@hiddenillusion)"
362
- version = "0.1"
291
+ rule multiple_versions : PDF {
292
+ meta:
293
+ author = "Glenn Edwards (@hiddenillusion)"
294
+ version = "0.1"
363
295
  description = "Written very generically and doesn't hold any weight - just something that might be useful to know about to help show incremental updates to the file being analyzed"
364
- weight = 0
296
+ weight = 0
365
297
 
366
298
  strings:
367
299
  $magic = { 25 50 44 46 }
@@ -372,15 +304,13 @@ rule multiple_versions : PDF
372
304
  }
373
305
 
374
306
 
375
- rule js_wrong_version : PDF
376
- {
377
- meta:
378
- author = "Glenn Edwards (@hiddenillusion)"
379
- description = "JavaScript was introduced in v1.3"
380
- ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
381
- version = "0.1"
382
- weight = 2
383
-
307
+ rule js_wrong_version : PDF {
308
+ meta:
309
+ author = "Glenn Edwards (@hiddenillusion)"
310
+ description = "JavaScript was introduced in v1.3"
311
+ ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
312
+ version = "0.1"
313
+ weight = 2
384
314
  strings:
385
315
  $magic = { 25 50 44 46 }
386
316
  $js = /\/JavaScript/
@@ -390,14 +320,13 @@ rule js_wrong_version : PDF
390
320
  }
391
321
 
392
322
 
393
- rule JBIG2_wrong_version : PDF
394
- {
395
- meta:
396
- author = "Glenn Edwards (@hiddenillusion)"
397
- description = "JBIG2 was introduced in v1.4"
398
- ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
399
- version = "0.1"
400
- weight = 1
323
+ rule JBIG2_wrong_version : PDF {
324
+ meta:
325
+ author = "Glenn Edwards (@hiddenillusion)"
326
+ description = "JBIG2 was introduced in v1.4"
327
+ ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
328
+ version = "0.1"
329
+ weight = 1
401
330
 
402
331
  strings:
403
332
  $magic = { 25 50 44 46 }
@@ -408,14 +337,13 @@ rule JBIG2_wrong_version : PDF
408
337
  }
409
338
 
410
339
 
411
- rule FlateDecode_wrong_version : PDF
412
- {
413
- meta:
414
- author = "Glenn Edwards (@hiddenillusion)"
415
- description = "Flate was introduced in v1.2"
416
- ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
417
- version = "0.1"
418
- weight = 1
340
+ rule FlateDecode_wrong_version : PDF {
341
+ meta:
342
+ author = "Glenn Edwards (@hiddenillusion)"
343
+ description = "Flate was introduced in v1.2"
344
+ ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
345
+ version = "0.1"
346
+ weight = 1
419
347
 
420
348
  strings:
421
349
  $magic = { 25 50 44 46 }
@@ -426,15 +354,13 @@ rule FlateDecode_wrong_version : PDF
426
354
  }
427
355
 
428
356
 
429
- rule embed_wrong_version : PDF
430
- {
431
- meta:
432
- author = "Glenn Edwards (@hiddenillusion)"
433
- description = "EmbeddedFiles were introduced in v1.3"
434
- ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
435
- version = "0.1"
436
- weight = 1
437
-
357
+ rule embed_wrong_version : PDF {
358
+ meta:
359
+ author = "Glenn Edwards (@hiddenillusion)"
360
+ description = "EmbeddedFiles were introduced in v1.3"
361
+ ref = "http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf"
362
+ version = "0.1"
363
+ weight = 1
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,19 +420,18 @@ rule header_evasion : PDF
498
420
  }
499
421
 
500
422
 
501
- rule BlackHole_v2 : PDF
502
- {
503
- meta:
504
- author = "Glenn Edwards (@hiddenillusion)"
505
- version = "0.1"
506
- ref = "http://fortknoxnetworks.blogspot.no/2012/10/blackhhole-exploit-kit-v-20-url-pattern.html"
507
- weight = 3
423
+ rule BlackHole_v2 : PDF {
424
+ meta:
425
+ author = "Glenn Edwards (@hiddenillusion)"
426
+ version = "0.1"
427
+ ref = "http://fortknoxnetworks.blogspot.no/2012/10/blackhhole-exploit-kit-v-20-url-pattern.html"
428
+ weight = 3
508
429
 
509
- strings:
510
- $magic = { 25 50 44 46 }
511
- $content = "Index[5 1 7 1 9 4 23 4 50"
512
- condition:
513
- $magic in (0..1024) and $content
430
+ strings:
431
+ $magic = { 25 50 44 46 }
432
+ $content = "Index[5 1 7 1 9 4 23 4 50"
433
+ condition:
434
+ $magic in (0..1024) and $content
514
435
  }
515
436
 
516
437
  rule blackhole2_pdf : EK PDF{
@@ -547,44 +468,28 @@ rule blackhole2_pdf : EK PDF{
547
468
  18 of them
548
469
  }
549
470
 
550
- rule XDP_embedded_PDF : PDF
551
- {
552
- meta:
553
- author = "Glenn Edwards (@hiddenillusion)"
554
- version = "0.1"
555
- ref = "http://blog.9bplus.com/av-bypass-for-malicious-pdfs-using-xdp"
471
+ rule XDP_embedded_PDF : PDF {
472
+ meta:
473
+ author = "Glenn Edwards (@hiddenillusion)"
474
+ version = "0.1"
475
+ ref = "http://blog.9bplus.com/av-bypass-for-malicious-pdfs-using-xdp"
556
476
  weight = 1
557
- strings:
558
- $s1 = "<pdf xmlns="
559
- $s2 = "<chunk>"
560
- $s3 = "</pdf>"
561
- $header0 = "%PDF"
562
- $header1 = "JVBERi0"
563
- condition:
564
- all of ($s*) and 1 of ($header*)
477
+ strings:
478
+ $s1 = "<pdf xmlns="
479
+ $s2 = "<chunk>"
480
+ $s3 = "</pdf>"
481
+ $header0 = "%PDF"
482
+ $header1 = "JVBERi0"
483
+ condition:
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
-
646
537
 
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"
@@ -720,16 +588,14 @@ rule APT_APT29_NOBELIUM_BoomBox_PDF_Masq_May21_1 {
720
588
  reference = "https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/"
721
589
  date = "2021-05-27"
722
590
  score = 70
723
-
724
591
  strings:
725
592
  $ah1 = { 25 50 44 46 2d 31 2e 33 0a 25 } /* PDF Header */
726
593
  $af1 = { 0a 25 25 45 4f 46 0a } /* EOF */
727
-
728
594
  $fp1 = "endobj" ascii
729
595
  $fp2 = "endstream" ascii
730
596
  $fp3 = { 20 6F 62 6A 0A } /* obj\x0a */
731
597
  condition:
732
- $ah1 at 0 and $af1 at (filesize - 7) and filesize < 100KB
598
+ $ah1 at 0 and $af1 at (filesize - 7) and filesize < 100KB
733
599
  and math.entropy(16, filesize) > 7
734
600
  and not 1 of ($fp*)
735
601
  }
@@ -747,35 +613,13 @@ rule Adobe_Type_1_Font {
747
613
  project_zero_link = "https://googleprojectzero.github.io/0days-in-the-wild/0day-RCAs/2020/CVE-2020-27930.html"
748
614
  labs_pivot = "N/A"
749
615
  samples = "64f2c43f3d01eae65125024797d5a40d2fdc9c825c7043f928814b85cd8201a2"
750
-
751
- strings:
616
+ strings:
752
617
  $pdf = "%PDF-"
753
618
  $magic_classic = "%!FontType1-1."
754
619
  $magic_next_generation1 = /obj\s*<<[^>]*\/Type\s*\/Font[^>]*\/Subtype\s*\/Type1/
755
620
  $magic_next_generation2 = /obj\s*<<[^>]*\/Subtype\s*\/Type1[^>]*\/Type\s*\/Font/
756
- condition:
757
- $magic_classic in (0..1024) or ($pdf in (0..1024) and any of ($magic_next_generation*))
758
- }
759
-
760
-
761
- rule PDF_Containing_JavaScript {
762
- meta:
763
- author = "InQuest Labs"
764
- description = "This signature detects a PDF file that contains JavaScript. JavaScript can be used to customize PDFs by implementing objects, methods, and properties. While not inherently malicious, embedding JavaScript inside of a PDF is often used for malicious purposes such as malware delivery or exploitation."
765
- created_date = "2022-03-15"
766
- updated_date = "2022-03-15"
767
- blog_reference = "www.sans.org/security-resources/malwarefaq/pdf-overview.php"
768
- labs_reference = "N/A"
769
- labs_pivot = "N/A"
770
- samples = "c82e29dcaed3c71e05449cb9463f3efb7114ea22b6f45b16e09eae32db9f5bef"
771
-
772
- strings:
773
- $pdf_tag1 = /\x25\x50\x44\x46\x2d/
774
- $js_tag1 = "/JavaScript" fullword
775
- $js_tag2 = "/JS" fullword
776
- condition:
777
- $pdf_tag1 in (0..1024) and ($js_tag1 or $js_tag2)
778
-
621
+ condition:
622
+ $magic_classic in (0..1024) or ($pdf in (0..1024) and any of ($magic_next_generation*))
779
623
  }
780
624
 
781
625
 
@@ -789,92 +633,18 @@ rule JS_PDF_Data_Submission {
789
633
  labs_reference = "N/A"
790
634
  labs_pivot = "N/A"
791
635
  samples = "a0adbe66e11bdeaf880b81b41cd63964084084a413069389364c98da0c4d2a13"
792
-
793
- strings:
636
+ strings:
794
637
  $pdf_header = "%PDF-"
795
638
  $js = /(\/JS|\/JavaScript)/ nocase
796
639
  $a1 = /app\s*\.\s*doc\s*\.\s*submitForm\s*\(\s*['"]http/ nocase
797
640
  $inq_tail = "INQUEST-PP=pdfparser"
798
- condition:
641
+ condition:
799
642
  ($pdf_header in (0..1024) or $inq_tail in (filesize-30..filesize))
800
- and $js
801
- and $a1
802
- }
803
-
804
-
805
- rule PDF_Launch_Action_EXE {
806
- meta:
807
- author = "InQuest Labs"
808
- description = "This signature detects PDF files that launch an executable upon being opened on a host machine. This action is performed by the Launch Action feature available in the PDF file format and is commonly abused by threat actors to execute delivered malware."
809
- created_date = "2022-03-15"
810
- updated_date = "2022-03-15"
811
- blog_reference = "InQuest Labs Empirical Observations"
812
- labs_reference = "N/A"
813
- labs_pivot = "N/A"
814
- samples = "cb5e659c4ac93b335c77c9b389d8ef65d8c20ab8b0ad08e5f850cc5055e564c3"
815
-
816
- strings:
817
- /* 8 0 obj
818
- <<
819
- /Type /Action
820
- /S /Launch
821
- /Win
822
- <<
823
- /F (cmd.exe)
824
- >>
825
- >>
826
- endobj
827
- */
828
- $magic01 = "INQUEST-PP=pdfparser"
829
- $magic02 = "%PDF"
830
-
831
- $re1 = /\x2fType[ \t\r\n]*\x2fAction/ nocase wide ascii
832
- $re2 = /obj[^\x3c\x3e]+<<[^\x3e]*\x2fS[ \t\r\n]*\x2fLaunch[^\x3c\x3e]*<<[^\x3e]*\x2fF[ \t\r\n]*\x28[^\x29]+\.exe[^\x29]*\x29/ nocase wide ascii
833
- condition:
834
- ($magic01 in (filesize-30 .. filesize) or $magic02 in (0 .. 10)) and all of ($re*)
835
- }
836
-
837
-
838
- rule PDF_Launch_Function {
839
- meta:
840
- author = "InQuest Labs"
841
- description = "This signature detects the launch function within a PDF file. This function allows a document author to attach an executable file."
842
- created_date = "2022-03-15"
843
- updated_date = "2022-03-15"
844
- blog_reference = "http://blog.trendmicro.com/trendlabs-security-intelligence/PDF-launch-feature-abused-to-carry-zeuszbot/"
845
- labs_reference = "N/A"
846
- labs_pivot = "N/A"
847
- samples = "c2f2d1de6bf973b849725f1069c649ce594a907c1481566c0411faba40943ee5"
848
-
849
- strings:
850
- $pdf_header = "%PDF-"
851
- $launch = "/Launch" nocase
852
- condition:
853
- $pdf_header in (0..1024) and $launch
854
-
643
+ and $js
644
+ and $a1
855
645
  }
856
646
 
857
647
 
858
- rule PDF_with_Embedded_RTF_OLE_Newlines {
859
- meta:
860
- author = "InQuest Labs"
861
- description = "This signature detects suspicious PDF files embedded with RTF files that contain embedded OLE content that injects newlines into embedded OLE contents as a means of payload obfuscation and detection evasion."
862
- created_date = "2022-03-15"
863
- updated_date = "2022-03-15"
864
- blog_reference = "InQuest Internal Research"
865
- labs_reference = "N/A"
866
- labs_pivot = "N/A"
867
- samples = "d784c53b8387f1e2f1bcb56a3604a37b431638642e692540ebeaeee48c1f1a07"
868
-
869
- strings:
870
- $rtf_magic = "{\\rt" // note that {\rtf1 is not required
871
- $rtf_objdata = /\x7b[^\x7d]*\\objdata/ nocase
872
- $nor = "D0CF11E0A1B11AE1" nocase
873
- $obs = /D[ \r\t\n]*0[ \r\t\n]*C[ \r\t\n]*F[ \r\t\n]*1[ \r\t\n]*1[ \r\t\n]*E[ \r\t\n]*0[ \r\t\n]*A[ \r\t\n]*1[ \r\t\n]*B[ \r\t\n]*1[ \r\t\n]*1[ \r\t\n]*A[ \r\t\n]*E[ \r\t\n]*1/ nocase
874
- condition:
875
- $rtf_magic and $rtf_objdata and ($obs and not $nor)
876
- }
877
-
878
648
  /*
879
649
  This signature detects Adobe PDF files that reference a remote UNC object for the purpose of leaking NTLM hashes.
880
650
  New methods for NTLM hash leaks are discovered from time to time. This particular one is triggered upon opening of a
@@ -922,13 +692,11 @@ example three:
922
692
 
923
693
  Multiple protocols supported for the /F include, both http and UNC.
924
694
  */
925
-
926
695
  rule NTLM_Credential_Theft_via_PDF {
927
696
  meta:
928
697
  Author = "InQuest Labs"
929
698
  URL = "https://github.com/InQuest/yara-rules"
930
699
  Description = "This signature detects Adobe PDF files that reference a remote UNC object for the purpose of leaking NTLM hashes."
931
-
932
700
  strings:
933
701
  // we have three regexes here so that we catch all possible orderings but still meet the requirement of all three parts.
934
702
  $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,28 +707,7 @@ rule NTLM_Credential_Theft_via_PDF {
939
707
  }
940
708
 
941
709
 
942
- rule PDF_with_Launch_Action_Function
943
- {
944
- meta:
945
- author = "InQuest Labs"
946
- description = "This signature detects the launch function within a PDF file. This function allows the document author to attach an executable file."
947
- created_date = "2022-03-15"
948
- updated_date = "2022-03-15"
949
- blog_reference = "http://blog.didierstevens.com/2010/03/29/escape-from-pdf/"
950
- labs_reference = "N/A"
951
- labs_pivot = "N/A"
952
- samples = "a9fbb50dedfd84e1f4a3507d45b1b16baa43123f5ae98dae6aa9a5bebeb956a8"
953
-
954
- strings:
955
- $pdf_header = "%PDF-"
956
- $a = "<</S/Launch/Type/Action/Win<</F"
957
- condition:
958
- $pdf_header in (0..1024) and $a
959
- }
960
-
961
-
962
- rule PDF_JS_guillemet_close_in_Adobe_Type1_font
963
- {
710
+ rule PDF_JS_guillemet_close_in_Adobe_Type1_font {
964
711
  meta:
965
712
  author = "Michel de Cryptadamus"
966
713
  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,11 +717,10 @@ rule PDF_JS_guillemet_close_in_Adobe_Type1_font
970
717
  breach_description = "https://cryptadamus.substack.com/p/the-hack-at-the-end-of-the-universe"
971
718
  samples = "61d47fbfe855446d77c7da74b0b3d23dbcee4e4e48065a397bbf09a7988f596e"
972
719
  in_the_wild = true
973
-
974
- strings:
720
+ strings:
975
721
  // "/FJS`\xbb`"
976
- $url_js_backtick_close_obj = {2F 46 4A 53 60 BB 60}
977
- condition:
722
+ $url_js_backtick_close_obj = {2F 46 4A 53 60 BB 60}
723
+ condition:
978
724
  $url_js_backtick_close_obj and Adobe_Type_1_Font
979
725
  }
980
726
 
@@ -1083,3 +829,1031 @@ rule GIFTEDCROOK {
1083
829
  uint32(0) == 0x25504446 and
1084
830
  any of them
1085
831
  }
832
+
833
+
834
+ rule PK_AdobePDF_hse : Adobe {
835
+ meta:
836
+ description = "Phishing Kit impersonating Adobe PDF online"
837
+ licence = "GPL-3.0"
838
+ author = "Thomas 'tAd' Damonneville"
839
+ date = "2021-07-25"
840
+ comment = "Phishing Kit - Adobe PDF Online - 'Hades Silent Exploits'"
841
+ strings:
842
+ // the zipfile working on
843
+ $zip_file = { 50 4b 03 04 }
844
+ // specific directory found in PhishingKit
845
+ $spec_dir = "adobe"
846
+ // specific file found in PhishingKit
847
+ $spec_file = "index.php"
848
+ $spec_file2 = "login.php"
849
+ $spec_file3 = "logg.html"
850
+ condition:
851
+ // look for the ZIP header
852
+ uint32(0) == 0x04034b50 and
853
+ // make sure we have a local file header
854
+ $zip_file and
855
+ $spec_dir and
856
+ // check for file
857
+ all of ($spec_file*)
858
+ }
859
+
860
+
861
+ rule PK_AdobePDF_antenna : Adobe {
862
+ meta:
863
+ description = "Phishing Kit impersonating Adobe PDF Online"
864
+ licence = "AGPL-3.0"
865
+ author = "Thomas 'tAd' Damonneville"
866
+ reference = ""
867
+ date = "2024-04-15"
868
+ comment = "Phishing Kit - Adobe PDF Online - contain antenna.css file"
869
+ strings:
870
+ // the zipfile working on
871
+ $zip_file = { 50 4b 03 04 }
872
+ // specific directory found in PhishingKit
873
+ $spec_dir = "core"
874
+ // specific file found in PhishingKit
875
+ $spec_file = "antenna.css"
876
+ $spec_file2 = "screenshot_23.png"
877
+ $spec_file3 = "fx.js"
878
+ $spec_file4 = "post.php"
879
+ $spec_file5 = "22222222222.png"
880
+ $spec_file6 = "gh-adobe-impersonation-scam-loginwindow.png"
881
+ condition:
882
+ // look for the ZIP header
883
+ uint32(0) == 0x04034b50 and
884
+ // make sure we have a local file header
885
+ $zip_file and
886
+ all of ($spec_dir*) and
887
+ // check for file
888
+ all of ($spec_file*)
889
+ }
890
+
891
+
892
+ rule PK_AdobePDF_dotloop : Adobe {
893
+ meta:
894
+ description = "Phishing Kit impersonating Adobe PDF Online"
895
+ licence = "AGPL-3.0"
896
+ author = "Thomas 'tAd' Damonneville"
897
+ date = "2024-08-28"
898
+ comment = "Phishing Kit - Adobe PDF Online - 'From: Dotloop'"
899
+ strings:
900
+ // the zipfile working on
901
+ $zip_file = { 50 4b 03 04 }
902
+ // specific directory found in PhishingKit
903
+ $spec_dir = "asset"
904
+ // specific file found in PhishingKit
905
+ $spec_file = "signin.php"
906
+ $spec_file2 = "contract.jpg"
907
+ $spec_file3 = "Microsoft_Edge_logo_(2019).svg.png"
908
+ $spec_file4 = "KYC-ENG (confidential).pdf"
909
+ condition:
910
+ // look for the ZIP header
911
+ uint32(0) == 0x04034b50 and
912
+ // make sure we have a local file header
913
+ $zip_file and
914
+ all of ($spec_dir*) and
915
+ // check for file
916
+ all of ($spec_file*)
917
+ }
918
+
919
+
920
+ rule APT_NGO_wuaclt_PDF{
921
+ meta:
922
+ author = "AlienVault Labs"
923
+ license = "GPL-2.0"
924
+ reference = "https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/APT_NGO.yar#L30"
925
+ strings:
926
+ $pdf = "%PDF" nocase
927
+ $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}
928
+ condition:
929
+ $pdf at 0 and $comment in (0..200)
930
+ }
931
+
932
+
933
+ rule LokiBot_Dropper_ScanCopyPDF_Feb18 {
934
+ meta:
935
+ description = "Auto-generated rule - file Scan Copy.pdf.com (https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/crime_loki_bot.yar)"
936
+ license = "https://creativecommons.org/licenses/by-nc/4.0/"
937
+ author = "Florian Roth"
938
+ reference = "https://app.any.run/tasks/401df4d9-098b-4fd0-86e0-7a52ce6ddbf5"
939
+ date = "2018-02-14"
940
+ hash1 = "6f8ff26a5daf47effdea5795cdadfff9265c93a0ebca0ce5a4144712f8cab5be"
941
+ strings:
942
+ $x1 = "Win32 Scan Copy.pdf " fullword wide
943
+ $a1 = "C:\\Program Files (x86)\\Microsoft Visual Studio\\VB98\\VB6.OLB" fullword ascii
944
+ $s1 = "Compiling2.exe" fullword wide
945
+ $s2 = "Unstalled2" fullword ascii
946
+ $s3 = "Compiling.exe" fullword wide
947
+ condition:
948
+ uint16(0) == 0x5a4d and filesize < 1000KB and $x1 or
949
+ ( $a1 and 1 of ($s*) )
950
+ }
951
+
952
+
953
+ rule Docm_in_PDF {
954
+ meta:
955
+ description = "Detects an embedded DOCM in PDF combined with OpenAction"
956
+ license = "https://creativecommons.org/licenses/by-nc/4.0/"
957
+ author = "Florian Roth"
958
+ reference = "Internal Research https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/general_officemacros.yar"
959
+ date = "2017-05-15"
960
+ strings:
961
+ $a1 = /<<\/Names\[\([\w]{1,12}.docm\)/ ascii
962
+ $a2 = "OpenAction" ascii fullword
963
+ $a3 = "JavaScript" ascii fullword
964
+ condition:
965
+ uint32(0) == 0x46445025 and all of them
966
+ }
967
+
968
+
969
+ rule HKTL_EmbeddedPDF {
970
+ meta:
971
+ description = "Detects Embedded PDFs which can start malicious content (https://github.com/alankrit29/signature-base/blob/4f8c5d7e39ee5c369c42b89e765d552e5dbafb23/thor-hacktools.yar#L4437)"
972
+ author = "Tobias Michalski"
973
+ reference = "https://twitter.com/infosecn1nja/status/1021399595899731968?s=12"
974
+ date = "2018-07-25"
975
+ strings:
976
+ $x1 = "/Type /Action\n /S /JavaScript\n /JS (this.exportDataObject({" fullword ascii
977
+ $s1 = "(This PDF document embeds file" fullword ascii
978
+ $s2 = "/Names << /EmbeddedFiles << /Names" fullword ascii
979
+ $s3 = "/Type /EmbeddedFile" fullword ascii
980
+ condition:
981
+ uint16(0) == 0x5025 and
982
+ 2 of ($s*) and $x1
983
+ }
984
+
985
+
986
+ rule suspicious_js {
987
+ meta:
988
+ severity = 6
989
+ type = "pdf"
990
+ author = "Glenn Edwards (@hiddenillusion)"
991
+ version = "0.1"
992
+ weight = 3
993
+ description = "possible exploit"
994
+ reference = "https://github.com/a232319779/mmpi/blob/master/mmpi/data/yara/pdf/pdf.yara"
995
+ strings:
996
+ $magic = { 25 50 44 46 }
997
+ $attrib0 = /\/OpenAction /
998
+ $attrib1 = /\/JavaScript /
999
+ $js0 = "eval"
1000
+ $js1 = "Array"
1001
+ $js2 = "String.fromCharCode"
1002
+ condition:
1003
+ $magic at 0 and all of ($attrib*) and 2 of ($js*)
1004
+ }
1005
+
1006
+
1007
+ rule possible_exploit {
1008
+ meta:
1009
+ severity = 9
1010
+ type = "pdf"
1011
+ author = "Glenn Edwards (@hiddenillusion)"
1012
+ version = "0.1"
1013
+ weight = 3
1014
+ url = "https://github.com/hiddenillusion/AnalyzePDF/blob/master/pdf_rules.yara"
1015
+ description = "possible exploit"
1016
+ reference = "https://github.com/a232319779/mmpi/blob/master/mmpi/data/yara/pdf/pdf.yara"
1017
+ strings:
1018
+ $magic = { 25 50 44 46 }
1019
+
1020
+ $attrib0 = /\/JavaScript /
1021
+ $attrib3 = /\/ASCIIHexDecode/
1022
+ $attrib4 = /\/ASCII85Decode/
1023
+
1024
+ $action0 = /\/Action/
1025
+ $action1 = "Array"
1026
+ $shell = "A"
1027
+ $cond0 = "unescape"
1028
+ $cond1 = "String.fromCharCode"
1029
+
1030
+ $nop = "%u9090%u9090"
1031
+ condition:
1032
+ $magic at 0 and (2 of ($attrib*)) or ($action0 and #shell > 10 and 1 of ($cond*)) or ($action1 and $cond0 and $nop)
1033
+ }
1034
+
1035
+
1036
+ rule Detect_JavaScript {
1037
+ meta:
1038
+ description = "Detects embedded JavaScript in PDF files"
1039
+ type = "JavaScript"
1040
+ strings:
1041
+ $js1 = /\/JavaScript/i
1042
+ $js2 = /\/JS/i
1043
+ $js3 = /\/AA\s*<<\s*\/O\s*<<\s*\/S\s*\/JavaScript\s*\/JS\s*\(/i
1044
+ $js4 = /app\.alert/i
1045
+ $js5 = /this\.execute/i
1046
+ $js6 = /this\.print/i
1047
+ $js7 = /this\.saveAs/i
1048
+ $js8 = /util\.printd/i
1049
+ $js9 = /app\.setTimeOut/i
1050
+ $js10 = /event\.target/i
1051
+ condition:
1052
+ $js1 or $js2 or $js3 or $js4 or $js5 or $js6 or $js7 or $js8 or $js9 or $js10
1053
+ }
1054
+
1055
+
1056
+ rule Detect_Launch_Action {
1057
+ meta:
1058
+ description = "Detects Launch actions in PDF files"
1059
+ type = "Launch"
1060
+ strings:
1061
+ $launch1 = /\/Launch/i
1062
+ $launch2 = /\/Action\s*>>\s*\/Type\s*\/Action/i
1063
+ $launch3 = /\/S\s*\/Launch/i
1064
+ $launch4 = /\/Launch\s*<<\s*\/S\s*\/Launch/i
1065
+ $launch5 = /\/Launch\s*<<\s*\/F\s*<<\s*\/S\s*\/Launch/i
1066
+ $launch6 = /\/Launch\s*\/F\s*\(/i
1067
+ $launch7 = /\/Launch\s*<<\s*\/F\s*\(/i
1068
+ $launch8 = /\/Launch\s*<<\s*\/Win\s*\(/i
1069
+ $launch9 = /\/Launch\s*<<\s*\/Mac\s*\(/i
1070
+ $launch10 = /\/Launch\s*\/Win\s*\(/i
1071
+ condition:
1072
+ $launch1 or $launch2 or $launch3 or $launch4 or $launch5 or $launch6 or $launch7 or $launch8 or $launch9 or $launch10
1073
+ }
1074
+
1075
+
1076
+ rule Detect_OpenAction {
1077
+ meta:
1078
+ description = "Detects OpenAction in PDF files"
1079
+ type = "OpenAction"
1080
+ strings:
1081
+ $openAction1 = /\/OpenAction/i
1082
+ $openAction2 = /\/AA/i
1083
+ $openAction3 = /\/OpenAfterSave/i
1084
+ $openAction4 = /\/OpenDocument/i
1085
+ $openAction5 = /\/Open/i
1086
+ $openAction6 = /\/O\s*<<\s*\/S\s*\/JavaScript\s*\/JS\s*\(/i
1087
+ $openAction7 = /\/O\s*<<\s*\/S\s*\/JavaScript\s*\/JS/i
1088
+ $openAction8 = /\/O\s*<<\s*\/JS\s*\(/i
1089
+ $openAction9 = /\/O\s*<<\s*\/JS/i
1090
+ $openAction10 = /\/Open\s*<<\s*\/JavaScript\s*\/JS\s*\(/i
1091
+ condition:
1092
+ $openAction1 or $openAction2 or $openAction3 or $openAction4 or $openAction5 or $openAction6 or $openAction7 or $openAction8 or $openAction9 or $openAction10
1093
+ }
1094
+
1095
+
1096
+ rule Detect_Embedded_Files {
1097
+ meta:
1098
+ description = "Detects embedded files in PDF files"
1099
+ type = "EmbeddedFile"
1100
+ strings:
1101
+ $embed1 = /\/EmbeddedFile/i
1102
+ $embed2 = /\/FileAttachment/i
1103
+ $embed3 = /\/Type\s*\/EmbeddedFile/i
1104
+ $embed4 = /\/EF\s*<<\s*\/F\s*<<\s*\/Type\s*\/EmbeddedFile/i
1105
+ $embed5 = /\/EmbeddedFile\s*<<\s*\/Type\s*\/EmbeddedFile/i
1106
+ $embed6 = /\/Filespec\s*<<\s*\/EF\s*<<\s*\/F\s*<<\s*\/Type\s*\/EmbeddedFile/i
1107
+ $embed7 = /\/EmbeddedFile\s*\/Filespec/i
1108
+ $embed8 = /\/EmbeddedFile\s*\/Names/i
1109
+ $embed9 = /\/EmbeddedFile\s*\/Names\s*<<\s*\/Type\s*\/EmbeddedFile/i
1110
+ $embed10 = /\/EmbeddedFile\s*\/Names\s*<<\s*\/Type\s*\/EmbeddedFile\s*\/Filespec/i
1111
+ condition:
1112
+ $embed1 or $embed2 or $embed3 or $embed4 or $embed5 or $embed6 or $embed7 or $embed8 or $embed9 or $embed10
1113
+ }
1114
+
1115
+
1116
+ rule Detect_Shellcode {
1117
+ meta:
1118
+ description = "Detects suspicious shellcode patterns in PDF files"
1119
+ type = "Shellcode"
1120
+ strings:
1121
+ $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 }
1122
+ $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 }
1123
+ $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 }
1124
+ $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 }
1125
+ $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 }
1126
+ $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 }
1127
+ $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 }
1128
+ $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 }
1129
+ $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 }
1130
+ $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 }
1131
+ condition:
1132
+ $shellcode1 or $shellcode2 or $shellcode3 or $shellcode4 or $shellcode5 or $shellcode6 or $shellcode7 or $shellcode8 or $shellcode9 or $shellcode10
1133
+ }
1134
+
1135
+
1136
+ rule Detect_URLs {
1137
+ meta:
1138
+ description = "Detects suspicious URLs in PDF files"
1139
+ type = "URL"
1140
+ strings:
1141
+ $url1 = /ftp:\/\/[^\s]+/ nocase
1142
+ $url2 = /file:\/\/[^\s]+/ nocase
1143
+ $url3 = /:\/\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ nocase
1144
+ condition:
1145
+ $url1 or $url2 or $url3
1146
+ }
1147
+
1148
+
1149
+ rule Detect_PDF_Embedded_Files {
1150
+ meta:
1151
+ atk_type = "Macro"
1152
+ description = "Detects embedded files in PDF files"
1153
+ author = "groommang"
1154
+ date = "2024-06-25"
1155
+ strings:
1156
+ $pdf_header = {25 50 44 46}
1157
+ $embedded_file = /EmbeddedFile/
1158
+ condition:
1159
+ $pdf_header at 0 and $embedded_file
1160
+ }
1161
+
1162
+
1163
+ rule Detect_PDF_Suspicious_AcroForms {
1164
+ meta:
1165
+ atk_type = "Macro"
1166
+ description = "Detects suspicious AcroForms in PDF files"
1167
+ author = "groommang"
1168
+ date = "2024-06-25"
1169
+ strings:
1170
+ $pdf_header = {25 50 44 46}
1171
+ $acroform = /AcroForm/
1172
+ condition:
1173
+ $pdf_header at 0 and $acroform
1174
+ }
1175
+
1176
+
1177
+ rule oAuth_Phishing_PDF {
1178
+ meta:
1179
+ description = "Identifies potential phishing PDFs that target oAuth."
1180
+ id = "789YmThaTvLDaE1V2Oqx7q"
1181
+ fingerprint = "c367bca866de0b066e291b4e45216cbb68cc23297b002a29ca3c8d640a7db78e"
1182
+ version = "1.0"
1183
+ creation_date = "2022-01-01"
1184
+ first_imported = "2022-02-03"
1185
+ last_modified = "2025-03-10"
1186
+ status = "RELEASED"
1187
+ sharing = "TLP:WHITE"
1188
+ source = "BARTBLAZE"
1189
+ author = "@bartblaze"
1190
+ category = "MALWARE"
1191
+ reference = "https://twitter.com/ffforward/status/1484127442679836676"
1192
+ strings:
1193
+ $pdf = {25504446} //%PDF
1194
+ $s1 = "/URI (https://login.microsoftonline.com/common/oauth2/" nocase
1195
+ $s2 = "/URI (https://login.microsoftonline.com/consumers/oauth2" nocase
1196
+ $s3 = "/URI (https://accounts.google.com/o/oauth2" nocase
1197
+ condition:
1198
+ $pdf at 0 and any of ($s*)
1199
+ }
1200
+
1201
+
1202
+ rule Adobe_XMP_Identifier {
1203
+ meta:
1204
+ author = "InQuest Labs"
1205
+ 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."
1206
+ created_date = "2022-03-15"
1207
+ updated_date = "2022-03-15"
1208
+ blog_reference = "http://wwwimages.adobe.com/content/dam/acom/en/products/xmp/Pdfs/XMPAssetRelationships.pdf"
1209
+ labs_reference = "https://labs.inquest.net/dfi/sha256/1030710f6f18950f01b1a55d50a5169717e48567aa13a0a769f5451423280b4d"
1210
+ labs_pivot = "https://labs.inquest.net/dfi/search/ioc/xmpid/xmp.did%3AEDC9411A6A5F11E2838BB9184F90E845##eyJyZXN1bHRzIjpbIn4iLCJmaXJzdFNlZW4iLDEsIiIsW11dfQ=="
1211
+ samples = "1030710f6f18950f01b1a55d50a5169717e48567aa13a0a769f5451423280b4d"
1212
+ strings:
1213
+ $xmp_md5 = /xmp\.[dio]id[-: _][a-f0-9]{32}/ nocase ascii wide
1214
+ $xmp_guid = /xmp\.[dio]id[-: _][a-f0-9]{36}/ nocase ascii wide
1215
+ condition:
1216
+ any of them
1217
+ }
1218
+
1219
+
1220
+ rule Generic_Phishing_PDF {
1221
+ meta:
1222
+ atk_type = "Generic_Phishing_PDF"
1223
+ id = "6iE0XEqqhVGNED6Z8xIMr1"
1224
+ fingerprint = "f3f31ec9651ee41552d41dbd6650899d7a33beea46ed1c3329c3bbd023fe128e"
1225
+ version = "1.0"
1226
+ creation_date = "2019-03-01"
1227
+ first_imported = "2021-12-30"
1228
+ last_modified = "2021-12-30"
1229
+ status = "RELEASED"
1230
+ sharing = "TLP:WHITE"
1231
+ source = "BARTBLAZE"
1232
+ author = "@bartblaze"
1233
+ description = "Identifies generic phishing PDFs."
1234
+ category = "MALWARE"
1235
+ reference = "https://bartblaze.blogspot.com/2019/03/analysing-massive-office-365-phishing.html"
1236
+ strings:
1237
+ $pdf = {25504446}
1238
+ $s1 = "<xmp:CreatorTool>RAD PDF</xmp:CreatorTool>"
1239
+ $s2 = "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"DynaPDF"
1240
+ condition:
1241
+ $pdf at 0 and all of ($s*)
1242
+ }
1243
+
1244
+
1245
+ rule Embedded_EXE_Cloaking : maldoc {
1246
+ meta:
1247
+ description = "Detects an embedded executable in a non-executable file"
1248
+ author = "Florian Roth"
1249
+ date = "2015/02/27"
1250
+ score = 80
1251
+ strings:
1252
+ $noex_png = { 89 50 4E 47 }
1253
+ $noex_pdf = { 25 50 44 46 }
1254
+ $noex_rtf = { 7B 5C 72 74 66 31 }
1255
+ $noex_jpg = { FF D8 FF E0 }
1256
+ $noex_gif = { 47 49 46 38 }
1257
+ $mz = { 4D 5A }
1258
+ $a1 = "This program cannot be run in DOS mode"
1259
+ $a2 = "This program must be run under Win32"
1260
+ condition:
1261
+ (
1262
+ ( $noex_png at 0 ) or
1263
+ ( $noex_pdf at 0 ) or
1264
+ ( $noex_rtf at 0 ) or
1265
+ ( $noex_jpg at 0 ) or
1266
+ ( $noex_gif at 0 )
1267
+ )
1268
+ and
1269
+ for any i in (1..#mz): ( @a1 < ( @mz[i] + 200 ) or @a2 < ( @mz[i] + 200 ) )
1270
+ }
1271
+
1272
+
1273
+ rule PDF_EMBEDDED_DOCM {
1274
+ meta:
1275
+ description = "Find pdf files that have an embedded docm with openaction"
1276
+ author = "Brian Carter"
1277
+ last_modified = "May 11, 2017"
1278
+ strings:
1279
+ $magic = { 25 50 44 46 2d }
1280
+ $txt1 = "EmbeddedFile"
1281
+ $txt2 = "docm)"
1282
+ $txt3 = "JavaScript" nocase
1283
+ condition:
1284
+ $magic at 0 and all of ($txt*)
1285
+ }
1286
+
1287
+
1288
+ rule pdf_fake_password {
1289
+ meta:
1290
+ date = "2022-11-23"
1291
+ description = "Detects PDF obfuscated via /Encrypt and /AuthEvent/DocOpen but opens without password"
1292
+ author = "Paul Melson @pmelson"
1293
+ hash = "0e182afae5301ac3097ae3955aa8c894ec3a635acbec427d399ccc4aac3be3d6"
1294
+ strings:
1295
+ $docopen = "<</CF<</StdCF<</AuthEvent/DocOpen/" ascii
1296
+ $ownerpass = /\/Filter\/Standard\/Length (40|128|256)\/O\(/
1297
+ $userpass = "/StmF/StdCF/StrF/StdCF/U(" ascii
1298
+ $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 }
1299
+ condition:
1300
+ uint32(0) == 0x46445025 and
1301
+ all of them
1302
+ }
1303
+
1304
+
1305
+ rule pdf_mal_script {
1306
+ strings:
1307
+ $magic = { 25 50 44 46 }
1308
+ $action0 = "<</S/Launch/Type/Action/Win<<" nocase ascii
1309
+ $action1 = "/Type/Action>>" nocase ascii
1310
+ $action2 = "/OpenAction" nocase ascii
1311
+ $action3 = "<< /Type /Action" nocase ascii
1312
+ $action4 = "/Type /Action" nocase ascii
1313
+ $uri = "/S /URI /Type /Action /URI"
1314
+ $launch = "/S /Launch /Win" nocase ascii
1315
+ $cmd = "(cmd.exe)" nocase ascii
1316
+ $ps = "powershell" nocase ascii
1317
+ $pscom0 = "DownloadFile" nocase ascii
1318
+ $pscom1 = "payload" nocase ascii
1319
+ $homepath = "%HOMEPATH%" nocase ascii
1320
+ $start0 = "start" nocase ascii
1321
+ $start1 = "startxref" nocase ascii
1322
+ $js0 = "<</S/JavaScript/JS" nocase ascii
1323
+ $js1 = /\/JS \([^)]+?\\/
1324
+ $js2 = "/JavaScript" nocase ascii
1325
+ $emb0 = "/EmbeddedFiles" nocase ascii
1326
+ $emb1 = "/EmbeddedFile" nocase ascii
1327
+ $url0 = "https://shapeupfitnessdkk-my.sharepoint.com/:b:/g/personal/michelle_shapeupfitness_dk/Ebd2GDh2N8JErL23JmMNmw8BQA7JVpGiS_C6TGkERpma4A?e=xBbtrV"
1328
+ $url1 = "https://ipfs.io/ipfs/QmSyYCjyTMyo1dM2dWBY6ExTmodmU1oSBWTdmEDTLrEenC#http://www.booking.com/"
1329
+ $url2 = "https://romacul.com.br/workshop/wp-content/mail.outlookoffice365.com.html"
1330
+ $url3 = "https://www.hitplus.fr/2018/click.php?url=https://cutt.ly/seU8MT6t#F8i_bfW"
1331
+ $url4 = "https://etehadshipping.com/"
1332
+ $url5 = "https://afarm.net/"
1333
+ $url6 = "https://portals.checkfedexexp.com"
1334
+ $url7 = "https://otcworldmedia.com"
1335
+ $url8 = "http://tiny.cc/"
1336
+ $url9 = "http://128.199.7.40/"
1337
+ $invoc = "%%Invocation:" nocase ascii
1338
+ $op0 = "-sOutputFile=" nocase ascii
1339
+ $op1 = "-dNumRenderingThreads=" nocase ascii
1340
+ $op2 = "-sDEVICE=" nocase ascii
1341
+ $op3 = "-dAutoRotatePages=" nocase ascii
1342
+ $script0 = "<script" nocase ascii
1343
+ $script1 = "</script>" nocase ascii
1344
+ $tag0 = "<event" nocase ascii
1345
+ $tag1 = "</event>" nocase ascii
1346
+ $event0 = "event.target.exportXFAData" nocase ascii
1347
+ $event1 = "activity=" nocase ascii
1348
+ condition:
1349
+ ($magic at 0 and (8 of them)) or
1350
+ ($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
1351
+ ($magic at 0 and ($action2 or $action3) and (1 of ($emb*))) or
1352
+ ($magic at 0 and ( 1 of($url*))) or
1353
+ ($magic at 0 and $action4 and ($js1 or $js2)) or
1354
+ ($magic at 0 and $invoc and (2 of ($op*))) or
1355
+ ($magic at 0 and $uri) or
1356
+ ($magic at 0 and (2 of ($script*)) and ((2 of($event*)) and (2 of ($tag*))))
1357
+ }
1358
+
1359
+
1360
+ rule IconMismatch_PE_PDF {
1361
+ meta:
1362
+ description = "Icon mismatch: PE executable with PDF icons"
1363
+ author = "albertzsigovits"
1364
+ condition:
1365
+ uint16(0) == 0x5A4D
1366
+ and uint32(uint32(0x3C)) == 0x00004550
1367
+ and (
1368
+ hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "0da488a59ce7c34b5362e2c3e900ebaa48c2fa182c183166d290c0c6f10f97c1" // PDF red icon #1
1369
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "42cb714195c0255523313f41629c9d6a123d93f9789f8a8764e52cad405ea199" // PDF red icon #2
1370
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "56cc2dea455f34271b031b51ff2b439a8a8083f4848b5308d4b42c827ba22c1f" // PDF red icon #3
1371
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "683370eb202be9c57e6fe038e4a234c7a4e1f353dfbfe64d8f33397a5a0f0e81" // PDF red icon #4
1372
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "68f1550f74d5cf2a52f1cf3780037facf60a6254e133fcc503a12e1ea5106184" // PDF red icon #5
1373
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "9f12f3b8937665385f43f28caab2ded4469cefbec166d83e57d70e5a7b380067" // PDF red icon #6
1374
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "a27b7e5c64c784418daa27bebb7ffcedbc919649d1a5b6446cd8c02516ba6da6" // PDF red icon #7
1375
+ or hash.sha256(pe.resources[0].offset, pe.resources[0].length) == "f7e6bb934282eae0225f37b2d05e81c7bfa95acbf11d1eb9c9662ed3accf5708" // PDF red icon #8
1376
+ )
1377
+ }
1378
+
1379
+
1380
+ rule PDF_Exploit_Enhanced {
1381
+ meta:
1382
+ description = "Detects common PDF exploits and embedded malware test files"
1383
+ strings:
1384
+ $aa = "/OpenAction"
1385
+ $acroform = "/AcroForm"
1386
+ $embedded_file = "/EmbeddedFile"
1387
+ $js = "/JS"
1388
+ $javascript = "/JavaScript"
1389
+ $launch = "/Launch"
1390
+ $eicar_pdf = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" nocase
1391
+ condition:
1392
+ (any of ($js, $javascript, $aa, $acroform, $embedded_file, $launch) or $eicar_pdf)
1393
+ }
1394
+
1395
+
1396
+ rule SPICA__Strings {
1397
+ meta:
1398
+ author = "Google TAG"
1399
+ date = "2024-01-15"
1400
+ description = "Rust backdoor using websockets for c2 and embedded decoy PDF"
1401
+ hash = "37c52481711631a5c73a6341bd8bea302ad57f02199db7624b580058547fb5a9"
1402
+ strings:
1403
+ $s1 = "os_win.c:%d: (%lu) %s(%s) - %s"
1404
+ $s2 = "winWrite1"
1405
+ $s3 = "winWrite2"
1406
+ $s4 = "DNS resolution panicked"
1407
+ $s5 = "struct Dox"
1408
+ $s6 = "struct Telegram"
1409
+ $s8 = "struct Download"
1410
+ $s9 = "spica"
1411
+ $s10 = "Failed to open the subkey after setting the value."
1412
+ $s11 = "Card Holder: Bull Gayts"
1413
+ $s12 = "Card Number: 7/ 3310 0195 4865"
1414
+ $s13 = "CVV: 592"
1415
+ $s14 = "Card Expired: 03/28"
1416
+
1417
+ $a0 = "agent\\src\\archive.rs"
1418
+ $a1 = "agent\\src\\main.rs"
1419
+ $a2 = "agent\\src\\utils.rs"
1420
+ $a3 = "agent\\src\\command\\dox.rs"
1421
+ $a4 = "agent\\src\\command\\shell.rs"
1422
+ $a5 = "agent\\src\\command\\telegram.rs"
1423
+ $a6 = "agent\\src\\command\\mod.rs"
1424
+ $a7 = "agent\\src\\command\\mod.rs"
1425
+ $a8 = "agent\\src\\command\\cookie\\mod.rs"
1426
+ $a9 = "agent\\src\\command\\cookie\\browser\\mod.rs"
1427
+ $a10 = "agent\\src\\command\\cookie\\browser\\browser_name.rs"
1428
+ condition:
1429
+ 7 of ($s*) or 5 of ($a*)
1430
+ }
1431
+
1432
+
1433
+ rule G_Backdoor_TOUGHPROGRESS_LNK_1 {
1434
+ meta:
1435
+ author = "GTIG"
1436
+ date_created = "2025-04-29"
1437
+ date_modified = "2025-04-29"
1438
+ md5 = "65da1a9026cf171a5a7779bc5ee45fb1"
1439
+ rev = 1
1440
+ strings:
1441
+ $marker = { 4C 00 00 00 }
1442
+ $str1 = "rundll32.exe" ascii wide
1443
+ $str2 = ".\\image\\7.jpg,plus" wide
1444
+ $str3 = "%PDF-1"
1445
+ $str4 = "PYL="
1446
+ condition:
1447
+ $marker at 0 and all of them
1448
+ }
1449
+
1450
+
1451
+ rule LNK_Dropper_Russian_APT_Feb2024 {
1452
+ meta:
1453
+ Description = "Detects LNK dropper samples used by a Russian APT during a past campaign"
1454
+ Author = "RustyNoob619"
1455
+ Reference = "https://blog.cluster25.duskrise.com/2024/01/30/russian-apt-opposition"
1456
+ Hash = "114935488cc5f5d1664dbc4c305d97a7d356b0f6d823e282978792045f1c7ddb"
1457
+ SampleTesting = "Matches all five LNK Dropper Samples from the Blog"
1458
+ strings:
1459
+ $lnk = { 4C 00 00 00 01 14 02 00 }
1460
+ $pwrsh1 = "powershell.exe"
1461
+ $pwrsh2 = "WindowsPowerShell"
1462
+ $pwrsh3 = "powershell"
1463
+ $cmd = "cmd.exe"
1464
+ $ext1 = ".pdf.lnk"
1465
+ $ext2 = ".pdfx.lnk"
1466
+ $ext3 = "pdf.lnk" base64
1467
+ $scrpt1 = "Select-String -pattern \"JEVycm9yQWN0aW9uUH\" "
1468
+ $scrpt2 = "findstr /R 'JVBERi0xLjcNJeLjz9'" base64
1469
+ $blob1 = "$ErrorActionPreference = \"Continue\"" base64
1470
+ $blob2 = "$ProgressPreference = \"SilentlyContinue\"" base64
1471
+ $blob3 = "New-Alias -name pwn -Value iex -Force" base64
1472
+ $blob4 = "if ($pwd.path.toLower() -ne \"c:\\windows\\system32\")" base64
1473
+ $blob5 = "Copy-Item $env:tmp\\Temp.jpg $env:userprofile\\Temp.jpg" base64
1474
+ $blob6 = "attrib +h $env:userprofile\\Temp.jpg" base64
1475
+ $blob7 = "Start-Process $env:tmp\\Important.pdf" base64
1476
+ $net1 = "$userAgent = \"Mozilla/6.4 (Windows NT 11.1) Gecko/2010102 Firefox/99.0\"" base64
1477
+ $net2 = "$redirectors = \"6" base64
1478
+ $net3 = "$sleeps = 5" base64
1479
+ $http1 = "$request.Headers[\"X-Request-ID\"] = $request_token" base64
1480
+ $http2 = "$request.ContentType = \"application/x-www-form-urlencoded\"" base64
1481
+ $http3 = "$response1 = $(Send-HttpRequest \"$server/api/v1/Client/Info\" \"POST\" \"Info: $getenv64\")" base64
1482
+ $http4 = "$response = $($token = Send-HttpRequest \"$server/api/v1/Client/Token\" \"GET\")" base64
1483
+ $server1 = "$server = \"api-gate.xyz\"" base64
1484
+ $server2 = "$server = \"pdf-online.top\"" base64
1485
+ $unknown = "$server = " base64
1486
+ condition:
1487
+ $lnk at 0 //LNK File Header
1488
+ and (any of ($pwrsh*) or $cmd) //searches for CMD or PowerShell execution
1489
+ and any of ($ext*) //Fake Double Extension mimicing a PDF
1490
+ and any of ($scrpt*) //Searches for a unique string to locate execution code
1491
+ and 5 of ($blob*) //Base64 encoded execution blob
1492
+ and 2 of ($net*)
1493
+ and 3 of ($http*)
1494
+ and (any of ($server*) or $unknown) // C2 dommain config (Optional, can be removed)
1495
+ }
1496
+
1497
+
1498
+ private rule PDF_Structure
1499
+ {
1500
+ meta:
1501
+ description = "Detects valid, readable PDF files"
1502
+ reference_files = "minimal.pdf (4a6f4ff8596321eea6fa482e7adbed01)"
1503
+ author = "ThreatFlux"
1504
+ date = "2024-12-31"
1505
+ version = "1.1"
1506
+ file_type = "PDF"
1507
+ strings:
1508
+ $header = "%PDF-"
1509
+ $eof_marker = "%%EOF"
1510
+ $startxref = "startxref"
1511
+ $xref = "xref"
1512
+ $trailer = "trailer"
1513
+ condition:
1514
+ // Header validation
1515
+ $header at 0 and
1516
+ uint8(5) >= 0x31 and // Major version >= 1
1517
+ uint8(5) <= 0x37 and // Major version <= 7
1518
+ uint8(7) == 0x2E and // Decimal point
1519
+ uint8(8) >= 0x30 and // Minor version >= 0
1520
+ uint8(8) <= 0x37 and // Minor version <= 7
1521
+ // Basic structure requirements
1522
+ filesize > 32 and // Minimum size for valid PDF
1523
+ $eof_marker in (filesize-10..filesize) and // EOF marker near end
1524
+ // Required PDF elements
1525
+ $xref and // Must have cross-reference table
1526
+ $trailer and // Must have trailer
1527
+ $startxref and // Must have startxref pointer
1528
+ // Basic binary check
1529
+ uint8(1) == 0x50 and // 'P'
1530
+ uint8(2) == 0x44 and // 'D'
1531
+ uint8(3) == 0x46 // 'F'
1532
+ }
1533
+
1534
+
1535
+ rule DETECT_CommandShell_PDF_Execution
1536
+ {
1537
+ meta:
1538
+ description = "Detects Windows Command Shell execution artifacts in PDF files"
1539
+ author = "ThreatFlux"
1540
+ date = "2024-01-03"
1541
+ version = "2.1"
1542
+ // Classification
1543
+ threat_level = "Medium"
1544
+ category = "SUSPICIOUS_BEHAVIOR"
1545
+ malware_type = "PDF.CommandExecution"
1546
+ tlp = "WHITE"
1547
+ // MITRE ATT&CK Mapping
1548
+ mitre_attack = "T1059.003" // Windows Command Shell
1549
+ mitre_techniques = "T1204.002" // User Execution: Malicious File
1550
+ mitre_tactics = "Execution"
1551
+ // Detection Details
1552
+ detection_name = "PDF.Suspicious.CommandExecution"
1553
+ detection_rate = "Medium-High"
1554
+ false_positive_rate = "Medium"
1555
+ bypass_attempts = "String obfuscation, encoding variations"
1556
+ // File Characteristics
1557
+ file_type = "PDF"
1558
+ min_size = "1KB"
1559
+ max_size = "10MB"
1560
+ // References
1561
+ ref1 = "https://attack.mitre.org/techniques/T1059/003/"
1562
+ ref2 = "https://attack.mitre.org/techniques/T1204/002/"
1563
+ // Sample Metadata
1564
+ sample_hash1 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
1565
+ strings:
1566
+ // Command Shell Artifacts
1567
+ $cmd1 = "cmd.exe" nocase ascii
1568
+ $cmd2 = "cmd /c" nocase ascii
1569
+ $cmd3 = "cmd /k" nocase ascii
1570
+ $cmd4 = "%comspec%" nocase ascii
1571
+
1572
+ // Suspicious PDF Elements
1573
+ $suspc1 = "/JavaScript" ascii
1574
+ $suspc2 = "/OpenAction" ascii
1575
+ $suspc3 = "/Launch" ascii
1576
+ condition:
1577
+ PDF_Structure and
1578
+ (
1579
+ // Command Shell Reference
1580
+ any of ($cmd*) and
1581
+ // Supporting Suspicious Elements
1582
+ any of ($suspc*)
1583
+ )
1584
+ }
1585
+
1586
+
1587
+ rule apt_MuddyWater_malicious_pdf {
1588
+ meta:
1589
+ id = "77983aea-47cb-4436-b773-faf7be430339"
1590
+ version = "1.0"
1591
+ intrusion_set = "MuddyWater"
1592
+ description = "Detects malicious PDF used by MuddyWater"
1593
+ source = "Sekoia.io"
1594
+ creation_date = "2024-06-10"
1595
+ classification = "TLP:WHITE"
1596
+ strings:
1597
+ $ = "egnyte.com/fl/"
1598
+ $ = "/Type/Pages/Count 1"
1599
+ condition:
1600
+ uint32be(0) == 0x25504446 and
1601
+ filesize < 300KB and
1602
+ all of them
1603
+ }
1604
+
1605
+
1606
+ rule Bad_PDF {
1607
+ meta:
1608
+ description = "Detection patterns for the tool 'Bad-PDF' taken from the ThreatHunting-Keywords github project"
1609
+ author = "@mthcht"
1610
+ reference = "https://github.com/mthcht/ThreatHunting-Keywords"
1611
+ tool = "Bad-PDF"
1612
+ rule_category = "offensive_tool_keyword"
1613
+ strings:
1614
+ // 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.
1615
+ // Reference: https://github.com/deepzec/Bad-Pdf
1616
+ $string1 = "Bad-Pdf" nocase ascii wide
1617
+ condition:
1618
+ any of them
1619
+ }
1620
+
1621
+
1622
+ rule DetectMaliciousScriptInPDF {
1623
+ meta:
1624
+ description = "Detects a PDF containing the text 'malicious_script'"
1625
+ author = "Kasthuri"
1626
+ date = "2024-09-28"
1627
+ strings:
1628
+ $eval = "eval("
1629
+ $js_function = "function("
1630
+ $malicious_js = "document.write(unescape("
1631
+ condition:
1632
+ $js_function or $eval or $malicious_js
1633
+ }
1634
+
1635
+
1636
+ rule DetectMaliciousURLs {
1637
+ meta:
1638
+ description = "Detects potentially malicious URLs in a PDF"
1639
+ author = "Kasthuri"
1640
+ date = "2024-09-28"
1641
+ strings:
1642
+ $phishing_url = /example\.com.*example\.com|example\.com.*secure|paypal\.com.*login/
1643
+ $url_shortener = /bit\.ly|tinyurl\.com|goo\.gl/
1644
+ $suspicious_extension = /\.exe|\.php\.exe|\.js\.exe/
1645
+ $redirect_chain = /redirect\?url=/
1646
+ $suspicious_path = /admin|config|login|wp-admin/
1647
+ // $obfuscated_url = /%[0-9A-Fa-f]{2}/
1648
+ // $base64_encoded_url = /[a-zA-Z0-9+\/=]{20,}/
1649
+ condition:
1650
+ $phishing_url
1651
+ or $url_shortener
1652
+ or $suspicious_extension
1653
+ or $redirect_chain
1654
+ or $suspicious_path
1655
+ // or $obfuscated_url
1656
+ // or $base64_encoded_url
1657
+ }
1658
+
1659
+
1660
+ rule MAL_DarkCloud_Phishing_PDF_IOC {
1661
+ meta:
1662
+ description = "Detects a specific malicious PDF file used in DarkCloud Stealer phishing campaigns based on its SHA256 hash."
1663
+ date = "2025-07-24"
1664
+ version = 1
1665
+ reference = "https://unit42.paloaltonetworks.com/darkcloud-stealer-and-obfuscated-autoit-scripting/"
1666
+ hash = "bf3b43f5e4398ac810f005200519e096349b2237587d920d3c9b83525bb6bafc"
1667
+ tags = "CRIME, INFOSTEALER, DARKCLOUD, FILE"
1668
+ mitre_attack = "T1566.001"
1669
+ malware_family = "DarkCloud"
1670
+ malware_type = "Infostealer"
1671
+ condition:
1672
+ // Match the specific SHA256 hash of the malicious PDF file.
1673
+ hash.sha256(0, filesize) == "bf3b43f5e4398ac810f005200519e096349b2237587d920d3c9b83525bb6bafc"
1674
+ }
1675
+
1676
+
1677
+ rule PDF_Javascript_Exploit {
1678
+ meta:
1679
+ description = "Detect potentially malicious PDF with JavaScript"
1680
+ author = "Cyberion Security"
1681
+ date = "2025-01-01"
1682
+ severity = "medium"
1683
+ category = "pdf"
1684
+ strings:
1685
+ $pdf = "%PDF"
1686
+ $js1 = "/JavaScript" nocase
1687
+ $js2 = "/JS" nocase
1688
+ $js3 = "eval(" nocase
1689
+ $js4 = "unescape(" nocase
1690
+ condition:
1691
+ $pdf at 0 and (1 of ($js*))
1692
+ }
1693
+
1694
+
1695
+ rule Trojan_Win32_Emotet_PDF_MTB{
1696
+ meta:
1697
+ description = "Trojan:Win32/Emotet.PDF!MTB,SIGNATURE_TYPE_PEHSTR_EXT,01 00 01 00 02 00 00 "
1698
+ reference = "https://github.com/roadwy/DefenderYara/blob/63fedb45b4243e50a3f85e9e4e3e45bb6f1a6b6f/Trojan/Win32/Poison/Trojan_Win32_Poison_EM_MTB.yara"
1699
+ strings:
1700
+ $a_02_0 = {0f b6 cb 03 c1 99 b9 ?? ?? ?? ?? f7 f9 8a 5d 00 8d 4c 24 ?? 8a 94 14 ?? ?? ?? ?? 32 da 88 5d 00 } //1
1701
+ $a_81_1 = {72 43 4a 67 43 63 58 4d 77 66 66 32 4f 32 32 57 54 32 7a 39 38 38 73 61 66 59 72 78 55 62 68 46 6f } //1 rCJgCcXMwff2O22WT2z988safYrxUbhFo
1702
+ condition:
1703
+ ((#a_02_0 & 1)*1+(#a_81_1 & 1)*1) >=1
1704
+ }
1705
+
1706
+
1707
+ rule Trojan_Win32_Poison_EM_MTB{
1708
+ meta:
1709
+ description = "Trojan:Win32/Poison.EM!MTB,SIGNATURE_TYPE_PEHSTR_EXT,05 00 05 00 05 00 00 "
1710
+ reference = "https://github.com/roadwy/DefenderYara/blob/63fedb45b4243e50a3f85e9e4e3e45bb6f1a6b6f/Trojan/Win32/Poison/Trojan_Win32_Poison_EM_MTB.yara"
1711
+ strings :
1712
+ $a_01_0 = {45 5a 45 4c 5c 6e 65 77 73 6c 65 74 74 65 72 5c 56 42 36 } //1 EZEL\newsletter\VB6
1713
+ $a_01_1 = {48 69 63 63 75 70 70 32 } //1 Hiccupp2
1714
+ $a_01_2 = {66 72 75 6d 70 36 } //1 frump6
1715
+ $a_01_3 = {6e 00 73 00 6c 00 74 00 2e 00 70 00 64 00 66 00 } //1 nslt.pdf
1716
+ $a_01_4 = {57 72 69 74 65 50 72 6f 63 65 73 73 4d 65 6d 6f 72 79 } //1 WriteProcessMemory
1717
+ condition:
1718
+ ((#a_01_0 & 1)*1+(#a_01_1 & 1)*1+(#a_01_2 & 1)*1+(#a_01_3 & 1)*1+(#a_01_4 & 1)*1) >=5
1719
+ }
1720
+
1721
+
1722
+ rule TrojanSpy_Win32_Shiotob_C{
1723
+ meta:
1724
+ description = "TrojanSpy:Win32/Shiotob.C,SIGNATURE_TYPE_PEHSTR_EXT,05 00 05 00 05 00 00 "
1725
+ strings :
1726
+ $a_01_0 = {5c 42 65 73 74 2e 70 64 66 } //1 \Best.pdf
1727
+ $a_01_1 = {68 00 74 00 74 00 70 00 3a 00 2f 00 2f 00 51 00 75 00 6f 00 74 00 69 00 65 00 } //1 http://Quotie
1728
+ $a_01_2 = {6d 00 65 00 61 00 73 00 75 00 72 00 2e 00 54 00 75 00 72 00 6e 00 } //1 measur.Turn
1729
+ $a_01_3 = {2e 00 53 00 69 00 6c 00 65 00 6e 00 74 00 } //1 .Silent
1730
+ $a_03_4 = {6a 00 6a 00 6a 01 6a 00 6a 02 68 00 00 00 40 8d 8d d8 fe ff ff 51 ff 15 ?? ?? ?? ?? 89 45 f0 8b 55 ec 83 ea 1b 81 fa d5 00 00 00 76 17 8b 45 ec 03 05 ?? ?? ?? ?? 0f b7 0d ?? ?? ?? ?? 03 c1 a3 ?? ?? ?? ?? 83 7d f0 ff 74 17 6a 01 6a 00 6a 00 8d 95 d8 fe ff ff 52 6a 00 6a 00 ff 15 } //2
1731
+ condition:
1732
+ ((#a_01_0 & 1)*1+(#a_01_1 & 1)*1+(#a_01_2 & 1)*1+(#a_01_3 & 1)*1+(#a_03_4 & 1)*2) >=5
1733
+ }
1734
+
1735
+
1736
+ rule Kimsuky_Lure_PDF {
1737
+ meta:
1738
+ description = "Detection rule for a PDF file created by Kimsuky / APT43"
1739
+ author = "Alec Dhuse"
1740
+ creation_date = "2025-07-28"
1741
+ updated_date = "2025-07-28"
1742
+ date = "2025-07-28"
1743
+ in_the_wild = true
1744
+ threat_actor = "Kimsuky"
1745
+ hash = "ddf2832cde87548132688b28a27e6b4a0103e7d07fb88a5f10225145daa88926"
1746
+ rule_version = "1.0"
1747
+ strings:
1748
+ $re1 = /<<\s*\/Author\s*\(Raizo\)\s*\/Creator\s*\(þÿ\x00?M\x00?i\x00?c\x00?r\x00?o\x00?s\x00?o\x00?f\x00?t\x00?®\x00?\s+\x00?W\x00?o\x00?r\x00?d\x00?\s+\x00?2\x00?0\x00?1\x00?3\s*\)/
1749
+ condition:
1750
+ $re1
1751
+ }
1752
+
1753
+
1754
+ rule POTENTIAL_RU_APT_LNK_DEC23 {
1755
+ meta:
1756
+ author = "Ryan <@IntelCorgi>"
1757
+ date = "2024-03-20"
1758
+ description = "Decoy LNK drops HTTP shell and fake PDF. Attributed to unknown RU-nexus threat actor."
1759
+ source = "https://blog.cluster25.duskrise.com/2024/01/30/russian-apt-opposition"
1760
+ strings:
1761
+ $s0 = "CiRFcnJvckFjdGlvbl" ascii
1762
+ $s1 = "gci $env:tmp -Name Rar*" ascii wide
1763
+ condition:
1764
+ uint16(0) == 0x004c
1765
+ and filesize < 2MB
1766
+ and any of them
1767
+ }
1768
+
1769
+
1770
+ rule SUS_MSC_Icon_Pdf_Jan25 {
1771
+ meta:
1772
+ description = "Detects MSC with suspicious PDF icon observed in use by APT"
1773
+ note = "Categorising as SUS as unknown if this icon is unique to the actor or generic PDF stored in msc during build. Add other icon sizes for completeness."
1774
+ author = "Matt Green - @mgreen27"
1775
+ hash = "ca0dfda9a329f5729b3ca07c6578b3b6560e7cfaeff8d988d1fe8c9ca6896da5"
1776
+ date = "2025-01-16"
1777
+ strings:
1778
+ $xml = "<?xml"
1779
+ $pdf_console_file_icon_small = "SUwBAQEABAAEABAAEAD/////IQD//////////0JNNgAAAAAAAAA2AAAAKAAAAEAAAAAQAAAAAQAgAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkpGQ/5CQj/+Pjo3/jo2M/4yMiv+Lion/iomH/4iHhv+HhoT/hYWD/4SDgf+DgoD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAwAAAAAAAMADAAAAAAAAwAMAAAAAAADAAwAAAAAAAMAHAAAAAAAA"
1780
+ condition:
1781
+ $xml at 0 and $pdf_console_file_icon_small
1782
+ }
1783
+
1784
+
1785
+ rule document_with_embedded_executable {
1786
+ meta:
1787
+ author = "Joaquin Villegas"
1788
+ description = "Detects documents with embedded executable content"
1789
+ category = "document"
1790
+ severity = "critical"
1791
+ date = "2025.07.15"
1792
+ strings:
1793
+ // Document headers
1794
+ $pdf_header = "%PDF-"
1795
+ // $ole_header = { D0 CF 11 E0 A1 B1 1A E1 }
1796
+ // $rtf_header = "{\\rtf"
1797
+
1798
+ // Executable headers within document
1799
+ $pe_header = { 4D 5A } // MZ header
1800
+ $elf_header = { 7F 45 4C 46 } // ELF header
1801
+ $macho_header = { FE ED FA CE } // Mach-O header
1802
+
1803
+ // Embedded object indicators
1804
+ $embed1 = "\\objemb" nocase
1805
+ $embed2 = "/EmbeddedFile" nocase
1806
+ $embed3 = "Package" nocase
1807
+ $embed4 = "OLE Object" nocase
1808
+
1809
+ // File streams
1810
+ $stream1 = "\\objdata" nocase
1811
+ $stream2 = "/F " nocase
1812
+ $stream3 = "/Type/EmbeddedFile" nocase
1813
+ condition:
1814
+ $pdf_header at 0
1815
+ and (any of ($pe_header, $elf_header, $macho_header))
1816
+ and (any of ($embed*) or any of ($stream*))
1817
+ }
1818
+
1819
+
1820
+ rule pdf_with_javascript {
1821
+ meta:
1822
+ author = "Joaquin Villegas"
1823
+ description = "Detects PDF files with embedded JavaScript and suspicious content"
1824
+ category = "document"
1825
+ severity = "medium"
1826
+ date = "2025.07.15"
1827
+ strings:
1828
+ // PDF header
1829
+ $pdf_header = "%PDF-"
1830
+ // JavaScript indicators
1831
+ $js1 = "/JavaScript" nocase
1832
+ $js2 = "/JS" nocase
1833
+ $js3 = "/OpenAction" nocase
1834
+ $js4 = "/AA" nocase
1835
+ // Suspicious JavaScript functions
1836
+ $js_func1 = "app.alert" nocase
1837
+ $js_func2 = "this.print" nocase
1838
+ $js_func3 = "app.launchURL" nocase
1839
+ $js_func4 = "this.submitForm" nocase
1840
+ $js_func5 = "app.response" nocase
1841
+ $js_func6 = "this.importDataObject" nocase
1842
+ // Exploit indicators
1843
+ $exploit1 = "unescape" nocase
1844
+ $exploit2 = "eval" nocase
1845
+ $exploit3 = "String.fromCharCode" nocase
1846
+ $exploit4 = "document.write" nocase
1847
+ // Heap spray indicators
1848
+ $heap1 = /\x90{10,}/ // NOP sled
1849
+ $heap2 = /%u9090/ // Unicode NOP
1850
+ $heap3 = /\x0c\x0c\x0c\x0c/ // Heap spray pattern
1851
+ // Form actions
1852
+ $form1 = "/F " nocase
1853
+ $form2 = "/Type/Action" nocase
1854
+ $form3 = "/S/SubmitForm" nocase
1855
+ condition:
1856
+ $pdf_header at 0 and
1857
+ (any of ($js*) or any of ($js_func*)) and
1858
+ (any of ($exploit*) or any of ($heap*) or any of ($form*))
1859
+ }