From external to the CEO, a modern approach to outlook mail spoofing

Ben Wilson (Security Consultant · Tanto Security)

BSides Canberra VII (2024) · Day 1 · Main Track

Overview

In this compelling talk at BSides Canberra, Ben Wilson, a Security Consultant at Tanto Security, unveiled a series of sophisticated email spoofing techniques specifically targeting Microsoft Outlook. Titled "From External to the CEO, a Modern Approach to Outlook Mail Spoofing," Wilson's presentation meticulously dissected the underlying mechanisms of SMTP (Simple Mail Transfer Protocol) and exposed critical vulnerabilities arising from inconsistent email client parsing and an over-reliance on specific email headers for security validation. The research demonstrates how an attacker can bypass common email protections—including external tagging, safety tips, and even some third-party security products—to craft highly convincing phishing emails that appear to originate from legitimate internal sources, complete with sender profile pictures.

Watch on YouTube

Visual summary for From external to the CEO, a modern approach to outlook mail spoofing by Ben Wilson
Visual summary for From external to the CEO, a modern approach to outlook mail spoofing by Ben Wilson

Key moments

  1. 0:00 Talk introduction and overview of topics
  2. 6:00 Understanding SMTP headers and message content
  3. 20:45 Bypassing external tags with the Sender header
  4. 28:00 Hiding safety tips via unencrypted PGP syntax
  5. 40:00 The ultimate spoof: displaying Sender as From
  6. 42:00 Demonstration of the advanced Outlook spoofing technique
  7. 48:00 Anonymous sender trick and Microsoft's disclosure response

From External to the CEO, a Modern Approach to Outlook Mail Spoofing

Speakers: Ben Wilson (Security Consultant, Tanto Security)

Conference: BSides Canberra

YouTube: https://www.youtube.com/watch?v=c8zYNsnElsg

Overview

In this compelling talk at BSides Canberra, Ben Wilson, a Security Consultant at Tanto Security, unveiled a series of sophisticated email spoofing techniques specifically targeting Microsoft Outlook. Titled "From External to the CEO, a Modern Approach to Outlook Mail Spoofing," Wilson's presentation meticulously dissected the underlying mechanisms of SMTP (Simple Mail Transfer Protocol) and exposed critical vulnerabilities arising from inconsistent email client parsing and an over-reliance on specific email headers for security validation. The research demonstrates how an attacker can bypass common email protections—including external tagging, safety tips, and even some third-party security products—to craft highly convincing phishing emails that appear to originate from legitimate internal sources, complete with sender profile pictures.

Wilson's work is particularly significant because it challenges the efficacy of contemporary email security measures, especially within Microsoft's ecosystem. By exploiting nuances in how different email clients interpret message headers, he illustrates a pathway for threat actors to effectively impersonate high-value targets, such as a CEO, from an external domain. This talk is crucial for security professionals, system administrators, and anyone concerned with email security, as it highlights a gap in current defenses that could be leveraged for targeted spear-phishing campaigns, business email compromise (BEC) attacks, and other forms of social engineering.

The presentation not only details the technical exploits but also shares Microsoft's response to the disclosure, noting that the identified issues did not meet their "current bar for immediate servicing." This underscores the ongoing challenge of securing a protocol not originally designed with security in mind and emphasizes the need for organizations to understand and mitigate these advanced spoofing vectors proactively.

Background

▶ Watch: Talk introduction and overview of topics (0:00)

To understand the intricacies of modern email spoofing, it's essential to first grasp the fundamentals of how email operates. The backbone of email communication is the Simple Mail Transfer Protocol (SMTP), first defined in RFC 821 and later extended by MIME (Multi-Purpose Internet Mail Extensions, RFC 2045) and Extended SMTP (RFC 1869). At its core, SMTP enables mail user agents (MUAs) to send emails via message submission agents (MSAs) and mail transfer agents (MTAs) over specific ports (465/587 for submission, 25 for transfer) to ultimately reach the recipient's MUA.

An email message is fundamentally composed of two main parts: the SMTP envelope and the message content. The envelope, akin to a physical letter's envelope, contains commands like HELO (sender identification), MAIL FROM (sender's address), RCPT TO (recipient's address), and DATA (to introduce the message content). Crucially, the MAIL FROM and RCPT TO commands are responsible for routing the email. The message content, on the other hand, consists of SMTP headers (e.g., From, To, Subject, Content-Type) and the message body. A critical distinction highlighted in the talk is that SMTP headers within the message content are primarily for display purposes and are not inherently used for routing, unlike the envelope commands.

Over time, several email protections have been developed to combat spoofing and ensure message authenticity. The most common generic protections include:

  • SPF (Sender Policy Framework): Specifies which IP addresses are authorized to send email from a particular domain.
  • DKIM (DomainKeys Identified Mail): Uses a digital signature to verify that an email has not been altered in transit and that it originated from the claimed domain.
  • DMARC (Domain-based Message Authentication, Reporting, and Conformance): Builds upon SPF and DKIM, requiring alignment between the domain in the From header and the domains validated by SPF/DKIM. It also defines policies for handling messages that fail these checks (e.g., quarantine, reject).

Microsoft's Outlook environment introduces additional layers of protection, categorized into:

  • Mail Flow Rules: Customizable rules applied to messages in transit, often used for external tagging (e.g., adding [External] to the subject or body).
  • Native External Tagging: A newer Exchange Online feature that visually flags external senders without altering message content, inserting a warning and an "External" tag in the preview pane.
  • Anti-Phishing Policies: A comprehensive suite including Spoofing Detection (or spoof intelligence, reporting on sender/domain spoofing attempts and adding "unverified sender" indicators), Impersonation Protection (extra checks for specific email addresses or domains, like executives), Mailbox Intelligence (AI-driven detection of irregular email patterns), Safety Tips (e.g., "First Contact" safety tip for new senders, user/domain impersonation tips, inserted into the email body), and Phishing Thresholds (adjusting sensitivity based on Spam Confidence Level and Fishing Confidence Level scores).

A pivotal insight from Wilson's research is that all these Microsoft-specific protections, similar to DMARC, predominantly focus their analysis on the From header within the SMTP message content. This singular focus leaves other, less scrutinized headers vulnerable to manipulation, forming the basis of the advanced spoofing techniques presented.

Key Findings

▶ Watch: Bypassing external tags with the Sender header (20:45)

Ben Wilson's research uncovered several critical findings that collectively demonstrate a sophisticated approach to bypassing modern Outlook email security:

  1. Over-reliance on the From Header: A fundamental flaw across both generic and Microsoft-specific email protections is their disproportionate focus on validating the From header in the message content. This leaves other SMTP headers, particularly the Sender header, significantly less scrutinized and ripe for exploitation.
  1. Sender Header as a Spoofing Vector: The Sender header, intended to indicate the mailbox of the agent responsible for message transmission on behalf of the author, can be manipulated to display an arbitrary, unverified sender. When combined with a legitimate From header (from a controlled domain), Outlook displays the message as "Sender on behalf of From," with no validation performed on the Sender's display name or domain. This allows for the inclusion of internal domains or protected sender names without triggering impersonation alerts.
  1. Bypass of External Tagging: By including a Sender header with an internal domain (e.g., sender: James Bond <[email protected]>), the native external tagging and mail flow rule-based external tags are not applied. Outlook incorrectly interprets the message as internal, even when the actual MAIL FROM and From headers originate from an external, attacker-controlled domain.
  1. Circumvention of Safety Tips via PGP Syntax: While a direct CSS-based attempt to hide safety tips was patched by Microsoft (by using !important; revert inline CSS), Wilson discovered that the inclusion of PGP (Pretty Good Privacy) message indicators (-----BEGIN PGP MESSAGE----- and -----END PGP MESSAGE-----) within the email body completely prevents safety tips from being inserted. This works even if the content between the indicators is unencrypted and can be hidden within an HTML comment, making the bypass invisible to the end-user.
  1. From Header Confusion Exploits Parsing Inconsistencies: Mail user agents (MUAs) often have differing interpretations of the RFC (Request for Comments) standards for the From header. This inconsistency can be exploited by crafting a From header with multiple addresses (e.g., From: [email protected], [email protected]). Gmail might validate the last address, while Outlook might display the first, leading to successful spoofing of Gmail addresses to Outlook inboxes while still passing SPF and DMARC checks.
  1. Complete Sender Address Hiding: By combining "empty addresses" (<>) with non-rendering ASCII control characters (specifically \x1f) within the From header's display name, the actual sender's email address can be entirely suppressed from the recipient's view. This forces Outlook to fall back and display the Sender header's information, including the display name and even the profile picture of the impersonated user.
  1. Third-Party Security Product Evasion: The combined techniques successfully bypassed several tested third-party email security products, indicating a widespread blind spot in current defense mechanisms.

These findings highlight a significant gap in how email security is currently implemented and underscore the need for a more holistic approach to header validation across all email clients and security solutions.

Technical Deep Dive

▶ Watch: Hiding safety tips via unencrypted PGP syntax (28:00)

The core of Ben Wilson's research lies in exploiting the nuances of SMTP headers and the inconsistent parsing behavior of email clients, particularly Microsoft Outlook. His journey began by observing that standard email protections primarily scrutinize the From header. This led him to investigate other origination headers defined in the RFCs, specifically the Sender header.

The Sender header is described as the mailbox of the agent responsible for the transmission of the message. Unlike the From header, which denotes the original author, Sender indicates who actually dispatched the email on the author's behalf. When a Sender header is present, Outlook displays the sender information as "Sender on behalf of From." Wilson demonstrated that Outlook performs no validation on the display name or domain specified in the Sender header. This means an attacker can include an arbitrary display name and domain (e.g., sender: James Bond <[email protected]>) even if they don't own legit.com, and it will be displayed. This allowed him to reintroduce a display name for the spoofed target without triggering impersonation protections, as the From header still contained the legitimate, attacker-controlled domain.

A significant breakthrough was the bypass of native external tagging and mail flow rules. By setting the Sender header to an internal domain (e.g., sender: James Bond <[email protected]>), Outlook's internal logic incorrectly classifies the email as originating from within the organization. Consequently, the "External" tag, both in the email body and the preview pane, is suppressed. Furthermore, if the Sender header's email address corresponds to an existing user within the organization, hovering over the sender's name in Outlook will even bring up their legitimate profile, adding a layer of authenticity.

Next, Wilson tackled safety tips. Initially, he attempted to hide them using CSS inline styling within the email body. Since safety tips are inserted as HTML tables, he tried to apply display: none to the relevant TR element. While this initially worked, Microsoft quickly patched this vulnerability by adding !important; revert to every inline style tag of the safety tip, effectively preventing any CSS override. This robust fix by Microsoft forced Wilson to look for an alternative.

The alternative came in the form of PGP (Pretty Good Privacy) message indicators. Wilson discovered that inserting -----BEGIN PGP MESSAGE----- and -----END PGP MESSAGE----- anywhere in the email body, even if the content between them is unencrypted, prevents Outlook from inserting any safety tips. Outlook's parsing logic appears to detect these indicators and assumes the email is encrypted, thus skipping the insertion of safety tips. This technique works with both plain text and HTML content types. For maximum stealth, the PGP indicators can be embedded within an HTML comment (<!-- -----BEGIN PGP MESSAGE----- -->), making them completely invisible to the recipient while still effectively bypassing safety tip insertion. This also ensures that the actual message content, rather than the safety tip warning, appears in the email preview pane.

The next layer of sophistication involved "From Header Confusion." This technique exploits the fact that different mail user agents (MUAs) and MTAs interpret RFCs for From header parsing inconsistently. Wilson illustrated this with an example where a From header containing two addresses (From: [email protected], [email protected]) is sent from a Gmail account ([email protected]) to an Outlook inbox. Gmail, when sending, might validate the last address ([email protected]) against the MAIL FROM envelope sender. However, upon arrival, Outlook might display the first address ([email protected]). Since both domains (gmail.com) match, and Outlook cannot verify the user portion (e.g., spoofed vs attacker), the email successfully lands in the inbox, appearing to be from [email protected] and passing SPF/DKIM/DMARC checks because the legitimate gmail.com domain is used.

To achieve complete sender anonymity or full impersonation, Wilson combined several advanced techniques:

  1. Empty Addresses: By including an "empty address" (<>) followed by a comma before the legitimate From address (e.g., From: Display Name <>, [email protected]), the actual email address is hidden from the recipient's view, leaving only the display name. This requires a display name to be present, and a comma between the carrots is necessary to avoid being sent to junk, suggesting a prior, partial fix by Microsoft.
  2. Invisible Display Names with ASCII Control Characters: To prevent the display name itself from being rendered, Wilson experimented with ASCII control characters (the first 32 characters in the ASCII table). He found that certain characters, like \x1f (Unit Separator), when inserted into the display name (e.g., From: Test\x1f <>, [email protected]), are not rendered by Outlook's web and desktop clients. This makes the display name effectively invisible.

The ultimate combination of these techniques is where the true power of the spoofing lies. By crafting a From header with an empty address and an invisible ASCII control character for the display name, and simultaneously including a Sender header with the target's internal email address and display name, Outlook is forced to fall back. Because it cannot render a display name from the From header and the actual From address is hidden by the empty address technique, it defaults to displaying the information from the Sender header. This results in an email that appears to be directly from the impersonated user (e.g., "James Bond"), complete with their profile picture, with no external tags, no safety tips, and no "on behalf of" syntax. The actual sender's domain is completely masked from the user's immediate view.

Wilson also briefly touched on other "extra tricks":

  • Fake Recipients: Using RCPT TO commands for actual recipients while including additional, non-receiving addresses in the To header of the message content. This creates peer pressure or enables individual tracking links for mass emails that appear as a single group email.
  • Hiding Mail Flow Rules with CSS: Interestingly, while safety tip CSS bypass was patched, mail flow rule-inserted footers (e.g., #footer { display: none; }) could still be hidden with CSS.
  • Redirecting Replies: The Reply-To SMTP header can be used to redirect replies to an attacker-controlled address, preventing the legitimate impersonated victim from being alerted and allowing tracking of responses.
  • Meeting Invites Spoofing: Exploiting the ICal format (.ics files) used for meeting invites. By setting RSVP:FALSE for attendees, notifications to the organizer are suppressed. HTML content for meeting descriptions can be embedded using X-ALT-DESC, which also bypasses safety tips and mail flow rules.
  • Anonymous Sender: If no Sender header is provided, and the From header is manipulated with empty addresses and hex characters, Outlook fails to render any sender information, displaying the email as "Unknown." This creates opportunities for highly anonymous, unsettling messages.

Demo / Proof of Concept

▶ Watch: Demonstration of the advanced Outlook spoofing technique (42:00)

Ben Wilson presented a pre-recorded demonstration of the ultimate spoofing technique, aiming to avoid the unpredictability of a live demo. The demo showcased a script that meticulously constructed the malicious email headers and body.

On the left side of the screen, the script was visible, outlining the SMTP commands and headers being used:

  • HELO command.
  • MAIL FROM command: Specifying the attacker's controlled domain (tantomail.com).
  • RCPT TO command: Directing the email to the victim, John Doe.
  • DATA command: Containing the carefully crafted message content.

Within the DATA section, the following critical SMTP headers and message body were present:

  • From header: Manipulated with the empty address (<>) and an invisible ASCII control character (e.g., \x1f) within the display name, ensuring no sender address or visible display name from this header is rendered by Outlook. For example: From: Test\x1f <>, [email protected].
  • Sender header: Set to the impersonation target's details, including their display name and internal email address (e.g., Sender: James Bond <[email protected]>).
  • Message Body: Included the -----BEGIN PGP MESSAGE----- and -----END PGP MESSAGE----- indicators, hidden within an HTML comment, to bypass safety tips.

The script then sent this email to the victim, John Doe. On the right side of the screen, John Doe's Outlook inbox was displayed. After a brief delay, the email arrived.

The key visual outcomes of the demo were:

  • The email appeared to be from "James Bond", complete with James Bond's legitimate profile picture.
  • Crucially, there was no "External" tag visible in the email body or the preview pane.
  • No safety tips (e.g., "First Contact" or "Impersonation") were present above the message body.
  • The sender information in the preview pane and within the opened email showed only "James Bond" and his profile picture, with no "on behalf of" syntax or any indication of the attacker's tantomail.com domain.

The demonstration effectively proved that from the recipient's perspective, the email was indistinguishable from a legitimate internal message sent by James Bond. The only way for John Doe to discover the true origin would be to manually inspect the raw email headers, a task most users would not perform. Wilson emphasized that this technique also bypassed all tested third-party email security products, further highlighting its potency.

Defensive Implications

▶ Watch: Anonymous sender trick and Microsoft's disclosure response (48:00)

Ben Wilson's research reveals significant defensive implications for organizations, particularly those relying on Microsoft Outlook and its associated security features. The primary takeaway is that current email security paradigms, which heavily prioritize the From header for authentication, are insufficient. Defenders must broaden their scope of analysis to include other, less-scrutinized headers and account for client-side parsing inconsistencies.

Here are key defensive implications:

  1. Comprehensive Header Analysis: Organizations should implement or seek email security solutions that perform deep and comprehensive analysis of all relevant SMTP headers, not just the From header. Special attention should be paid to the Sender header and its relationship to the From and MAIL FROM envelope addresses. Anomalies, such as an external MAIL FROM combined with an internal Sender domain, should trigger high-confidence alerts.
  1. Educate Users on Email Source Inspection: While not a primary defense, users, especially those in high-risk roles (e.g., executives, finance), should be trained on how to view raw email headers in Outlook. This provides a last line of defense for identifying the true sender, though it's acknowledged that most users will not perform this action.
  1. Review Mail Flow Rules and External Tagging: While external tagging was bypassed in this research, it remains a valuable defense. Organizations should ensure their mail flow rules for external tagging are robust and consider secondary indicators or alternative tagging methods if possible. The bypass of external tagging via the Sender header with an internal domain is a critical vulnerability to address.
  1. Strengthen Impersonation Protection: While impersonation protection was configured in the demo environment, the ultimate technique still bypassed it. Defenders should regularly review and enhance their impersonation protection policies, potentially extending them to cover more subtle forms of display name spoofing or unexpected Sender header usage.
  1. Beware of PGP Indicator Abuse: The use of PGP message syntax (-----BEGIN PGP MESSAGE-----) to bypass safety tips is a novel technique. Email gateways and security solutions should be updated to recognize and scrutinize emails containing these indicators, especially if the message content is not actually encrypted, or if they appear within HTML comments. This could be a strong indicator of malicious intent.
  1. Address From Header Confusion: The inconsistencies in how different mail user agents parse From headers need to be mitigated. While difficult for a single organization to control, security products could implement more stringent validation or flag emails where the displayed From address differs significantly from the MAIL FROM envelope sender or other authenticated headers.
  1. Monitor for ASCII Control Characters: The use of non-rendering ASCII control characters (like \x1f) in display names or addresses is highly suspicious. Email gateways should be configured to detect and flag or quarantine emails containing such characters in critical header fields.
  1. Re-evaluate Reply-To Header Usage: The Reply-To header can be used to redirect replies to an attacker's address. Defenders should implement policies or warnings for users when the Reply-To address differs from the From address, especially if the Reply-To address is external or suspicious.
  1. Consider Anonymous Sender Scenarios: The "Unknown" sender scenario, while less convincing for direct impersonation, still poses a risk for social engineering. Security solutions should flag emails with completely unidentifiable sender information.
  1. Engage with Vendors: Wilson's disclosure to Microsoft, which did not lead to immediate servicing, highlights an ongoing challenge. Organizations should advocate for vendors to enhance their email parsing and security mechanisms to address these advanced spoofing vectors proactively. This includes pushing for more consistent RFC compliance across email clients.

In summary, the focus must shift from merely authenticating the top-level From address to a holistic, context-aware analysis of the entire email structure, including all headers, their interrelationships, and potential client-side parsing discrepancies.

Key Takeaways

  • Over-reliance on the From header creates blind spots: Many email security protections, including Microsoft's native features, primarily validate the From header, leaving other critical headers like Sender vulnerable to manipulation.
  • The Sender header is a powerful spoofing vector: By using a Sender header with an internal domain, attackers can bypass external tagging and impersonation protections, making external emails appear internal and legitimate.
  • PGP syntax can circumvent safety tips: Inserting -----BEGIN PGP MESSAGE----- indicators, even in unencrypted HTML comments, prevents Outlook from displaying safety tips, making phishing emails appear cleaner and more trustworthy.
  • Email client parsing inconsistencies are exploitable: "From Header Confusion" allows attackers to craft From headers that display a spoofed address in Outlook while passing SPF/DKIM/DMARC checks due to differing validation logic in sending email clients.
  • Advanced header manipulation enables full sender disguise: Combining empty addresses (<>) with non-rendering ASCII control characters (e.g., \x1f) in the From header forces Outlook to display the Sender header's information, including the target's profile picture, completely masking the true sender.
  • Third-party security products may not detect these advanced techniques: The demonstrated methods successfully bypassed several tested security solutions, indicating a potential widespread vulnerability that requires immediate attention from vendors and organizations.

About the Speaker(s)

Ben Wilson is a Security Consultant at Tanto Security. He is currently in his final year as a computer science student. Wilson has a keen interest in physical security and is passionate about diving deep into security research, as evidenced by his detailed exploration of email spoofing techniques presented in this talk. His work aims to uncover vulnerabilities in widely used systems and contribute to improving overall cybersecurity defenses.

Reviews

  • Dr. Zero (Offensive Security Researcher) — MUST SEE ★★★★★
  • Heather Calloway (CISO) — MUST SEE ★★★★★

→ Top-rated talks at BSides Canberra VII (2024)

All talks from BSides Canberra VII (2024)