Skip to content

Detect spoof E-mail and delete the spoof E-mail using Exchange Online rule | Part 5#12

In the current article, we will review how to deal with Spoof mail by creating an Exchange rule that will identify incoming Spoof E-mail (spoofed sender).

In such scenario, we would like to implement the following sequence of actions:

  1. Delete (reject) the E-mail.
  2. Generate + send an incident report to a designated recipient.

In our scenario, we prefer to block (reject) E-mail message that has the characters of Spoof E-mail.

The information about the possible Spoof E-mail event will be logged and reported by using the Exchange Online rule option named – incident report.

The main characters of our specific scenario are:

Our CIO, report that gets an E-mail message which allegedly sent by a legitimate organization recipient (our company CFO) that asks him to transfer a substantial amount of money to a specific bank account number.

In reality, the organization recipient (our company CFO) didn’t send this E-mail message, and There is a high chance that the E-mail sent by a hostile element that tries to attack our organization.

The business needs

The business need and the goals that we need to accomplish are as follows:

  1. We want to identify events in which E-mail messages that sent to our organization recipient have a high chance of being spoofed E-mail (spoofed sender).
  2. We want to prevent the “Spoofed E-mail” from reaching the organization user mailbox by deleting the E-mail that probably spoofed E-mail.
  3. We don’t wish to inform the recipient about the event in which Spoof E-mail that sent to him deleted.
  4. We want to send information + a sample of the Spoofed E-mail to a designated shared mailbox.
  5. We want that selected user (such as the Exchange Online administrator), will be able to access the shared mailbox that stores the incident reports, so, he could inspect and analyze the spoofed E-mail message.

The Exchange Online Spoofed E-mail rule structure and logic

The “trigger” that will activate the Exchange Online “Spoofed E-mail rule” will be based on the following two conditions (a combination of condition 1 + condition 2):

  1. An incoming E-mail message that is sent by a non-authenticated recipient (recipient who doesn’t provide user credentials).
  2. A recipient who presents himself by using an E-mail address that includes our public domain name. In our specific scenario, an E-mail address that includes the domain name –com

In the following diagram, we can see the sequence of actions, that will be implemented by the Exchange Online Spoofed E-mail rule:

The logic of Exchange rule for detecting spoof E-mail - Delete spoofed E-mail

The “action” that will be executed by our Exchange Online “Spoofed E-mail rule” will include the following “parts”:

1. Block the E-mail message from reaching the organization user mailbox

Detect spoof E-mail message and Delete the E-mail - Step 1 -2

2. Generate an incident report; that sent to the E-mail address of the designated recipient\s. In our scenario, we ask to send the incident report to a designated recipient (shared mailbox named –Spoof E-mail mailbox).

Detect spoof E-mail message and Delete the E-mail - Step 2 -2

Only authorized user\s can access the “Spoof E-mail shared mailbox”. In our scenario Brad (Brad is our Exchange Online administrator) will have access to the shared mailbox.

Note: Although the information in the current article was written about Office 365 (Exchange Online) based environment, most of the information is also relevant to Exchange on-Premises based environment.

Configuring Exchange Online Rule That Will Detect Spoof E-Mail Message and delete the Spoof E-mail

In the following section, we will provide “step by step” instructions for creating the required “Exchange Online Spoofed E-mail rule” that will answer our business needs.

Part 1#2 – configuring the “condition part” of the Exchange Online Spoofed E-mail rule

  • Log in to the Exchange admin portal
  • On the left menu bar, choose –mail flow
  • On the top menu bar, choose –rules
Login to Exchange Online admin portal and create a new rule ~01
  • Click on the plus icon
  • Choose – Create a new rule…
Login to Exchange Online admin portal and create a new rule ~02
  • In the Name: box, add a descriptive name for the new rule.
    In our specific scenario, we will name the rule – Detect Spoof E-mail & block
  • Click on the –More Options… link (by default, the interface of the Exchange Online rule includes only a limited set of options. To be able to display the additional options, we will need to “activate” the More Options…).
Detect spoof E-mail & block – condition -03
  • In the section named –Apply this rule if… click on the small black arrow
Detect spoof E-mail & block – condition -04

Condition 1#2

  • Choose the primary menu –The sender…
  • In the submenu, select the option –Is external/internal
Detect spoof E-mail & block – condition -05
  • In the select sender location window, choose the option – Outside the organization.
    The meaning of the term “outside the organization”, relates to a un-authenticated recipient, meaning – a recipient that doesn’t provide user credentials to the mail server.
Detect spoof E-mail & block – condition -06

Condition 2#2

Now, we will add an additional “layer” to the “rule condition”, in which we relate to
the recipient who uses an E-mail address that includes our domain name (o365pilot.com in our specific scenario).

If you would like to read more information about the meaning of the Exchange Online terms– “External Sender” and “outside the organization,“ read the following section: Dealing with an E-mail Spoof Attack in Office 365 based environment | Introduction | Part 1#12

  • Click on the – add a condition.
Detect spoof E-mail & block – condition -07
  • In the section named – and click on the small black arrow.
Detect spoof E-mail & block – condition -08
  • Choose the primary menu – The sender…
  • In the submenu, select the option – domain is
Detect spoof E-mail & block – condition -09

In the Specify Domain window, add the required domain name that represents your organization.
In our specific scenario, the public domain name is – o365pilot.com

Note – Don’t forget to click on the plus icon to add the domain name.

Detect spoof E-mail & block – condition -10

Click on the OK option to save the Exchange Online rule settings.

Detect spoof E-mail & block – condition -11

Part 2#2 – Configuring the “action part” of the Exchange Online Spoofed E-mail rule

In this phase, we will set the “second part” of the Exchange Online rule, in which we define the required Exchange response (action) to a scenario of spoofed E-mail that sent to one of our organization recipients.

Detect spoof E-mail & block – action -01

In our situation, we wish to instruct Exchange Online to respond to the event in which
E-mail identified as Spoof E-mail by implementing the following actions:

Condition 1#2 – Reject (block) the Spoof E-mail

  • In the section named – *.Do the following… click on the small black arrow.
Detect spoof E-mail & block – action -02
  • Choose the menu option –Block the message…
  • In the submenu choose the menu option –Delete the message without notifying anyone
Detect spoof E-mail & block – action -03

Condition 2#2 – Create an incident report and send it to a designated recipient.

  • Click on the option –add action
Detect spoof E-mail & block – action -04
  • In the section named – *.and… click on the small black arrow.
Detect spoof E-mail & block – action -05
  • Choose the menu option –Generate incident report and send it to…
Detect spoof E-mail & block – action -06

The settings of the incident report include two parameters:

  1. The name of the “destination recipient” which will get the incident report.
  2. The information fields that will be included in the incident report.
  • To add the required “destination recipient” name, click on the link –Select one…
Detect spoof E-mail & block – action -07
  • In our specific scenario, the recipient who will get the incident report is Spoof E-mails mailbox.
Detect spoof E-mail & block – action -08

To select the information that will be included within the incident report, click on the link named-*include message properties

Detect spoof E-mail & block – action -09

In our scenario, we will choose to include all the available message properties in the summary report + a copy of the “original Spoof E-mail message”.

  • Select the option –Select all
Detect spoof E-mail & block – action -10

In the following screenshot, we can view the available options:

  • Part A – relates to the info that will appear in the incident report summary.
  • Part B – relates to the option of “attaching” copy of the original E-mail message to the incident report.
Detect spoof E-mail & block – action -11

In the following screenshot, we can see the “final result” – the Exchange Online Spoof email that includes the two parts:

  • The condition part
  • The action part
Detect spoof E-mail & block – action -12

Verifying That The Exchange Online Spoofed E-Mail Rule Is Working Properly

In this phase, we would like to test the Exchange Online Spoof E-mail rule created in the previous step and verify that the rule is working properly.

The required results from the Exchange Online Spoofed E-mail rule

Our desired expectations are – when Exchange Online identifies events in which E-mail messages that sent to our organization recipient have a high chance of being spoofed E-mail (spoofed sender), the Exchange Online Spoof E-mail rule will execute that following sequence of actions:

  1. Delete the Spoof E-mail message.
  2. Generate an incident report; that will be sent to the E-mail address of the designated recipient\s. In our specific scenario, we ask to send the incident report to a designated recipient (shared mailbox named – Spoof E-mail mailbox).

Simulate a Spoof E-mail attack | Scenario characters

To be able to ensure that the Exchange Online Spoof E-mail rule is working properly, we will simulate a spoof E-mail attack that has the following characters:

  • A “hostile element” is trying to spoof the identity of a legitimate organization recipient named –Suzan using the E-mail address – Suzan@o365pilot.com
  • The spoofed E-mail message will be sent to a legitimate organization user named Bob, which uses the E-mail address – Bob@o365pilot.com

If you like to learn about the way that we use for simulating the E-mail spoof attack, you can read the article – How to Simulate E-mail Spoof Attack |Part 11#12

1#2 – Delete the Spoof E-mail message

Because the Spoof E-mail deleted by Exchange Online, we can only look at a “trace” of the event by using the Exchange Online message trace option.

In the following screenshot, we can see Exchange Online manage to identify the
Spoof E-mail message.

The status of the E-mail message is “Failed” because the E-mail message wasn’t delivered to the destination recipient mailbox (was deleted by Exchange Online).

Verifying That The Exchange -delete Spoofed E-Mail Rule Is Working Properly -01

To get more information about the mail flow, we can double-click on the log row.

Now we can see details about the event:

  • In the “mail flow graph” we can see that the E-mail message was not delivered.
  • The status report includes detailed information about the reason for “blocking” the specific E-mail message.
Verifying That The Exchange -delete Spoofed E-Mail Rule Is Working Properly -02

In case that we want to get even more specific details about the mail flow, we can view the information in the bottom part (part C).

Verifying That The Exchange -delete Spoofed E-Mail Rule Is Working Properly -03

2#2 – verifying that an incident report sent to the designated recipient

We can see that Exchange Online rule “capture” an event of Spoof E-mail. As a result, an incident report was sent to the recipient name (Spoof E-mails mailbox) that configured in the Exchange Online rule.

Verifying That The Exchange -delete Spoofed E-Mail Rule Is Working Properly -04

In the following screenshot, we can see an example of the incident report E-mail.

When we look into the incident report, we can see that the incident report includes two parts:

  • The copy of the original E-mail message (A).
  • The incident report summary (B).

The incident report summary includes details such as:

  • Information about the generator of the incident report E-mail message – “This email was automatically generated by the Generate Incident Report action” (number 1).
  • Sender – the sender (the “source recipient”) that claim to be a legitimate organization recipient named –Suzan@o365pilot.com (number 2).
  • To – the recipients (the destination recipient) is –Bob@o365pilot.com (number 3)
  • Rule Hit – the Exchange Online rule the “capture” the spoof E-mail event and the action that was executed by the Exchange Online rule –”Detect spoof E-mail & block, Action: AuditSeverityLevel, DeleteMessage, GenerateIncidentReport” (number 4).
Verifying That The Exchange -delete Spoofed E-Mail Rule Is Working Properly -05

Check our video: https://www.youtube.com/watch?v=gBQzQGuLMvU

The next article in the current article series

In the next article – Detect Spoof E-mail – Prepend The Subject Of The Spoof E-mail + Add Disclaimer Using Exchange Online Rule |Part 6#12, we will review how to create an Exchange Online rule that will identify events of spoofed E-mail and as a response, will – prepend the subject of the spoof E-mail + add disclaimer Spoof E-mail.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has One Comment

  1. I made a rule exactly the same as this, but it is blocking some users who have automatic mail forwarding, I do not know why this occurs.
    Can I release this kind of situation?
    I put an exception to ignore auto-foward emails, but it still did not work.
    Would you have an idea to help me?

    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *