Your spam filter passed a phishing email that looked perfect. No typos, no broken formatting, no suspicious greeting like "Dear Valued Customer." A staff member clicked the link, entered credentials, and now you are doing damage control. The uncomfortable part: the email body gave nothing away because it was generated by an LLM that scraped the target's public profile and wrote a flawless, context-aware message. Traditional content-based filters that look for bad grammar or known malicious phrases had nothing to flag.
This is the scenario hosting and infrastructure teams increasingly deal with. The email body is a dead end for detection. The headers are not.
Initial impact: why the filter said "clean"
Most mail gateways score messages on a combination of content heuristics, sender reputation, and authentication checks. AI-generated phishing defeats the first category almost entirely. As documented across multiple security research sources, generative AI produces fluent, grammatically flawless text in any language, which renders signature-based and rule-based content filters ineffective. Automated pipelines can scrape a target's LinkedIn profile, company press releases, or social media, then feed that context to an LLM to craft a message that reads like it came from a known colleague or vendor.
The filter sees: correct SPF, plausible display name, clean body text, no known-bad URL (the link might be freshly registered or use a legitimate redirect service). Score: clean. Delivered to inbox.
Investigation: start with Received headers, not the body
When a suspicious email gets reported after the fact, the instinct is to analyze the body and the link. Skip that for now. Open the raw message source (in most mail clients: "Show Original" or "View Source") and read the headers from bottom to top. The bottom-most Received header is the first hop, the one closest to the original sender.
Here is what a typical header chain looks like:
# Illustrative Received header chain (read bottom to top)
Received: from mx.yourdomain.com (mx.yourdomain.com [203.0.113.10])
by mailstore.yourdomain.com with LMTP; Mon, 01 Jan 2025 09:14:22 +0000
Received: from relay.legitimateservice.com (relay.legitimateservice.com [198.51.100.5])
by mx.yourdomain.com with ESMTPS; Mon, 01 Jan 2025 09:14:20 +0000
Received: from unknown (HELO sender-box.cheap-vps.example) (192.0.2.99)
by relay.legitimateservice.com with SMTP; Mon, 01 Jan 2025 09:14:18 +0000
Three things to look for in this chain:
1. The originating IP and hostname mismatch. The bottom Received line shows the actual server that handed the message to the first relay. In phishing campaigns, this is often a disposable VPS. The HELO name (sender-box.cheap-vps.example) does not match the domain in the From: header. That mismatch alone is a strong signal. Run a reverse DNS lookup on the originating IP to see who owns it:
dig -x 192.0.2.99 +short
host 192.0.2.99
If the PTR record points to a generic VPS hostname or does not exist at all, that is a red flag. Legitimate business mail servers almost always have a PTR record that aligns with their sending domain.
2. Unexpected relays. Count the hops. A normal business email typically has two or three Received headers. AI-driven phishing campaigns sometimes route through multiple relays, legitimate mail services, or compromised servers to launder reputation. If you see a relay that has no business being in the chain (a server in a country or network unrelated to the supposed sender), note it.
3. Time gaps between hops. Large time gaps between consecutive Received timestamps can indicate queuing on a bulk-send infrastructure, though this is not conclusive on its own.
Critical discovery: Authentication-Results tells the real story
The Authentication-Results header is added by your receiving mail server (or gateway) and records the outcome of SPF, DKIM, and DMARC checks. This is where AI-generated phishing often leaves a trace, even when the body is perfect.
# Illustrative Authentication-Results header
Authentication-Results: mx.yourdomain.com;
spf=pass (sender IP is 198.51.100.5) smtp.mailfrom=bounce@relay.legitimateservice.com;
dkim=pass header.d=legitimateservice.com header.s=sel1;
dmarc=fail (p=none dis=none) header.from=trustedpartner.com
Read that carefully. SPF passed, but for relay.legitimateservice.com, not for the domain shown in the From: header (trustedpartner.com). DKIM passed, but the signing domain (header.d=legitimateservice.com) does not match the From: domain either. DMARC failed because neither SPF nor DKIM aligned with the From: domain.
This is the pattern: the phishing email authenticates against the infrastructure it actually used (a legitimate relay or transactional mail service), but fails alignment with the domain it claims to be from. The filter still delivered it because the sender domain's DMARC policy was p=none, which tells receiving servers to accept the message anyway and just report the failure.
A p=none DMARC policy on the spoofed domain is not something you control (unless it is your own domain). But you can control how your inbound server treats alignment failures. Many mail servers and gateways allow you to override the sender's DMARC policy and treat p=none as p=quarantine for inbound mail. Whether this is practical depends on your false-positive tolerance.
What X-Mailer and other optional headers reveal
The X-Mailer header identifies the software that composed the message. Legitimate business email typically shows a known client (Outlook, Thunderbird, Apple Mail) or no X-Mailer at all (most webmail and API-based senders omit it). Phishing sent through scripted pipelines sometimes includes an X-Mailer value that references a mass-mailing library, a Python script identifier, or a generic string that does not match what the supposed sender would use.
Absence of X-Mailer is not suspicious by itself. But its presence with an unexpected value, combined with a DMARC alignment failure and a mismatched originating IP, strengthens the case.
Other headers worth checking:
Reply-Tothat differs fromFrom. Phishing often setsReply-Toto a different domain so replies go to the attacker, not the spoofed sender.Message-IDdomain. The domain part of theMessage-IDheader (after the@) should match the sending infrastructure. If theFromsaysceo@trustedpartner.combut theMessage-IDends in@cheap-vps.example, that is a mismatch.List-Unsubscribeor bulk-mail headers on a message that is supposed to be a personal one-to-one email. This can indicate the message was sent through a marketing or transactional platform being abused.
Temporary mitigation: what to do right now
If you have identified a phishing campaign that bypassed your filter, the immediate steps are straightforward:
- Search your mail server logs for the originating IP and the
Message-IDto find every recipient who received the same campaign. In Exim, for example,exigrepagainst the mainlog works. In Postfix, grep the mail log for the originating IP. - Quarantine or delete unread copies. If your mail platform supports admin-level message recall or search-and-purge, use it.
- Force password resets for any account where the user clicked the link and may have entered credentials. Revoke active sessions, not just passwords. If you need background on session revocation versus password resets, there is a related discussion in Infostealer Stole Staff Credentials? Reset Passwords or Revoke Sessions First on this site.
- Block the originating IP and any related IPs at your mail gateway or firewall.
- If the phishing used a compromised legitimate relay, report the abuse to that service.
Architectural fix: stop relying on content analysis alone
The long-term fix is to shift your inbound mail filtering from content-first to authentication-first. Content analysis still has value for catching bulk spam, but against targeted AI-generated phishing, it is the weakest layer.
Concretely:
Enforce DMARC alignment on inbound mail. Configure your mail gateway to quarantine or reject messages where DMARC alignment fails, regardless of the sender domain's published policy. This is aggressive and will cause some false positives (legitimate mail forwarding breaks DKIM alignment, for instance), so test in monitoring mode first.
Publish strict DMARC on your own domains. Set p=reject on every domain you own, including parked domains that never send mail. This prevents attackers from spoofing your domain to your own users or to external targets. If your server's IP ends up on a blocklist because of outbound abuse, the investigation process overlaps with what is described in Server IP Blacklisted for Spam You Never Sent? Find the Real Mail Source.
Add header-based rules to your gateway. Write rules that flag messages where the From domain does not match the DKIM signing domain, or where the originating IP's PTR record does not resolve to a hostname under the From domain. These are not perfect rules, but they catch the most common AI phishing pattern: perfect body, misaligned authentication.
Train staff on what to check. The old advice was "look for typos and bad grammar." That advice is now obsolete for targeted attacks. Teach staff to hover over links and verify the actual URL domain, and to be suspicious of any unexpected request for credentials or payment changes, regardless of how well-written the email is.
Takeaway
AI-generated phishing has made email body analysis unreliable as a primary detection method. The body is clean, the grammar is perfect, the context is personalized. But the infrastructure behind the email still leaves traces in the headers. A mismatch between the From domain and the DKIM signing domain, a DMARC alignment failure that was ignored because of p=none, an originating IP that resolves to a disposable VPS: these are the tells that survive even when the text is flawless. Read the headers, enforce authentication alignment on inbound mail, and stop trusting content filters to catch what they were never designed to catch.