Disguised file extensions and email authentication headers (SPF, DKIM, DMARC)

How magic-byte inspection catches double extensions, Unicode RLO spoofing, and mismatched file headers offline — plus how to read SPF, DKIM, DMARC, and Return-Path lines in raw email headers.

Written and measured by the operator of Is it AI? (run by one person) · Published 2026-11-28 · About the operator

Phishing and malware campaigns do not stop at disguised links. Attackers routinely send attachments named “invoice.pdf” that are actually executables or HTML credential harvesters, or forge a trusted sender name on emails that fail SPF, DKIM, and DMARC checks. This note explains how offline magic-byte inspection, SHA-256 verification, and raw email header parsing work — and what they cannot catch on their own.

Extensions are only labels — magic bytes, double extensions, and RLO spoofing

File managers often hide known extensions by default, making double extensions such as “invoice.pdf.exe” look like ordinary documents at a glance. A more deceptive variant inserts the Unicode Right-to-Left Override character (RLO, U+202E) into the filename so an executable suffix visually renders backward as “.jpg” or “.pdf”.

Reading the file’s leading binary signature (magic bytes) checks what the bytes actually contain rather than trusting the filename. If a file claiming to be .pdf or .jpg starts with a Windows PE executable header (4D 5A, “MZ”) or an HTML document (“<!DOCTYPE html>”), the extension has been spoofed.

Common magic-byte signatures checked offline against claimed file extensions
File formatLeading signature (Hex / ASCII)Typical spoofing risk
Windows executable (PE)4D 5A (“MZ”)Executable disguised as .pdf or .jpg
Linux / macOS binary7F 45 4C 46 (ELF) / CF FA ED FECompiled binary disguised as document or archive
PDF document25 50 44 46 2D (“%PDF-”)Non-PDF payload carrying a .pdf filename
PNG / JPEG image89 50 4E 47 / FF D8 FFHTML phishing page or binary masked as a photo
ZIP / APK / DOCX archive50 4B 03 04 (“PK..”)Package archive disguised under an image or text extension

Comparing a locally computed SHA-256 digest against a publisher’s published checksum further verifies that an installer or APK has not been swapped in transit. Both the file hash registry and the offline Isitai Security mobile app compute SHA-256 directly on your device without uploading the file.

Reading SPF, DKIM, DMARC, and Return-Path in raw email headers

The “From” display name and address shown in a mail client can be arbitrarily set by the sender. Inspecting the raw Authentication-Results, Return-Path, and Reply-To headers recorded by the receiving mail server exposes spoofing attempts that the normal inbox view hides.

Core authentication checks in raw email headers (RFC 7208, 6376, 7489)
Header / fieldWhat it verifiesWhat failure or mismatch signals
SPF (spf=pass/fail)Whether the sending IP is authorized by the domain’s DNS recordfail or softfail points to an unauthorized relay
DKIM (dkim=pass/fail)Cryptographic domain signature over headers and bodyfail means tampered content or forged signature
DMARC (dmarc=pass/fail)Alignment between From domain and SPF/DKIM resultsfail strongly indicates domain spoofing
Return-Path / Reply-ToActual bounce path and reply destination domainMismatch with From is a common BEC reply-hijack signal

Passing SPF, DKIM, and DMARC still does not guarantee an email is safe. A compromised legitimate account or a newly registered look-alike domain configured by an attacker will pass authentication checks cleanly. Always pair header checks with the phishing email checker and phishing URL anatomy.

Limits of offline file and header checks

Sources behind this article

Related articles

Disguised file extensions and email authentication headers (SPF, DKIM, DMARC) — check these next