Automate the analysis of EML files
We’ve written many blogs about how to analyze suspicious emails, attachments, urls, even email headers. However there is a consistent question prospects ask about analyzing emails – how does Tines automate the analysis of .eml files?
EML files are files which contain the raw contents of an email saved by email programs like Microsoft Outlook. Phish reporting tools like KnowBe4’s ‘Phish Alert’, Cofense’s PhishMe or the report phishing button in Outlook send suspicious emails as .eml attachments to companies’ abuse inboxes like those reported to phish.ly. These .eml attachments contain the content of the reported email, along with the message headers; the subject; sender; all the recipients; and other metadata about the email. EML files may themselves also store one or more email attachments, and even other .eml files.
EML files can’t be analyzed in a sandbox nor can we easily extract attachments or email headers from them. In order to analyze these files we must extract the raw data and analyze the email as a whole.
The EML Parse Liquid Filter
To solve this problem at Tines we built a liquid filter, eml_parse, which extracts all the email data from an .eml file in a structured format. The liquid filters extract the attached .eml’s sender, body, attachments, headers etc. Tines can then analyze the email in the same way as an email sent to an abuse inbox.
To use eml_parse is simple – take the base64 encoded contents of an attachment (or an eml file submitted manually to Tines or downloaded from elsewhere) and then use the eml_parse liquid filter together with the as_object liquid filter. An event transformation agent with the below code will take the eml file and decode it:
The output will look exactly like a normal email:
Recursive Analysis of EML Files
The beginning of a basic Tines Story with recursive email analysis is below. EML attachments will analyzed recursively by naming the Event Transformation agent the same name as the IMAP agent:
When we view the event in Story Runs we can see that the we successfully extracted the attached email:
Now that we know we can analyze any .eml attachments we can include this process as part of any phishing analysis story easily, for example using gmail to handle reports with multiple or no eml attachments:
Using this method you now have a simple process to automate the analysis of .eml files reported by your employees using your phish reporting tool. You can now analyze the email and its attachments using all of your favourite tools!