Skip to content

Email Header Analysis and Sender Tracing

Email headers record the full relay path of a message, from the originating mail client through every server that handled it, and encode authentication outcomes at each hop. Investigators parse these headers to identify the true source IP address, detect spoofing, interpret SPF, DKIM, and DMARC results, and build the legal basis for subscriber record requests.

Last updated:

Share

Every email message carries a header section, invisible in most mail clients, that records the technical journey of the message from its point of origin to the recipient's inbox. Each server that accepts and forwards the message prepends a Received header line, so the complete chain reads from bottom to top, with the oldest entry at the bottom and the most recent at the top. Alongside the relay chain, the header records authentication results: whether the sending server was authorised under SPF, whether the message body was signed under DKIM, and whether the visible From address aligns with those checks under DMARC. For a cyber investigator, this chain is the primary artefact for identifying the originating IP address, detecting spoofed sender addresses, assessing whether authentication mechanisms were bypassed, and building the foundation for a legal request to an internet service provider for subscriber records.

Email spoofing is a common vector in phishing, business email compromise, and impersonation fraud. Attackers set the From header to a trusted domain while routing the message through an unrelated server. Header analysis can expose this mismatch: the Received chain will show an IP address that does not belong to the claimed sending domain, and the authentication results will show SPF fail and DKIM fail. Investigators in India, the United States, the United Kingdom, the European Union, and other jurisdictions increasingly rely on header analysis as the first step before seeking subscriber records from providers, because the header evidence establishes the specific IP and timestamp needed to make the legal request useful.

The technique requires no specialised hardware. Investigators work with the raw message source, which any mail client can export. The key skills are reading the Received chain in the correct order, distinguishing forged display headers from server-added relay headers, interpreting the structured Authentication-Results field, and knowing which headers are legally significant. Familiarity with IP addressing and routing fundamentals and DNS and domain investigation supports the lookup steps that follow initial header parsing.

By the end of this topic you will be able to:

  • Read a Received header chain in the correct direction and identify the originating IP address of an email message.
  • Distinguish server-added relay headers from client-controlled display headers and explain why the latter can be freely forged.
  • Interpret SPF, DKIM, and DMARC results recorded in the Authentication-Results header and explain what each failure indicates about the message.
  • Construct an investigative timeline from header timestamps and assess timestamp reliability.
  • Describe the legal process for converting a traced IP address into subscriber identity information under Indian, US, UK, and EU frameworks.
Key terms
Received header
A header line prepended by each mail server that accepts a message in transit, recording the server's own identity, the IP or hostname it received the message from, and a timestamp. Reading from bottom to top reveals the relay path.
SPF (Sender Policy Framework)
A DNS-based mechanism by which a domain owner publishes the list of IP addresses authorised to send mail for that domain. A receiving server checks whether the envelope sender's domain authorises the connecting IP and records the result as pass, fail, softfail, neutral, or none.
DKIM (DomainKeys Identified Mail)
A cryptographic signing mechanism: the sending server signs the message headers and body with a private key, and the receiving server verifies the signature using the public key published in DNS. A valid DKIM signature proves the message was not altered in transit and was signed by the claimed domain.
DMARC (Domain-based Message Authentication, Reporting, and Conformance)
A policy layer that requires the domain in the visible From header to align with a domain that passes SPF or DKIM. A DMARC fail means neither SPF nor DKIM produced a passing result aligned with the From domain, which is strong evidence of spoofing.
Message-ID
A globally unique identifier assigned to each message by the originating mail server, recorded in the Message-ID header. It is set by the sending MTA and can be forged, but the domain portion often reveals the sending platform or provider.
Envelope sender (Return-Path)
The address used at the SMTP protocol level for bounce notifications, recorded in the Return-Path header. It is distinct from the display From address and is what SPF checks. Attackers often spoof the From but not the Return-Path, which creates an inconsistency that header analysis exposes.

Structure of an email header

An email message consists of two parts separated by a blank line: the header section and the body. The header section is a series of name-value pairs, each on its own line (with long values wrapped using whitespace). Many headers are set by the sender's mail client or the originating mail server: From, To, Subject, Date, Message-ID, Reply-To, and Content-Type. These are client-controlled and can be freely set to any value the sender chooses. An attacker composing a phishing email can write any address in the From field.

The headers that matter most for forensic analysis are those added by servers in transit, because the sender's client cannot control what subsequent servers write. Every server that receives the message and passes it along prepends a new Received header at the top of the existing header block. This means the Received headers accumulate in reverse chronological order: the top Received line was added by the server closest to the recipient, and the bottom Received line was added by the first server to accept the message from the sender.

A typical Received line contains: the hostname or IP the message was received from, the hostname of the receiving server, the protocol used (SMTP, ESMTP, ESMTPS), and a timestamp in RFC 2822 format. A minimally informative example reads: Received: from mail.attacker.com (203.0.113.45) by mx.victim.com with ESMTP; Mon, 23 Jun 2025 14:22:01 +0530. The IP in parentheses is the address the receiving server observed the connection coming from. That IP is the forensic data point: it is what the server recorded, not what the sender declared.

HeaderSet byCan be forged by sender?Forensic value
FromSender's mail clientYes, freelyIdentifies claimed sender; confirm against Received chain
Return-PathSending MTAYes, but often inconsistent with From in spoofsSPF checks this domain; mismatch with From is a spoofing indicator
ReceivedEach relay serverNo (server adds its own)Primary chain of custody; reveals originating IP
Message-IDOriginating MTAYesDomain portion may indicate sending platform
Authentication-ResultsReceiving serverNo (server adds it)Records SPF, DKIM, DMARC pass/fail for that hop
X-Originating-IPSome providersSometimesMay record client IP; non-standard and provider-specific

Tracing the originating IP address

The goal of Received-chain analysis is to identify the IP address from which the message first entered the public mail infrastructure. Starting from the bottom Received line, read the IP address recorded in parentheses after the from clause. This is the address the first public-facing receiving server observed. If the bottom line shows a private IP range (10.x, 172.16-31.x, 192.168.x), the message was submitted from inside a local network and the next line up is the first external hop.

Once the candidate IP is identified, look it up with WHOIS and in a Regional Internet Registry database. ARIN covers North America, RIPE NCC covers Europe and the Middle East, APNIC covers Asia-Pacific, LACNIC covers Latin America, and AFRINIC covers Africa. The lookup returns the organisation that holds the IP block, the allocation date, and contact details. If the IP belongs to a consumer ISP, the next step is a legal request for subscriber records. If it belongs to a cloud provider, VPN service, or Tor exit node, the interpretation changes: the IP identifies the service, not the individual.

Check the geolocation of the IP using a service such as MaxMind GeoLite2 or ipinfo.io. Geolocation is approximate, not reliable to city level, but country-level accuracy is generally high and can immediately flag whether the originating country is inconsistent with the claimed sender. A message claiming to be from a bank headquartered in one country but originating from an IP geolocated to a different continent is a strong indicator of fraud.

Interpreting SPF, DKIM, and DMARC results

Modern mail systems record the outcome of authentication checks in the Authentication-Results header, added by the receiving server at each hop that performs the checks. A single Authentication-Results field can contain results for SPF, DKIM, and DMARC. The field is structured: the reporting server's name appears first, followed by each mechanism and its result.

SPF checks whether the IP address that connected to the receiving server is listed in the DNS TXT record of the domain in the Return-Path. Possible results: pass (authorised), fail (explicitly not authorised), softfail (the domain discourages but does not prohibit), neutral (the domain makes no claim), and none (no SPF record found). An SPF fail means the sending server was not authorised to send for the Return-Path domain. In a spoofed phishing email, the attacker typically sets the From to a legitimate domain but routes the message through their own server, producing SPF fail.

DKIM provides a cryptographic signature over specified header fields and the message body. The receiving server retrieves the public key from DNS and verifies the signature. A DKIM pass means the message was signed by the claimed domain and was not altered in transit. A DKIM fail means the signature did not verify, which could indicate tampering, key rotation that broke existing messages, or a forged DKIM-Signature header. A missing DKIM signature is recorded as none and is not itself suspicious, since many smaller mail servers do not implement DKIM.

DMARC combines both mechanisms with an alignment requirement: it requires that either the SPF-checked domain or the DKIM-signed domain aligns with the domain in the visible From header. If an attacker spoofs a From address at bank.com but routes through their own server, SPF checks their server's domain, not bank.com, so SPF alignment fails. If they have no DKIM key for bank.com, DKIM alignment fails too. DMARC therefore fails. The Authentication-Results header records dmarc=fail, along with the reason.

MechanismWhat it checksTypical fail indicatorInvestigative significance
SPFIs the sending IP authorised by the Return-Path domain?spf=fail or spf=softfailSending server not authorised; likely not a legitimate sender for claimed domain
DKIMDoes the cryptographic signature over headers and body verify?dkim=fail or dkim=nonefail = message altered or key mismatch; none = no signing, not inherently suspicious
DMARCDoes SPF or DKIM align with the visible From domain?dmarc=failStrong indicator of From address spoofing; attacker does not control the claimed domain's infrastructure
MechanismWhat it checksPassFail: investigativesignificanceSPFIs the sending IP listed inthe Return-Path domain SPFrecord?Server is authorised forthat domainServer not authorised;likely not a legitimatesenderDKIMDoes the cryptographicsignature over headers andbody verify against the DNSpublic key?Message unaltered; domainconfirmed as signerSignature invalid or absent;possible tampering or nosigningDMARCDoes SPF or DKIM align withthe visible From domain?From domain backed by atleast one passing alignedcheckFrom domain not backed bySPF or DKIM; strong spoofingindicatorTriple fail: SPF fail plus DKIM fail/none plus DMARC fail on a message claiming a known domain is thedefinitive signature of direct domain spoofing.
SPF checks the sending IP against the Return-Path domain, DKIM verifies a cryptographic signature over the message, and DMARC enforces alignment with the visible From domain: a triple fail on a message claiming to be from a known domain is the definitive signature of direct spoofing.

Identifying spoofing and display-name attacks

Spoofing covers several distinct techniques that header analysis can differentiate. In a direct domain spoof, the attacker sets the From header to an address at the exact target domain (from: admin@targetbank.com) while routing the message through their own server. This produces SPF fail and DMARC fail and is the simplest form to detect. If the target domain has published a strict DMARC policy (p=reject), compliant receiving servers will reject the message entirely; the investigator may encounter it only in mail server logs.

A lookalike domain spoof uses a domain registered to resemble the target: targetb4nk.com, target-bank.com, or targetbank.co. The attacker controls this domain and can configure SPF and DKIM to pass. Authentication checks pass legitimately; the attack succeeds by visual deception in the display name or domain. Investigators should check the exact From domain against the expected domain using string comparison, not visual inspection. Run WHOIS on the From domain: registration date, registrar, and registrant contact are all investigatively useful.

A display-name attack leaves the actual email address at a different domain but sets the display name to a trusted name: the From field displays as Finance Director <accounts@random-provider.com>. Mail clients that show only the display name, not the actual address, make this effective. The full raw From header reveals the real address. Investigators must always examine the raw header, not the rendered mail client view.

Using tools to parse and analyse headers

Manual parsing of a long Received chain is error-prone. Several free tools automate the process. Google Admin Toolbox Message Header Analyser parses the Received chain and renders each hop with timestamp deltas. MXToolbox Email Header Analyzer extracts the originating IP, checks it against common blocklists, and displays authentication results in a readable format. For investigators who need to process multiple messages, Python's email standard library can parse raw message files (eml format) programmatically, and the imaplib module can retrieve messages directly from a mail server.

After extracting the originating IP, look it up in threat intelligence sources. VirusTotal aggregates data from multiple security vendors and shows whether the IP has been associated with malicious activity. AbuseIPDB records reported abuse from that IP. Shodan shows open ports and services running at that IP, which can indicate whether it belongs to a mail server, a residential connection, a proxy, or a VPN endpoint. A VPN or proxy IP does not end the investigation: many VPN providers retain connection logs and will respond to valid legal process.

For domain lookups, use dig or nslookup to query the SPF record directly: dig TXT targetdomain.com. The SPF record begins with v=spf1 and lists the mechanisms. Querying the DMARC record: dig TXT _dmarc.targetdomain.com. The DMARC record includes the policy (p=none, p=quarantine, or p=reject) and the reporting addresses. A domain with p=none has not enabled DMARC enforcement; attackers can spoof it with no automatic rejection. A domain with p=reject has the highest protection: receiving servers compliant with DMARC will reject spoofed messages before they reach the inbox.

Check your understanding
Question 1 of 4· 0 answered

An email has three Received headers. In what order should an investigator read them to trace the message path from sender to recipient?

Key Takeaways

  • Received headers are added by each relay server and cannot be inserted by the original sender; reading them bottom to top reveals the relay path and the originating IP address at the bottom entry.
  • Display headers (From, Subject, Reply-To) are client-controlled and freely forgeable; the Received chain and Authentication-Results are server-controlled and provide the reliable forensic record.
  • SPF checks whether the sending IP is authorised for the Return-Path domain; DKIM verifies a cryptographic signature over the message; DMARC requires alignment between those results and the visible From domain. All three failing together is a strong indicator of spoofing.
  • Lookalike domain attacks pass all three authentication checks because the attacker controls the fraudulent domain; detection depends on careful string comparison of the From domain, not on authentication results alone.
  • Converting a traced IP to a subscriber identity requires legal process directed at the IP block owner: in India under the IT Act 2000 and Bharatiya Nagarik Suraksha Sanhita 2023; in the US under 18 U.S.C. 2703; in the UK under the Investigatory Powers Act 2016; and in the EU under the e-Evidence Regulation 2023/1543. Preservation requests should be sent immediately to prevent log expiry.
Which email header field shows the true originating IP address?
The Received headers, read from bottom to top, show each server that handled the message. The bottommost Received line was added by the first server that accepted the message from the sender's client, and its IP address is the closest available record of the originating IP. The X-Originating-IP or X-Forwarded-For headers, when present, may record the client IP directly, but these are non-standard and can be forged by the sending client.
What does an SPF fail result in an email header mean?
An SPF fail means the sending mail server's IP address is not listed in the DNS SPF record published by the domain in the Return-Path (envelope sender) address. This indicates that either the message was not sent through an authorised server for that domain, which is a strong sign of spoofing, or the domain's SPF record is misconfigured. An SPF fail alone does not prove spoofing; the receiving server's authentication-results header records the outcome and investigators should assess it alongside DKIM and DMARC.
Can email headers be forged by a sender?
Yes, partially. The From, Reply-To, Subject, and other display headers are set by the sending client and can be freely forged. The envelope-level Return-Path can also be forged. However, Received headers added by relay servers cannot be inserted by the original sender; each server adds its own Received line when it accepts the message. The bottommost Received header, added by the first server to accept the message, reflects what that server observed and is harder to falsify unless the attacker controls the sending server.
What legal mechanism is used to obtain subscriber records for a traced IP address?
Once a source IP is identified, investigators submit a legal process request to the ISP or hosting provider that owns the IP at the relevant time. In India this is done under the Information Technology Act 2000 (section 91 of the Bharatiya Nagarik Suraksha Sanhita 2023 for production orders) or by direction under section 69 of the IT Act. In the United States, investigators use an 18 U.S.C. 2703 subpoena or court order under the Stored Communications Act. In the EU, requests follow national transpositions of the e-Evidence framework. The IP-to-subscriber mapping requires the timestamp and time zone in addition to the IP address.
What is DMARC and how does it help an investigator?
DMARC (Domain-based Message Authentication, Reporting, and Conformance) ties SPF and DKIM together by requiring that the domain in the visible From header aligns with a domain that passes SPF or DKIM. If neither aligns, DMARC fails. For an investigator, a DMARC fail on a message claiming to be from a bank or government agency is strong evidence of spoofing. The Authentication-Results header records the DMARC outcome. DMARC also causes receiving servers to send aggregate and forensic reports back to the domain owner, which can provide additional corroborating evidence.

Test yourself on Cyber Forensics with free, timed mocks.

Practice Cyber Forensics questions

Found this useful? Pass it along.

Share

Spotted an error in this page? Report a correction or read our editorial standards.

Your journey to becoming a forensic professional starts here.

Practice with mock tests, learn from structured notes, and get your questions answered by a global forensic community, all in one place.