Browse code

pdf: add filter count heuristic

Kevin Lin authored on 2016/04/16 00:28:40
Showing 2 changed files
... ...
@@ -2457,6 +2457,12 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2457 2457
         }
2458 2458
 
2459 2459
         pdf_parseobj(&pdf, obj);
2460
+        if (SCAN_ALGO && obj->numfilters > PDF_FILTER_DTRIGGER) {
2461
+            cli_append_virus(ctx, "Heuristic.PDF.TooManyFilters");
2462
+            alerts++;
2463
+            if (!SCAN_ALL)
2464
+                rc = CL_VIRUS;
2465
+        }
2460 2466
     }
2461 2467
 
2462 2468
     pdf_handle_enc(&pdf);
... ...
@@ -22,7 +22,8 @@
22 22
 #define __PDF_H
23 23
 
24 24
 #include "others.h"
25
-#define PDF_FILTERLIST_MAX 64
25
+#define PDF_FILTERLIST_MAX  64
26
+#define PDF_FILTER_DTRIGGER 8
26 27
 struct pdf_obj {
27 28
     uint32_t start;
28 29
     uint32_t id;