#Why this matters
Phishing messages and leaked files rarely arrive without clues. An attacker can type any name into an email client's display From: field, yet the routing headers added by mail servers still record which IP address actually handed the message over. Likewise, a photo or PDF uploaded to a public page often carries embedded metadata revealing the software, username, creation time, or exact GPS coordinates where it was made.
Combining email header forensics with file metadata inspection turns surface artifacts into verifiable technical leads. Building on DNS and IP ownership lookups, you can check whether a sender was genuinely authorised by the claimed domain before trusting a message or attachment.
#Reading an email Received chain
An email has two sender identities: the envelope sender (Return-Path, used during SMTP delivery and bounces) and the header From (From:, displayed to the user). Mail transfer agents (MTAs) do not overwrite earlier routing history; instead, each server prepends a new Received: header to the top of the header block.
Because servers prepend at the top, you read Received: lines from bottom to top to follow time forward. However, a sender can insert fake Received: lines at the bottom before submitting the message. Start trusting the chain at the hop written by your own receiving mail server and work downward only as far as verified relays.
Return-Path: <bounce@mailer-promo.example.test>
Authentication-Results: mx.lab.local;
spf=pass smtp.mailfrom=mailer-promo.example.test;
dkim=none;
dmarc=fail (p=REJECT dis=NONE) header.from=portal-bank.example.test
Received: from mail.mailer-promo.example.test ([198.51.100.24])
by mx.lab.local with ESMTPS id k9a12; Thu, 15 Oct 2026 09:14:02 +0000
Received: from localhost (unknown [203.0.113.99])
by mail.mailer-promo.example.test with SMTP; Thu, 15 Oct 2026 09:13:55 +0000
From: "Security Team" <alerts@portal-bank.example.test>
Message-ID: <918273@mailer-promo.example.test>Notice the mismatch: mx.lab.local confirms the connection came from 198.51.100.24, while the visible From: claims portal-bank.example.test. Tools such as MXToolbox Header Analyzer parse long chains automatically, and dig lets you inspect the domain's published DNS records directly.
#Verifying SPF, DKIM and DMARC
Three complementary standards test whether a domain authorised a message. None is sufficient alone, because each covers a different part of the message.
| Mechanism | What it checks | DNS record location | Key limitation |
|---|---|---|---|
| SPF (RFC 7208) | Sending IP against Return-Path domain |
TXT at domain root |
Breaks on simple forwarding; ignores From: |
| DKIM (RFC 6376) | Cryptographic signature on headers and body | TXT at selector._domainkey.domain |
Any domain can sign its own spam |
| DMARC (RFC 7489) | Alignment of SPF or DKIM domain with From: |
TXT at _dmarc.domain |
Effectiveness depends on policy (p=reject vs p=none) |
Alignment is the key concept in DMARC. In the header excerpt above, SPF passed for mailer-promo.example.test, because 198.51.100.24 was allowed to send mail for mailer-promo.example.test. Yet DMARC failed, because mailer-promo.example.test does not align with the visible From: domain portal-bank.example.test, and no aligned DKIM signature was present.
$ dig +short TXT portal-bank.example.test
"v=spf1 ip4:192.0.2.10 -all"
$ dig +short TXT _dmarc.portal-bank.example.test
"v=DMARC1; p=reject; rua=mailto:dmarc@portal-bank.example.test"#Extracting file metadata and EXIF
Files created by phones, cameras and office suites embed metadata alongside the visible content. JPEG and TIFF images commonly store EXIF tags (Make, Model, DateTimeOriginal, GPSLatitude, GPSLongitude), while PDF and DOCX files record Author, Creator, Producer, and internal timestamps.
ExifTool reads and strips metadata across hundreds of formats from the command line without altering the file during inspection.
$ exiftool field_photo.jpg
ExifTool Version Number : 12.76
Camera Model Name : Pixel 8
Date/Time Original : 2026:10:14 14:22:10+05:00
GPS Position : 39 deg 39' 15.12" N, 66 deg 57' 34.92" E
$ exiftool -all= -o clean_photo.jpg field_photo.jpg
1 image files createdThe -all= flag removes writable metadata tags, and -o clean_photo.jpg writes a scrubbed copy while preserving the original evidence file. Always keep an unmodified original with its hash when documenting forensic evidence.
#Defending and common mistakes
- Reading
Receivedheaders top-to-bottom: Reversing the order attributes the origin to your own receiving server instead of the external sender. - Trusting
spf=passblindly: An attacker's own domain can pass SPF while spoofing someone else'sFrom:address unless DMARC alignment is checked and enforced (p=quarantineorp=reject). - Leaving EXIF and author tags on public uploads: Publishing unstripped screenshots, photos, or PDFs leaks employee usernames, internal software versions and office locations.
- Uploading sensitive files to public web analyzers: Never paste confidential emails or private documents into third-party websites; run
exiftooland header parsers locally.
#Summary
Email headers record every server hop in Received: lines from bottom to top, allowing analysts to locate the true sending IP beyond a forged From: display address. SPF validates the envelope sender IP, DKIM verifies cryptographic integrity, and DMARC ties them together through domain alignment. For attachments and images, ExifTool exposes hidden author, device, timestamp and GPS tags during investigations and removes them before safe publication.