ThePhish: an automated phishing email analysis tool - SecSI (2024)

As of today, phishing emails are the most widely used infection vector. This means that the number of alerts related to emails to analyze is growing faster and faster. The problem is that analyzing an email is a complex and tedious process that can make an analyst waste the majority of its time on repetitive tasks. The solution is, obviously, the automation of this process. To do that, we developed an open-source automated phishing email analysis tool, which is ThePhish. It is based on three open-source platforms, namely TheHive, Cortex and MISP.

ThePhish: an automated phishing email analysis tool - SecSI (1)

Why automation?

Everyone knows what an email is, but not everyone knows what an email really contains. We are used to see the body of the email, which is the content that is displayed by the mail client. Actually, if we stopped there, we would be missing maybe the most important part of the email when it comes to the analysis: the header. It is composed of dozens of header fields, and being able to understand where to look at among them is crucial. We are usually looking for observables like IP addresses, email addresses, domains, URLs and file attachments that can be found in the header and/or in the body of the email. It is important to identify the relevant ones and analyze them with many different tools and services. However, doing that can literally take hours! That’s why we developed ThePhish.

The underlying tools: TheHive, Cortex and MISP

TheHive

ThePhish: an automated phishing email analysis tool - SecSI (2)TheHive is a scalable, open-source and free Security Incident Response Platform (SIRP) created by TheHive Project. It allows managing alerts related to security events coming from a multitude of sources.In addition, specialized programs called alert feeders can be built to consume such a security event, parse it and create an alert in TheHive. Alerts can be ignored, marked as read, previewed and imported. When an alert is imported, it becomes a case that needs to be investigated. The core construct of TheHive is infact the case, which is also the core construct of most security investigations. It can contain observables, such as IP addresses, email addresses, URLs, domains, files and many more. They can be tagged, analyzed and even flagged as Indicators of Compromise (IoCs). It is possible to access to all the functionalities provided by TheHive both through a web interface and a REST API. Moreover, a Python API client is available that is called TheHive4py.

Cortex

ThePhish: an automated phishing email analysis tool - SecSI (3)Cortex is a powerful open-source observable analysis and active response engine created by TheHive Project that allows analyzing observables at scale by querying a single tool instead of several. It provides a web interface from which it is possible to analyze observables one by one or in bulk mode, but it can also be used to automate these operations and submit large sets of observables from TheHive or through a REST API. Moreover, a Python API client is available that is called Cortex4py. The usage of Cortex is based on neurons, which are autonomous applications managed by and run through the Cortex core engine. They can be of one of two types:

  • Analyzers: They allow analyzing different types of observables by automating the interaction with a service or a tool so as to speed up the analysis and make it possible to contain threats before it is too late. Cortex comes with more than a hundred analyzers for popular services such as VirusTotal, emailrep.io, urlscan.io, AbuseIPDB and PhishTank.
  • Responders: They are installed along with the analyzers. However, they are only useful when Cortex is used in conjunction with TheHive, in fact they perform different actions and apply to various elements of TheHive.

MISP

ThePhish: an automated phishing email analysis tool - SecSI (4)

Malware Information Sharing Platform (MISP) is a free and open-source software helping information sharing of threat intelligence including cyber security indicators. Its aim is to help improve the countermeasures used against targeted attacks. It makes it possible to store IoCs in a structured manner, and thus enjoy the correlation, automated exports and synchronize to other MISP servers. The basic building block of MISP is the event. Each event is made up of a list of attributes, which are atomic pieces of data that could be IoCs. It also makes it easier to share with, but also to receive from trusted partners and trust groups so as to enable fast and effective detection of attacks. MISP provides an intuitive web interface, but also a REST API that can be used for automation and feeding devices.

Putting it all together

The real advantage of using TheHive, Cortex and MISP is obtained when they are used together. The following picture summarizes the possible interactions, which are described below:

ThePhish: an automated phishing email analysis tool - SecSI (5)

  • Events coming from SIEMs, emails, IDSes and other platforms are consumed by alert feeders, which can use the TheHive4py library to create alerts in TheHive. Alerts can also be generated thanks to TheHive polling events from MISP.
  • An analyst can create a case from that alert (or from scratch) and decide to analyze the observables that it contains through Cortex. It is also possible to interact with MISP through Cortex by using a special analyzer (the MISP Search analyzer). This analyzer makes it possible to search observables within a MISP instance. The observbles can also be analyzed with the invocation of MISP expansion modules. Moreover, it is possible to launch responders to automate certain actions, like sending a notification email.
  • The analyst can then decide whether to export the case along with its observables marked as IoC from TheHive to MISP.
  • It is also possible to enrich MISP events by calling Cortex analyzers from within MISP.

How ThePhish can help

ThePhish is a web application that automates the entire analysis process. It extracts the observables from the header and the body of the email and elaborates a verdict, which is final in most cases. In addition, the analyst can intervene in the analysis process and obtain further details on the email being analyzed if necessary. Here is shown how ThePhish works at high-level:

ThePhish: an automated phishing email analysis tool - SecSI (6)

  1. An attacker starts a phishing campaign and sends a phishing email to a user.
  2. A user who receives such an email can send it as an attachment in EML format to the mailbox used by ThePhish.
  3. The analyst interacts with ThePhish and selects the email to analyze.
  4. ThePhish extracts all the observables from the email and creates a case on TheHive. The observables are analyzed thanks to Cortex and its analyzers.
  5. ThePhish calculates a verdict based on the verdicts of the analyzers.
  6. If the verdict is final, ThePhish closes the case and notifies the user. In addition, if it is a malicious email, it exports the case to MISP.
  7. If the verdict is not final, ThePhish requires the analyst’s intervention. He must review the case on TheHive along with the results given by the various analyzers to formulate a verdict. Then, he can send the notification to the user, optionally export the case to MISP, and close the case.

ThePhish relieves the analyst from manually extracting all the observables from the email and adding them one by one in a case on TheHive. Moreover, he doesn’t need to start the various analyzers on each observable, send notifications to users, nor interacting with MISP. Even in the case in which his intervention is required, the majority of the work will have already been performed. This means that he can focus only on things that matter to elaborate a final verdict.

ThePhish example usage

This example aims to demonstrate two aspects:

  • How a user can send an email to ThePhish
  • How an analyst can actually analyze that email using ThePhish

A user sends an email to ThePhish

A user can send an email to the email address used by ThePhish to fetch the emails to analyze. He must forward the email as an attachment in EML format. This is to prevent the contamination of the email header. In this case, the used mail client is Mozilla Thunderbird and the used email address is a Gmail address.

ThePhish: an automated phishing email analysis tool - SecSI (7)

ThePhish: an automated phishing email analysis tool - SecSI (8)

The analyst analyzes the email

The analyst clicks on the “List emails” button to obtain the list of emails to analyze.

ThePhish: an automated phishing email analysis tool - SecSI (9)

When the analyst clicks on one of the “Analyze” buttons, the analysis starts. Its progress is shown on the web interface.

ThePhish: an automated phishing email analysis tool - SecSI (10)

In the meantime, ThePhish extracts the observables from the email and interacts with TheHive to create the case.

ThePhish: an automated phishing email analysis tool - SecSI (11)

ThePhish creates three tasks inside the case.

ThePhish: an automated phishing email analysis tool - SecSI (12)

Then, ThePhish starts adding the extracted observables to the case.

ThePhish: an automated phishing email analysis tool - SecSI (13)

At this point ThePhish notifies the user via email that the analysis has started thanks to the Mailer responder.

ThePhish: an automated phishing email analysis tool - SecSI (14)

The description of the first task allows the Mailer responder to send the notification via email.

ThePhish: an automated phishing email analysis tool - SecSI (15)

ThePhish starts the analyzers on the observables.The analysis progress is shown on the web interface while the analyzers are started.

ThePhish: an automated phishing email analysis tool - SecSI (16)

The analysis progress can also be viewed on TheHive, thanks to its live stream.

ThePhish: an automated phishing email analysis tool - SecSI (17)

Once all the analyzers have terminated their execution, ThePhish calculates the verdict. Since the verdict is “malicious”, ThePhish marks all the observables that it finds to be malicious as IoC.

ThePhish: an automated phishing email analysis tool - SecSI (18)

The case is then exported to MISP as an event, with a single attribute represented by the observable mentioned above.

ThePhish: an automated phishing email analysis tool - SecSI (19)

ThePhish: an automated phishing email analysis tool - SecSI (20)

Then, ThePhish sends the verdict via email to the user thanks to the Mailer responder.

ThePhish: an automated phishing email analysis tool - SecSI (21)

Finally, ThePhish closes the case. The description of the third task allows the Mailer responder to send the verdict via email. Moreover, the case has been closed after five minutes and resolved as “True Positive” with “No Impact”. This means that ThePhish detected the attack before it could do any damage.

ThePhish: an automated phishing email analysis tool - SecSI (22)

Once the case is closed, the analyst can view the verdict on the web interface. He can also view the entire log of the analysis progress.

ThePhish: an automated phishing email analysis tool - SecSI (23)

At this point, the analyst can go back and analyze another email. The above-depicted case was related to a phishing email. However, a similar workflow can be observed when the analyzed email is classified as “safe”. Indeed, ThePhish closes the case and sends the verdict to the user.

ThePhish: an automated phishing email analysis tool - SecSI (24)

Then, the analyst can view the verdict on the web interface.

ThePhish: an automated phishing email analysis tool - SecSI (25)

On the other hand, when an email is classified as “suspicious”, the verdict is only displayed to the analyst.

ThePhish: an automated phishing email analysis tool - SecSI (26)

Now the analyst needs to use the buttons on the left to use TheHive, Cortex and MISP for further analysis. This is because the analysis has not been completed yet. Indeed, the last task and the case have been left open. They infact need to be closed by the analyst himself once he elaborates a final verdict.

ThePhish: an automated phishing email analysis tool - SecSI (27)

The analyst can view the reports of all the analyzers on TheHive and Cortex. In case this was not enough, he could also download the EML file of the email and analyze it manually.

ThePhish: an automated phishing email analysis tool - SecSI (28)

When the analyst terminates the analysis, he populates the description of the last task. It will infact contain the body of the email to send to the user. Then he starts the Mailer responder, exports the case to MISP if necessary and then closes the case.

Implementation

The following picture is worth a thousand words:

ThePhish: an automated phishing email analysis tool - SecSI (29)

ThePhish is a web application written in Python 3. The web server is implemented using Flask, while the front-end part of the application is implemented using Bootstrap. Apart from the web server module, the back-end logic of the application is constituted by three Python modules that encapsulate the logic of the application itself and a Python class used to support the logging facility through the WebSocket protocol. Moreover, ThePhish uses several files for the configuration of the following aspects:

  • The logging functionality used to show the analysis progress
  • The connection with the underlying instances of TheHive, Cortex and MISP
  • The fine tuning of the results given by the Cortex analyzers
  • The observables to whitelist

When the analyst navigates to the base URL of the application, the browser establishes a bi-directional connection with the server. This is done by using the Socket.IO JavaScript library. For this to work, the server application uses the Flask-SocketIO Python library, which provides a Socket.IO integration for Flask applications. ThePhish uses this connection to display the progress of the analysis on the web interface.

Every time the analyst performs an action on the web interface, an asynchronous AJAX request is sent to the server. This allows the analyst both to visualize the list of emails to analyze and to make the analysis start.

ThePhish interacts with TheHive and Cortex thanks to TheHive4py and Cortex4py. Moreover, it interacts with an IMAP server to retrieve the emails to analyze.

Installation

You can install ThePhish in one of two possible ways:

  • From scratch, if you have up-and-running instances of TheHive, Cortex and MISP
  • By using Docker and Docker Compose

It’s also on GitHub!

ThePhish has been made available on GitHub as an open-source project under the AGPL license at this repository. It is possible to refer to that repository for a complete installation and configuration guide.

Conclusions

In this post we have presented a tool that allows automating the entire analysis process and obtain a verdict. It requires the analyst’s intervention when necessary, but with the most tedious and mechanical tasks already performed. The tool is available on GitHub so that anyone can contribute to improve it over time. The development of ThePhish will in fact not stop here, as there is great room for improvements. We will make further changes in the future in order to add new functionalities to ThePhish. Also, we will support any new feature introduced by TheHive and Cortex and support new analyzers. Furthermore, we will fix bugs that might be present in the current release or in any future release of ThePhish.

ThePhish: an automated phishing email analysis tool

ThePhish: an automated phishing email analysis tool - SecSI (2024)

FAQs

What is ThePhish? ›

ThePhish is an open-source tool that automates the entire phishing email analysis process starting from the extraction of the observables from the header and the body of an email to the elaboration of a verdict which is final in most cases. It is based on TheHive, Cortex and MISP.

What tool do you use for your phishing email? ›

VirusTotal is an online service that analyzes suspicious files and URLs to detect types of malware and malicious content using antivirus engines and website scanners.

What is phishing email analysis? ›

“Phishing email analysis involves studying the content of phishing emails to ascertain the techniques the attacker used.”

How do I flag a phishing email in Outlook? ›

Report a message as phishing in Outlook.com
  1. In the message list, select the message or messages you want to report.
  2. Above the reading pane, select Junk > Phishing > Report to report the message sender.

How do I Phish an email in Outlook? ›

Outlook Web Access (connect.rutgers.edu)
  1. Click on the email that you would like to Mark as Junk or Mark as Phishing.
  2. On the right hand side next the the "reply all" button, click the down arrow.
  3. One of the options should be Mark as Junk or Mark as phishing.

What is the most common used method for phishing? ›

1. Email phishing. Most phishing attacks are sent by email. The crook will register a fake domain that mimics a genuine organisation and sends thousands of generic requests.

What are 3 signs of a phishing email? ›

What are the key signs of a phishing email?
  • An unfamiliar greeting.
  • Grammar errors and misspelled words.
  • Email addresses and domain names that don't match.
  • Unusual content or request – these often involve a transfer of funds or requests for login credentials.
  • Urgency – ACT NOW, IMMEDIATE ACTION REQUIRED.

How is email analysis done? ›

Email analytics is the method of tracking how your subscribers interact with your emails by tracking different metrics that deal with email delivery, engagement, and conversions. Such analytics helps email marketers to draw valuable insights and optimize and strategize email campaigns for better performance.

What are the 8 types of phishing? ›

8 Types of Phishing Attacks
  • Email Phishing. Email is the most popular phishing medium. ...
  • Spear Phishing. Spear phishing works like common phishing attacks, using communications from a seemingly trusted source to trick victims. ...
  • Vishing and Smishing. ...
  • Clone Phishing. ...
  • Pharming. ...
  • HTTPS Phishing. ...
  • Pop-up Phishing. ...
  • Evil Twin Phishing.

Does reporting phishing emails do anything? ›

By reporting phishing attempts, you can: reduce the amount of scam communications you receive. make yourself a harder target for scammers. protect others from cyber crime online.

What is the easiest way to report a phishing email? ›

Report it. Forward phishing emails to reportphishing@apwg.org (an address used by the Anti-Phishing Working Group, which includes ISPs, security vendors, financial institutions, and law enforcement agencies). Let the company or person that was impersonated know about the phishing scheme.

How do I stop phishing emails? ›

Email Filtering

Your first line of defence against phishing is a Secure Email Gateway. Email gateways are used to filter out harmful and malicious emails, and quarantine them automatically away from user inboxes.

How do I Phish an email on Gmail? ›

Report an email as phishing
  1. On a computer, go to Gmail.
  2. Open the message.
  3. Next to Reply , click More .
  4. Click Report phishing.

How do I know if an Outlook email is phishing? ›

Completely ignore what the email looks like. That includes any images, company names, and logos – as well as what the text says. Find out where the links in the email lead. If the URL doesn't match the address of the company it purports to be from, it is unquestionably a phishing scam.

Does reporting phishing emails do anything in Outlook? ›

You can also report the email to Microsoft by clicking Report Phishing or Report Message in Outlook's Reading Pane. The Report Message offers a few additional options, such as “Report spam.” Once the email is reported, it will be deleted and its address blocked from sending you emails in the future.

What methods do phishers use? ›

While traditional phishing uses a 'spray and pray' approach, meaning mass emails are sent to as many people as possible, spear phishing is a much more targeted attack in which the hacker knows which specific individual or organization they are after.

What is the best free phishing tool? ›

However, by giving an overall view, Social-Engineering Toolkit still comes among the top tools. Infosec IQ comes at the top of being the most effective and profound phishing simulator. This is because it efficiently generates a large of campaigns that automatically gather the phishing rate of the users.

How do you add phishing to an email? ›

Report an email as phishing
  1. On a computer, go to Gmail.
  2. Open the message.
  3. Next to Reply , click More .
  4. Click Report phishing.

Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5861

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.