Fake file extensions: how to tell what a file really is

The common disguises, and how to check a suspicious file without opening it.

A file’s extension is just part of its name. Anyone can name a program invoice.pdf. The extension decides which app opens the file, and it is the first thing people trust. These are the usual ways it is abused.

Double extensions

invoice.pdf.exe is a program whose name starts with “invoice.pdf”. Windows hides the final extension of known file types by default, so it appears as invoice.pdf. To see real extensions, open File Explorer, choose View, then Show, and tick File name extensions.

Right-to-left override

A special Unicode character (U+202E, “right-to-left override”) reverses how the text after it is displayed. A file named report[U+202E]fdp.exe is really an .exe, but can be shown as reportexe.pdf. Because the trick lives in the name, the dependable defence is to check the content, which does not change.

Shortcuts and wrappers

A Windows shortcut (.lnk) can show a folder or document icon while running a command. They are often sent inside ZIP files. Right-click a shortcut and look at its target before opening it. See the .lnk file page.

Renamed files

Renaming a program to photo.jpg does not change its contents. The file still starts with the signature of what it really is, and that signature is hard to fake without breaking the file. For example, a Windows program starts with the two letters MZ (.exe), and a Linux one with 7F 45 4C 46 (ELF).

How to check a file without opening it

  1. Drop it into File Identity. It reads the first bytes and reports the real type, whatever the name says.
  2. Use Validate Extension to see directly whether the name and the content agree, and to catch double extensions.
  3. If you are still unsure, Safe File Preview lets you look inside the file, down to its first bytes, without running anything.

These tools only read the file, in your browser. Nothing is run and nothing is uploaded.

Habits that help

  • Turn on file name extensions.
  • Be suspicious of any attachment you did not expect, even from a known sender.
  • Remember that some safe-looking formats can still run code. Office files with macros and SVG images are examples.
  • An archive containing a single program or shortcut is a red flag.