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.
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.
| File format | Leading signature (Hex / ASCII) | Typical spoofing risk |
|---|---|---|
| Windows executable (PE) | 4D 5A (“MZ”) | Executable disguised as .pdf or .jpg |
| Linux / macOS binary | 7F 45 4C 46 (ELF) / CF FA ED FE | Compiled binary disguised as document or archive |
| PDF document | 25 50 44 46 2D (“%PDF-”) | Non-PDF payload carrying a .pdf filename |
| PNG / JPEG image | 89 50 4E 47 / FF D8 FF | HTML phishing page or binary masked as a photo |
| ZIP / APK / DOCX archive | 50 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.
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.
| Header / field | What it verifies | What failure or mismatch signals |
|---|---|---|
| SPF (spf=pass/fail) | Whether the sending IP is authorized by the domain’s DNS record | fail or softfail points to an unauthorized relay |
| DKIM (dkim=pass/fail) | Cryptographic domain signature over headers and body | fail means tampered content or forged signature |
| DMARC (dmarc=pass/fail) | Alignment between From domain and SPF/DKIM results | fail strongly indicates domain spoofing |
| Return-Path / Reply-To | Actual bounce path and reply destination domain | Mismatch 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.
mobile/isitai/src/security-utils.ts