CTF Arsenal
DFIR/Email Forensics

Email Header Analysis & Phishing Detection

Concept

Email headers record the actual delivery path (Received chain) and authentication results (SPF/DKIM/DMARC), which can confirm or contradict the claimed sender identity shown in the From field — the core of spotting spoofing and phishing.

When to Use

  • Challenge provides a .eml file or raw email headers.
  • Investigating a suspected phishing/spoofing incident.

Workflow

  1. 1
    Extract the full raw header block

    Not just the client's summary view.

  2. 2
    Read the Received chain bottom-to-top

    Reveals the true originating server.

  3. 3
    Check SPF/DKIM/DMARC results

    Pass/fail/none tells you if the domain was validated.

  4. 4
    Inspect links/attachments separately and safely

    Never open attachments directly; extract metadata/strings only.

Commands

cat FILE_PATH | head -50
cat phishing.eml | head -50

Views the raw header block of an .eml file as plain text.

When to use: First step — read headers as raw text rather than relying on a client's rendered 'From' display, which can be spoofed/misleading.

Expected output:

Received: from mail.attacker-infra.net ([203.0.113.9])
From: "IT Support" <support@company.com>
Authentication-Results: spf=fail ...

Look for: Mismatch between the claimed From domain and the actual sending server in Received/Authentication-Results.

Next step: Trace the full Received chain and check each authentication result field.

grep -i 'Authentication-Results' FILE_PATH
grep -i 'Authentication-Results' phishing.eml

Pulls out the receiving mail server's own SPF/DKIM/DMARC verdict for this message.

When to use: Quick check without manually reading the entire header block.

Expected output:

Authentication-Results: mx.company.com; spf=fail smtp.mailfrom=company.com; dkim=none; dmarc=fail

Look for: spf=fail/softfail, dkim=none/fail, dmarc=fail — any of these on a message claiming to be from a known domain is a strong spoofing indicator.

Next step: Cross-reference the IP in the Received header with the sender domain's actual published SPF record.

grep -i 'Received:' FILE_PATH
grep -i 'Received:' phishing.eml

Extracts every hop in the delivery chain; read from the bottom entry upward for the true path from origin to your inbox.

When to use: To identify the true originating IP/server, which intermediate relays can obscure if read top-down.

Expected output:

Received: from [10.0.0.5] by mx.company.com
Received: from mail.attacker-infra.net ([203.0.113.9]) by relay1.net

Look for: The earliest (bottom) entry — that's the actual origin, often not matching the claimed sender's real infrastructure.

Next step: Look up the originating IP's reputation/ownership (offline/whois data if available) as supporting evidence.

Tools

Thunderbird (View Source)

Mail client that can display the complete raw header block for an .eml file.

When to use: When a GUI view is preferable to grepping raw text.

Open the .eml, use 'View > Message Source' (or equivalent) to see raw headers.

Example workflow: Open file -> view source -> copy headers for detailed analysis.

ExifTool

Can extract metadata from any attachments (documents/images) without opening them in a vulnerable viewer.

When to use: Investigating a malicious-looking attachment's authorship/origin metadata safely.

exiftool attachment.docx

Example workflow: Extract the attachment from the .eml, run exiftool rather than opening it directly.

Findings & Interpretation

Interesting

  • SPF/DKIM/DMARC failures on an email claiming to be from a trusted internal domain
  • Originating IP geolocated/owned by infrastructure unrelated to the claimed sender

Suspicious

  • Reply-To address differing from the From address
  • URL display text not matching its actual href target

False Positives

  • Legitimate bulk-mail senders sometimes show soft SPF failures due to third-party sending infrastructure — context (is this plausible for this org?) matters

How to Validate

  • Confirm multiple independent indicators (auth results, Received chain, link mismatch) agree before concluding a message is malicious

Next Step

  • If a malicious URL/attachment is found, extract only its metadata/strings safely rather than opening it; feed any IOC into the Incident Response IOC-extraction step.

Troubleshooting

No Authentication-Results header present at all.

Likely cause: The receiving server didn't perform or record SPF/DKIM/DMARC checks, or the header was stripped before you received the sample.

Verify: Check whether other authentication-related headers exist (Received-SPF, DKIM-Signature) as an alternate source.

Fix: Rely on the Received chain and sender-domain comparison manually if authentication headers are absent.

Recovery: Note the limitation explicitly in your findings rather than guessing a verdict.

Avoid repeating: Don't assume absence of an auth header equals 'pass' — treat it as 'unknown', not a clean result.