02-26-2016 04:07 AM
Is there any way to block office document types that contain macro's in this? The most recent cryptolocker variant (Locky) contains macro's which makes it more challenging to intercept. Blocking all office document attachments entirely isn't considered to be very business friendly.
02-27-2016 03:24 PM - edited 06-15-2018 08:02 AM
Hello Evan,
I have created a filter with some other customers whom I worked with with a similar situation and we created a filter together to attempt this stop all macro enabled office files by dropping the email if any macro enabled office file is seen. It goes through the use of a Message filter (configured on the CLI).
[Note:] This is a filter I use on my lab environment for testing and deployed, there may be some other filter alternatives or better-written filters but at this stage this one has worked well and went through a few iterations to be what it is now.
[Note2:] This filter is to be deployed at your own discretion, this was written from myself and end users whom I worked with - this filter script is not a officially supported script, please modify it to your requirements.
You can use this filter:
02-29-2016 06:40 AM
I am using Cisco hosted IronPort and don't currently have CLI access. It doesn't seem like I'll be able to create this content filter through GUI, is that correct?
I believe I can request CLI access via the hosted service, so I may need to do that.
02-29-2016 06:58 AM
Correct - in order to use the "attachment-binary-contains", this would be CLI and message filter only. This is not an option for content filters.
-Robert
03-15-2016 06:09 AM
Hi, I tested it also. I thought the main problem is that the message filter is not "looking into" office attachments. It's simply performing a binary serch.
03-15-2016 08:41 AM
thats right, but all macro files i had my hands on have binary readable phrases like:
word/vbaData.xml
word/_rels/vbaProject.bin.rel
word/vbaProject.bin
...and so on...
so imho the ability to search for "vba" is at least better than nothing... but @cisco:i am looking forward to see a checkbox/filetype "makro" ;)
by the way i had a few false-positives today, seems to be more accurate to search for "/vba"
MacroFilterNeu: if ((attachment-filename == "(?i)\\.(xls|xlsx|xlt|xla|xltx|xlsm|xltm|xlam|xlsb|doc|dot|docx|dotx|dotm|docm|ppt|pot|pps|ppa|pptx|potx|ppsx|ppam|pptm|potm|ppsm|rtf)$") OR (attachment-filetype != "Document")) AND ((attachment-binary-contains("(?i)x-vba-macros") OR (((attachment-binary-contains("(?i)vba")) AND (attachment-binary-contains("(?i)versioncompatible32"))) OR ((attachment-binary-contains("(?i)/vba")) AND attachment-binary-contains("(?i)[Content_Types].xml"))))) {
log-entry("$MatchedContent");
insert-header("X-Macro", "True");
}
03-15-2016 10:31 AM
So, I was digging through the parenthesis party, and want to make sure of the logic...
if ((attachment-filename == "(?i)\\.(xls|xlsx|xlt|xla|xltx|xlsm|xltm|xlam|xlsb|doc|dot|docx|dotx|dotm|docm|ppt|pot|pps|ppa|pptx|potx|ppsx|ppam|pptm|potm|ppsm|rtf)$")
OR
(attachment-filetype != "Document"))
AND
(
(
attachment-binary-contains("(?i)x-vba-macros")
OR
(((attachment-binary-contains("(?i)vba")) AND (attachment-binary-contains("(?i)versioncompatible32")))
OR
((attachment-binary-contains("(?i)/vba")) AND attachment-binary-contains("(?i)[Content_Types].xml")))
)
)
This first section before the first AND is almost always true... the only time its not true are "Documents" that aren't in the MS list... right?
After the AND, its looking for
"x-vba-macros"
or
(vba and versioncompatible32
or /vba and content type xml)
Did you mean to leave that slash on the second vba?
03-15-2016 02:55 PM
Hello Matthias,
Glad to see the filter was altered to your specifications to get it to work to your requirements.
However I must add, the reason why some of the formats were not there as I was testing with some other formats such as .docm which was a macro enabled document file (hence the m) but the binary matching was somewhat different, so i suppose the additional formats you looked into, the second OR clause would be for that one.
Regards,
Matthew
10-03-2016 10:02 AM
Matthew,
I have tried most of the filters in this thread with none of them working. I send a know xls with a macro and they don't processed with the Header X-Office Macro. here is the filter I created. what could I be doing wrong? AMP does catch it and send it off for review.
MacroFilter: if ((attachment-filename == "(?i)\\.rtf") AND (attachment-binary-contains("(?i)vbaproject.bin"))) OR ((attachment-filename == "(?i)\\.(xls|xlt|xla|doc|dot|ppt|pot|ppa|pps|sld|xlsx|xlsm|xltx|xltm|xlsb|xlam|docx|docm|dotx|dotm|pptx|pptm|potx|potm|ppam|ppsx|ppsm|sldx|sldm)$") AND ((attachment-binary-contains("(?i)x-vba-macros")) OR (attachment-binary-contains("(?i)/vbaProject.bin")))) {
log-entry("$MatchedContent");
insert-header("X-OfficeMacro", "True");
}
10-05-2016 07:04 AM
I opened a case with Cisco, and this is their suggestion.
Hi Brad,
You can use the below filter for achieving your desired results-
The message filter as follow:
macro_MSoffice_drop:
if (attachment-filename == "(?i)\\.(xls|doc|ppt|xlsx|docx|pptx|dotm|xlm|xlsm|xltm|xla|pptm|potm|ppsm|sldm)$") AND ((attachment-binary-contains('(?i)macros')) OR (attachment-binary-contains('[Vv][Bb][Aa]')) OR (attachment-filename == '(?i)\\.bin$'))
{
drop-attachments-by-name("(?i)\\.(xls|doc|ppt|xlsx|docx|pptx|dotm|xlm|xlsm|xltm|xla|pptm|potm|ppsm|sldm)$");
}
Thoughts?
04-11-2017 01:57 PM
Hi Matthew,
Can you comment on the new built in macro detection on 10.0.1 build 087? Is this carried over from the work from this custom filter? I haven't tested it yet but assume it's just as effective as this filter?
Thanks
04-11-2017 03:26 PM
Hey Hung,
I believe it should be just as if not more effective as the product team had written different codes/scripts for the matching for this.
Regards,
Matthew
03-15-2016 12:31 AM
Hi! i'am new to Ironport (testing at the moment) and i found this thread a few days ago.
There are two problems, the first: it not looks into all potential macro-files (for example *.dotm) so i expanded the list of filenames.
the second: there also seems to be a problem with detecting macros, so i expanded the filterrule.
Finally it looks like it will do its job. Please expand the rule if you can find any other problems/issues, or correct me if i'am wrong ;)
MacroFilterNeu: if ((attachment-filename == "(?i)\\.(xls|xlsx|xlt|xla|xltx|xlsm|xltm|xlam|xlsb|doc|dot|docx|dotx|dotm|docm|ppt|pot|pps|ppa|pptx|potx|ppsx|ppam|pptm|potm|ppsm)$") OR (attachment-filetype != "Document")) AND ((attachment-binary-contains("(?i)x-vba-macros") OR (((attachment-binary-contains("(?i)vba")) AND (attachment-binary-contains("(?i)versioncompatible32"))) OR ((attachment-binary-contains("(?i)vba")) AND attachment-binary-contains("(?i)[Content_Types].xml"))))) {
log-entry("$MatchedContent");
insert-header("X-Macro", "True");
}
-Matthias
03-15-2016 02:15 AM
Matthias, could you please expand the first half of that condition?
if ((attachment-filename == "(?i)\\.(xls|xlsx|xlt|xla|xltx|xlsm|xltm|xlam|xlsb|doc|dot|docx|dotx|dotm|docm|ppt|pot|pps|ppa|pptx|potx|ppsx|ppam|pptm|potm|ppsm)$") OR (attachment-filetype != "Document"))
I parse that as "if one of a series of document types or not a document".
Additionally, I've seen Word malware downloaders masquerade as RTF documents. Word cheerfully loads and runs them as Word documents.
03-15-2016 02:58 AM
Hi, to get it right:
you want me to add *.rtf files to the filename-list like:
MacroFilter: if ((attachment-filename == "(?i)\\.(xls|xlsx|xlt|xla|xltx|xlsm|xltm|xlam|xlsb|doc|dot|docx|dotx|dotm|docm|ppt|pot|pps|ppa|pptx|potx|ppsx|ppam|pptm|potm|ppsm|rtf)$") OR (attachment-filetype != "Document")) AND ((attachment-binary-contains("(?i)x-vba-macros") OR (((attachment-binary-contains("(?i)vba")) AND (attachment-binary-contains("(?i)versioncompatible32"))) OR ((attachment-binary-contains("(?i)vba")) AND attachment-binary-contains("(?i)[Content_Types].xml"))))) {
log-entry("$MatchedContent");
insert-header("X-Macro", "True");
}
Thank you! tested, also works!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide