Bypassing MDO (Microsoft Defender for Office 365) Phishing Filter.

How it Started: Background and Initial Observations:

As part of an internal cybersecurity awareness initiative, I was asked by my organization to provide cybersecurity awareness session that included live demonstrations using tools such as Flipper Zero, OMG cables, and a phishing simulation - Gophish (why?: easy and free). 

Everything was working fine, except for Gophish, After configuring Gmail SMTP in Gophish and sending test emails to my corporate account, the messages were consistently blocked by Microsoft Defender for Office 365 (MDO) and did not reach the inbox. 

Further analysis revealed that emails generated by Gophish were being flagged as phishing by multiple detection layers within MDO, including general filtering, mixed analysis, and advanced filtering mechanisms. This indicated that the framework was effectively identified and blocked by default protections.

During investigation of the email headers, I observed that the default "X-Mailer:Gophish" header could be the reason to these detections. Based on this hypothesis, I modified the header value to a generic value (e.g., “Yahoo” or similar).

Following this change, the emails were successfully delivered to user mailboxes, despite MDO being configured with recommended security settings. The messages were no longer blocked or quarantined at delivery time, allowing user interaction.

============== End of theory ==========

==========Technical details and POC========

1. Let's start with the detected email sent from Gophish tool:

 
In above image you can clearly see that Gophish header was sent which is detected by MDO.
Below is the detected information from Microsoft security portal.



==== POC/Bypass =======

Assuming that you have already configured your GoPhish Tool including sending profile etc. if not you can search on youtube "How to configure GoPhish"

To bypass MDO filters: Edit your sending profile in GOphish Tool, There is a section of "Email Headers:"

In 1st field write: X-Mailer

In 2nd field write: Anything(i wrote Yahoo)

Click Add custom Header. Your settings will look like this:


That's it, try sending the email and you will get it in your inbox, completely bypassing MDO below is one email of sent email with our custom header.


Below is a snap from security portal. No detection.

=========Report to Microsoft??====

This issue was reported to Microsoft they classified it as low severity, with no immediate servicing planned, and approval granted for public disclosure. 

In my view, the severity may be higher than currently classified, as the behavior could weaken phishing detection controls and increase exposure to socially engineered attacks.

My research was conducted using Gophish; however, similar techniques could be applied to other platforms such as King Phisher and SET (Social-Engineer Toolkit) etc.

===========Solution??======

Currently there is no solution to stop this bypass. The only solution is "User awareness sessions"


Thanks












Comments

Popular posts from this blog

Ericsson BSCS iX R18 Billing & Rating (ADMX, MX) - Stored XSS (CVE-2020-29144, CVE-2020-29145)

Autoconfiguration ipv4 address 196.254.x.x IP Problem

Enjay CRM 1.0 - Multiple code executions via Unrestricted Terminal