Commit d613c098 by Antonio Sánchez Committed by GitHub

Merge pull request #237 from xambroz/master

Add eml context to Yara-rules/email to avoid matching these for every file
parents f6ea141a 6b3e91a7
...@@ -21,7 +21,14 @@ rule without_attachments : mail { ...@@ -21,7 +21,14 @@ rule without_attachments : mail {
reference = "http://laboratorio.blogs.hispasec.com/" reference = "http://laboratorio.blogs.hispasec.com/"
description = "Rule to detect the no presence of any attachment" description = "Rule to detect the no presence of any attachment"
strings: strings:
$eml_01 = "From:"
$eml_02 = "To:"
$eml_03 = "Subject:"
$attachment_id = "X-Attachment-Id" $attachment_id = "X-Attachment-Id"
$mime_type = "Content-Type: multipart/mixed"
condition: condition:
not $attachment_id all of ( $eml_* ) and
not $attachment_id and
not $mime_type
} }
...@@ -9,11 +9,15 @@ rule with_images : mail { ...@@ -9,11 +9,15 @@ rule with_images : mail {
reference = "http://laboratorio.blogs.hispasec.com/" reference = "http://laboratorio.blogs.hispasec.com/"
description = "Rule to detect the presence of an or several images" description = "Rule to detect the presence of an or several images"
strings: strings:
$a = ".jpg" nocase $eml_01 = "From:"
$b = ".png" nocase $eml_02 = "To:"
$c = ".bmp" nocase $eml_03 = "Subject:"
$img_a = ".jpg" nocase
$img_b = ".png" nocase
$img_c = ".bmp" nocase
condition: condition:
any of them all of ( $eml_* ) and
any of ( $img_* )
} }
rule without_images : mail { rule without_images : mail {
...@@ -22,9 +26,14 @@ rule without_images : mail { ...@@ -22,9 +26,14 @@ rule without_images : mail {
reference = "http://laboratorio.blogs.hispasec.com/" reference = "http://laboratorio.blogs.hispasec.com/"
description = "Rule to detect the no presence of any image" description = "Rule to detect the no presence of any image"
strings: strings:
$eml_01 = "From:"
$eml_02 = "To:"
$eml_03 = "Subject:"
$a = ".jpg" nocase $a = ".jpg" nocase
$b = ".png" nocase $b = ".png" nocase
$c = ".bmp" nocase $c = ".bmp" nocase
condition: condition:
all of ( $eml_* ) and
not $a and not $b and not $c not $a and not $b and not $c
} }
...@@ -9,6 +9,10 @@ rule with_urls : mail { ...@@ -9,6 +9,10 @@ rule with_urls : mail {
reference = "http://laboratorio.blogs.hispasec.com/" reference = "http://laboratorio.blogs.hispasec.com/"
description = "Rule to detect the presence of an or several urls" description = "Rule to detect the presence of an or several urls"
strings: strings:
$eml_01 = "From:"
$eml_02 = "To:"
$eml_03 = "Subject:"
$url_regex = /https?:\/\/([\w\.-]+)([\/\w \.-]*)/ $url_regex = /https?:\/\/([\w\.-]+)([\/\w \.-]*)/
condition: condition:
all of them all of them
...@@ -20,7 +24,12 @@ rule without_urls : mail { ...@@ -20,7 +24,12 @@ rule without_urls : mail {
reference = "http://laboratorio.blogs.hispasec.com/" reference = "http://laboratorio.blogs.hispasec.com/"
description = "Rule to detect the no presence of any url" description = "Rule to detect the no presence of any url"
strings: strings:
$eml_01 = "From:"
$eml_02 = "To:"
$eml_03 = "Subject:"
$url_regex = /https?:\/\/([\w\.-]+)([\/\w \.-]*)/ $url_regex = /https?:\/\/([\w\.-]+)([\/\w \.-]*)/
condition: condition:
all of ( $eml_* ) and
not $url_regex not $url_regex
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment