---
title: "Offline Email Header Phishing Analyzer: RFC 5322 Hops, SPF/DKIM/DMARC Alignment & IOC Defanging Guide"
author: "Kshitij Gupta"
author_url: "https://theinfosiast.com/about-us/"
author_linkedin: "https://www.linkedin.com/in/kshitij-gupta-855535134/"
publisher: "The Infosiast"
canonical_url: "https://theinfosiast.com/email-header-phishing-analyzer/"
pillar: "Cybersecurity"
date_published: "2026-12-03"
date_modified: "2026-12-03"
interactive_tool_url: "https://theinfosiast.com/email-header-phishing-analyzer/#ti-ip-inspector"
---

# Offline Email Header Phishing Analyzer: RFC 5322 Hops, SPF/DKIM/DMARC Alignment & IOC Defanging Guide

> **Canonical Citation URL**: [https://theinfosiast.com/email-header-phishing-analyzer/](https://theinfosiast.com/email-header-phishing-analyzer/)  
> **Author**: [Kshitij Gupta](https://www.linkedin.com/in/kshitij-gupta-855535134/) | **Publication**: [The Infosiast](https://theinfosiast.com/)
> **Interactive Browser Utility**: [https://theinfosiast.com/email-header-phishing-analyzer/#ti-ip-inspector](https://theinfosiast.com/email-header-phishing-analyzer/#ti-ip-inspector)

**An email header phishing analyzer inspects the hidden SMTP routing envelope, cryptographic signature results, and domain-alignment headers that email clients hide from view.** While a message's visible display name and sender address can be forged in seconds, the receiving mail server's `Authentication-Results` and chronological `Received` trace expose how the message actually traveled across the internet. Use the offline analyzer below to inspect raw `.eml` headers entirely inside your browser—zero bytes leave your device.

      100% Local Browser Execution • Zero Network Uploads

## Interactive Offline Email Header & Phishing Hop Analyzer

      Paste raw RFC 5322 headers (from Gmail “Show Original”, Outlook “View Message Source”, or an `.eml` file) to verify SPF/DKIM/DMARC alignment, decode RFC 2047 MIME subjects, trace SMTP hops, and defang IOCs.

      Export JSON
      Export CSV

    Sample: BEC Invoice Spoof
    Sample: Aligned DKIM/DMARC Pass
    Sample: Clock Skew & CGNAT Relay

  Raw Email Headers (RFC 5322 / .eml)

    Analyze Headers Locally
    Clear
    Verify 0 network requests in Browser DevTools → Network tab.

      **Ready to analyze email headers...**
      0 / 100

### 1. Decoded Sender Identity & Alignment Summary

### 2. Chronological SMTP Received Hop Trace (Origin → Inbox)

| Hop | From Host | By Server | IP & RFC Class | Protocol | UTC Timestamp & Delay |
| --- | --- | --- | --- | --- | --- |

### 3. Security Findings & Spoofing Indicators

### 4. Extracted IOCs (CyberChef-Style Defanger / Refanger)

      Switch to Refanged (Live)
      Copy IOCs

```

```

## Why Email Header Forensics Must Run Offline in Your Browser

Security operations teams, finance departments, and individuals routinely receive suspicious invoices, wire-transfer updates, password-reset warnings, and spoofed executive messages. When investigating whether an email is authentic, copying raw headers into a remote third-party web parser introduces an immediate data-leakage risk. Raw RFC 5322 email headers frequently disclose internal corporate hostnames, private RFC 1918 mail-relay topology, employee email addresses, confidential subject lines, invoice numbers, tenant identifiers, and sometimes authentication tokens embedded in tracking URLs.

Uploading raw headers to an external server hands that sensitive metadata to an unknown operator whose logging and retention policies you cannot audit. By running RFC 5322 unfolding, RFC 2047 MIME decoding, RFC 8601 authentication inspection, and indicator defanging purely in local client-side JavaScript, you can triage sensitive Business Email Compromise (BEC) evidence without transmitting a single byte across the network. This architecture mirrors the local-processing philosophy behind open-source analyst toolkits such as GCHQ CyberChef while delivering a focused, lightweight workflow tailored specifically to phishing triage and incident documentation.

If you are investigating a suspicious payment request or urgent invoice modification right now, pair this analyzer with our [payment request and invoice fraud verification guide](https://theinfosiast.com/payment-request-scams/) and our [global online safety and evidence preservation guide](https://theinfosiast.com/online-safety-guide/) before releasing any funds or replying to the thread.

## Anatomy of an RFC 5322 Email: Envelope vs. Header Identities

Most email spoofing succeeds because the Simple Mail Transfer Protocol (SMTP, standardized in IETF RFC 5321) separates the **transport envelope** from the **message headers** defined in IETF RFC 5322. Think of an email like a physical letter inside a mailing envelope: the return address printed on the outside envelope does not have to match the letterhead printed inside the folded page.

When a sending mail transfer agent (MTA) transmits a message, it declares an envelope sender via the `MAIL FROM` SMTP command. Receiving servers record that envelope sender inside the `Return-Path` header upon delivery. Separately, inside the message payload itself, the sender supplies a `From` header (which email clients display prominently to users) and an optional `Reply-To` header (which dictates where replies actually go when a recipient hits Reply).

| Header Field | RFC Standard | Role in Mail Delivery | How Phishing & BEC Attackers Abuse It |
| --- | --- | --- | --- |
| `From` | RFC 5322 §3.6.2 | Human-visible author identity shown in inbox lists | Forged display names, lookalike Punycode domains, or direct domain spoofing when DMARC is unenforced |
| `Return-Path` | RFC 5321 §4.4 | SMTP envelope bounce address evaluated by SPF | Set to an attacker-controlled domain with a valid SPF record so SPF passes while `From` impersonates a brand |
| `Reply-To` | RFC 5322 §3.6.2 | Overrides destination address when recipient clicks Reply | Classic BEC diversion: email claims to come from a vendor or executive, but replies silently route to a lookalike attacker mailbox |
| `Received` | RFC 5321 §4.4 | Prepended trace stamp added by every mail relay in transit | Attackers can prepend fake bottom hops before transmission, so analysts must anchor trust starting from their own inbound MX at the top |
| `Authentication-Results` | RFC 8601 | Summarizes SPF, DKIM, DMARC, and ARC verdicts computed by your receiving MTA | Spoofed headers inserted prior to delivery; always trust only the topmost `Authentication-Results` emitted by your own mail gateway |
| `Message-ID` | RFC 5322 §3.6.4 | Globally unique identifier stamped by originating mail software | Often reveals bulk-phishing toolkits, compromised webmail scripts, or unrelated hosting domains |

### Understanding Header Folding and RFC 2047 Encoded Words

Raw email headers frequently wrap long values across multiple physical lines using CRLF followed by one or more spaces or tabs (a mechanism RFC 5322 calls *folding*). A naive line-by-line regex parser breaks whenever an `Authentication-Results` or `DKIM-Signature` header spans six lines. Proper forensic parsers first unfold continuation whitespace back into logical header records before evaluating authentication tags.

Attackers also exploit **RFC 2047 MIME encoded-word syntax** (`=?UTF-8?B?...?=` for Base64 or `=?UTF-8?Q?...?=` for Quoted-Printable) inside `Subject` and `From` headers. While RFC 2047 was created legitimately to transmit international scripts cleanly over 7-bit ASCII SMTP, phishing kits abuse it to conceal urgency keywords, zero-width spaces, or right-to-left override characters from simplistic text filters. Decoding RFC 2047 locally reveals the exact Unicode text your mail client will display to a victim.

## Deep Dive: SPF, DKIM, DMARC, and ARC Authentication Mechanics

A common misconception even among experienced IT staff is that seeing `spf=pass` or `dkim=pass` proves an email is genuine. In reality, SPF and DKIM verify distinct cryptographic and network properties that an attacker can satisfy using their own freshly registered domain unless **DMARC identifier alignment** binds those results to the visible `From` header.

### 1. Sender Policy Framework (SPF — IETF RFC 7208)

SPF allows a domain owner to publish a DNS `TXT` record enumerating which IPv4 ranges, IPv6 prefixes, or third-party mail services are authorized to send mail on behalf of that domain. When your inbound mail server accepts an SMTP connection from an IP address—for example, `203.0.113.88`—it checks the SPF record published for the **envelope sender domain** (`Return-Path` / `smtp.mailfrom`), *not* the visible `From` header.

Because SPF validates only the envelope domain, an attacker who controls `mail-dispatch.example.net` can publish a perfectly valid SPF record authorizing their VPS IP, pass SPF with flying colors, and still place `billing@trusted-vendor.example.com` inside the visible `From` header. Additionally, SPF breaks naturally whenever legitimate mail passes through an automated forwarding alias, because the forwarding server's IP is rarely listed in the original sender's SPF record.

### 2. DomainKeys Identified Mail (DKIM — IETF RFC 6376)

DKIM adds an asymmetric cryptographic signature (typically RSA-2048 or Ed25519 under RFC 8463) inside the `DKIM-Signature` header. The sending server hashes the message body (`bh=`) and a selected list of critical headers (`h=from:to:subject:date`), signs that digest with a private key, and specifies the signing domain (`d=`) and DNS selector (`s=`). The receiver queries `<selector>._domainkey.<d-domain>` in DNS to fetch the public key and verifies that neither the signed headers nor the body were altered in transit.

Unlike SPF, DKIM survives simple email forwarding as long as no intermediate server alters the signed headers or appends footer disclaimers that break the body hash. However, just like SPF, a `dkim=pass` verdict alone proves only that *whichever domain appears in `header.d=`* signed the message. If an attacker signs a spoofed invoice using their own domain `d=mail-dispatch.example.net`, DKIM validates cryptographically even though the visible sender claims to be a trusted supplier.

### 3. Domain-based Message Authentication, Reporting, and Conformance (DMARC — IETF RFC 7489)

DMARC closes the gap between SPF, DKIM, and the human-visible `From` header through **Identifier Alignment**. For an email to achieve `dmarc=pass`, at least one of the following two conditions must hold simultaneously:

  - **SPF Pass + SPF Alignment:** SPF evaluates to `pass` AND the `Return-Path` domain aligns with the visible `From` domain (exact match under strict alignment `aspf=s`, or shared organizational domain under relaxed alignment `aspf=r`).

  - **DKIM Pass + DKIM Alignment:** DKIM evaluates to `pass` AND the signing domain `header.d=` aligns with the visible `From` domain (strict `adkim=s` or relaxed `adkim=r`).

Domain owners publish their enforcement policy at `_dmarc.<domain>` using `p=none` (monitor only), `p=quarantine` (route failures to spam/junk), or `p=reject` (block delivery outright). Crucially, remember that DMARC does **not** stop lookalike domains (such as `trusted-vend0r.example.com` or `vendor-wire-update.example.org`) or compromised legitimate mailboxes—if an attacker controls a lookalike domain or steals a real employee's session cookie, SPF, DKIM, and DMARC can all legitimately return `pass`. That is why defending corporate mailboxes with phishing-resistant authentication covered in our [passkeys vs. passwords security guide](https://theinfosiast.com/passkeys-vs-passwords-2026-security-guide/) remains indispensable.

### 4. Authenticated Received Chain (ARC — IETF RFC 8617)

When legitimate messages travel through mailing lists, cloud security gateways, or university forwarding relays, both SPF (IP changed) and DKIM (subject tag or footer modified) can fail downstream. ARC preserves the chain of authentication results evaluated by earlier trusted intermediaries via three coordinated headers: `ARC-Authentication-Results`, `ARC-Message-Signature`, and `ARC-Seal`. When analyzing forwarded business email, seeing `arc=pass` alongside a trusted intermediary seal helps distinguish a legitimate mailing-list forward from a forged spoof.

```
# Example RFC 8601 Authentication-Results illustrating an unaligned BEC spoof
Authentication-Results: mx-inbound.acme-buyer.example.com;
  spf=pass smtp.mailfrom=bounce@attacker-relay.example.net;
  dkim=pass header.d=attacker-relay.example.net header.s=s1;
  dmarc=fail (p=REJECT sp=REJECT) header.from=trusted-vendor.example.com;
  arc=none

# Notice why SPF + DKIM both passed, yet DMARC failed:
#   Return-Path domain  = attacker-relay.example.net  (does NOT align with From)
#   DKIM header.d       = attacker-relay.example.net  (does NOT align with From)
#   Visible From domain = trusted-vendor.example.com  (unauthenticated spoof!)
```

## How to Read SMTP Received Hops Without Falling for Spoofed Traces

Every mail transfer agent that handles an email prepends a new `Received:` header at the **top** of the header block. Consequently, raw email headers read in reverse chronological order: the topmost `Received` header was written by your own mailbox provider moments before delivery, while the bottommost `Received` header represents the claimed origin.

Because an attacker can inject arbitrary fake `Received` lines into a message *before* handing it to the first real mail server, forensic analysts always establish a **trust boundary** starting from the top down:

  - **Locate your own organization's inbound gateway:** Identify the topmost `Received: ... by <your-mx-hostname>` header written by infrastructure you control (e.g., Google Workspace, Microsoft 365, Fastmail, or your corporate SMTP gateway). Everything above and including that hop's `from [IP]` statement is trustworthy evidence of which external host actually connected to your network.

  - **Trace backward across external relays:** Compare the `from` IP recorded by your gateway against the `by` hostname of the immediately preceding hop. Sudden jumps between unrelated autonomous systems, residential ISP pools, or Carrier-Grade NAT ranges (RFC 6598 `100.64.0.0/10`) are strong red flags for compromised endpoints or residential botnets. You can inspect any extracted public IPv4/IPv6 address further in our [interactive IP and RFC range inspector](https://theinfosiast.com/find-your-ip-address/#ti-ip-inspector).

  - **Check hop-to-hop timestamp deltas:** Convert all hop timestamps to UTC (RFC 5322 timestamps may carry different timezone offsets like `-0500` or `+0200`). Small negative deltas of 1–3 seconds can occur due to minor NTP drift between servers, whereas large negative jumps (for example, `-60s` or more) or multi-hour queues between obscure relays frequently indicate forged origin headers, throttled spam queues, or misconfigured compromised servers.

  - **Check transport encryption (`with ESMTPS` vs. `with SMTP`):** Modern mail servers negotiate STARTTLS (`ESMTPS` or `ESMTPSA`) on inter-server relays. Plain `with SMTP` without TLS on an external hop reveals legacy or stripped-down spam infrastructure.

## Common Phishing & Business Email Compromise (BEC) Header Patterns

Across real-world fraud investigations, four header signatures account for the vast majority of high-loss corporate and consumer email attacks:

| Attack Pattern | Header Signature in Raw .eml | Immediate Containment Action |
| --- | --- | --- |
| Reply-To BEC Redirection | `From` shows executive or supplier; `Reply-To` points to a free webmail or lookalike domain (`-billing.example.org`) | Do not reply inside the thread; call the vendor using a phone number from your existing master vendor record |
| Lookalike Domain + Valid Auth | SPF, DKIM, and DMARC all return `pass`, but `From` uses a cousin domain or IDN Punycode (`xn--`) | Check domain registration age and inspect embedded links with our [Scam URL Triage Checker](https://theinfosiast.com/whatsapp-task-scams/#ti-scam-checker) |
| Compromised Vendor Mailbox | Genuine vendor domain passes SPF/DKIM/DMARC, but originating IP or `X-Originating-IP` / user-agent differs from past vendor threads | Alert the vendor's security team out-of-band; inspect any suspicious OAuth sessions or tokens in our [JWT & OAuth Token Inspector](https://theinfosiast.com/jwt-oauth-token-security-inspector/) |
| Bulk Relay + Missing DMARC | `spf=pass` on marketing relay domain, `dmarc=none` or `fail`, RFC 2047 Base64-encoded urgent subject | Quarantine message, extract defanged IOCs, and tighten your own domain's DMARC record to `p=reject` |

## Why SOC Analysts Defang URLs and IP Addresses Before Sharing Reports

Once you extract suspicious sending IP addresses and phishing URLs from an email header, pasting live clickable links into a helpdesk ticket, chat channel, or incident report creates a secondary hazard: another employee, automated link-preview bot, or security scanner might accidentally click or pre-fetch the URL. Pre-fetching a phishing URL can alert the attacker that the target opened the lure, trigger unique tracking tokens tied to a victim's email address, or expose an unpatched client to drive-by downloads.

Following CyberChef and threat-intelligence sharing conventions, **defanging** replaces active scheme and delimiter characters so no messaging platform or browser renders them as clickable hyperlinks: `https://` becomes `hxxps[://]`, `http://` becomes `hxxp[://]`, and dots inside domains and IPv4 addresses become `[.]` (for example, `203[.]0[.]113[.]88` and `portal-verify[.]example[.]org`). When an authorized analyst later needs to query those indicators inside a sandbox or firewall blocklist, the one-click **Refang** toggle restores exact machine-readable syntax without manual find-and-replace errors.

## How to Retrieve Raw Email Headers Across Major Mail Clients

To get accurate results from this analyzer, always export the complete raw header block—never copy only the formatted “From / To / Subject” summary shown above the email body:

  - **Gmail (Web):** Open the email, click the three-dot *More* menu next to the Reply icon, select **Show original**, and click **Copy to clipboard** (or Download Original as an `.eml` file).

  - **Outlook on the Web / Microsoft 365:** Open the email, click the three-dot *More actions* icon, choose **View → View message details** (or **View message source**), and copy the full header text.

  - **Apple Mail (macOS):** Select the message, then choose **View → Message → Raw Source** (shortcut `Option + Command + U`) and copy everything down to the first blank line.

  - **Mozilla Thunderbird:** Open the email and press `Ctrl + U` (Windows/Linux) or `Command + U` (macOS) to inspect the raw RFC 5322 source.

## Domain Hardening Checklist for Mail Administrators

Analyzing phishing headers defensively is only half the battle; publishing strict DNS authentication records prevents attackers from impersonating your own brand in outbound campaigns:

  - **Keep SPF lookups under the 10-lookup limit (RFC 7208 §4.6.4):** Exceeding 10 nested DNS lookups causes `spf=permerror`, breaking legitimate mail delivery. End production records with `-all` (hardfail) once all legitimate SaaS senders are inventoried.

  - **Sign with 2048-bit RSA or Ed25519 DKIM keys and rotate selectors:** Avoid legacy 1024-bit DKIM keys. Rotate selectors (`s=s2026a` → `s=s2026b`) on a regular schedule and align `d=` with your organizational sending domain.

  - **Move DMARC from `p=none` to `p=quarantine` and `p=reject`:** Collect aggregate XML reports (`rua=`) until legitimate third-party senders achieve >99% alignment, then enforce `p=reject` and `sp=reject` (protecting unused subdomains).

  - **Deploy MTA-STS (RFC 8461) and TLS-RPT (RFC 8460):** Enforce TLS encryption for inbound SMTP deliveries so active network adversaries cannot downgrade inter-server connections to plaintext. You can also audit your mail server's TLS certificate chain offline with our [X.509 PEM Certificate & PQC Inspector](https://theinfosiast.com/x509-pem-certificate-inspector/).

  - **Protect mailbox access with FIDO2/WebAuthn passkeys:** Even a strict `p=reject` DMARC policy cannot block an attacker who hijacks a real employee's session cookie or password. Enforce phishing-resistant sign-in across every email and admin portal—see our [passkey vault architecture guide](https://theinfosiast.com/passkeys-vs-password-managers/) and [interactive cybersecurity tools directory](https://theinfosiast.com/tools/).

## Frequently Asked Questions About Email Header Phishing Analysis

### Is it safe to paste confidential corporate email headers into this analyzer?

    Yes. All RFC 5322 header unfolding, RFC 2047 decoding, authentication parsing, hop tracing, and CSV or JSON export run 100% locally inside your web browser with zero backend uploads or network requests. You can verify zero outbound traffic directly in your browser's DevTools Network tab.

### Can a phishing email pass both SPF and DKIM checks?

    Yes. An attacker can send from their own domain with valid SPF and DKIM records while spoofing a different visible From address (which fails DMARC alignment), or send from a lookalike domain or compromised genuine mailbox where SPF, DKIM, and DMARC all pass. Always inspect domain alignment and Reply-To headers alongside authentication results.

### In what order should you read SMTP Received headers?

    Raw email headers stack chronologically from bottom to top, meaning the newest relay sits at the top and the claimed origin sits at the bottom. Start verifying from the top at your own trusted inbound mail server and work downward, because attackers can fabricate fake Received lines below your gateway's trust boundary.

### Why is a Reply-To domain mismatch a major Business Email Compromise red flag?

    In Business Email Compromise attacks, scammers often impersonate an executive or supplier in the From field while setting Reply-To to an attacker-controlled lookalike domain or free webmail account. When the recipient hits Reply to confirm an invoice or wire transfer, the conversation silently diverts to the attacker instead of the real contact.

### What does defanging a phishing URL or IP address do?

    Defanging alters active protocol and dot delimiters—turning https:// into hxxps[://] and periods into [.]—so links and IP addresses cannot be clicked or auto-fetched by chat apps, email clients, or ticketing platforms while security teams document and share an incident report.

## Primary Technical Standards & References

  - IETF RFC 5321 — Simple Mail Transfer Protocol (SMTP) & Trace Information (`Received` / `Return-Path`)

  - IETF RFC 5322 — Internet Message Format (Header Folding, `From`, `Reply-To`, `Message-ID`)

  - IETF RFC 2047 — MIME Message Header Extensions for Non-ASCII Text

  - IETF RFC 7208 (SPF), RFC 6376 (DKIM), RFC 7489 (DMARC), RFC 8601 (`Authentication-Results`), and RFC 8617 (ARC)

  - IETF RFC 1918 (Private IPv4), RFC 6598 (Shared CGNAT Space), and RFC 4193 (Unique Local IPv6)

**Written and prepared by [Kshitij Gupta](https://www.linkedin.com/in/kshitij-gupta-855535134/).**
