File Analysis

Recognizing a malicious file

Warning signs to look for before opening a suspicious file.

1 Introduction

Recognizing a malicious file is like spotting a booby-trapped parcel before opening it. A suspicious parcel has telltale signs: unknown sender, odd weight, strange packaging. Malicious files give themselves away too: a double extension, an unusual size, an unexpected file type. They disguise themselves as harmless invoices, photos or installers. Learning to spot these tricks is your first line of defense, before any antivirus gets involved, and can save you hours of cleanup or the loss of all your data.

.exe .js .lnk

Among the most abused file extensions

2022

Microsoft starts blocking macros in files from the internet by default

1 click

Is often enough to get infected

2 How It Works

Attackers use several tricks to make malicious files look innocent. Here are the most common ones and how to spot them.

Common disguise techniques

1

Double extensions

The file is named "invoice.pdf.exe". Windows hides known extensions by default, so you only see "invoice.pdf".

2

Icon spoofing

The program uses a PDF, Word or folder icon to look like a document. The icon proves nothing about the real file type.

3

Archive wrapping

The malware is hidden in a .zip, .rar or disk image, sometimes password-protected so that email filters cannot inspect it.

Double extension in practice

# What you see:

invoice.pdf

# What is really there:

invoice.pdf.exe

A variant uses an invisible Unicode character that reverses the text direction: a file really named "invoice_fdp.exe" can be displayed as "invoice_exe.pdf". Tip: always turn on file name extensions in File Explorer.

Malicious Office macros

Word, Excel and PowerPoint documents can contain macros: small programs that run inside the document. Attackers have long used them to download malware. Since 2022, Office blocks macros by default in files that come from the internet, and shows a red banner instead. Attackers now try to talk you into lifting that protection.

SECURITY RISK: Microsoft has blocked macros from running because the source of this file is untrusted.

If a document or email explains how to "unblock" the file or "enable content" to see it, stop: that is the trap.

Risky file types

.exe / .msi

Programs

.scr

Screensaver (a program)

.bat / .cmd

Batch scripts

.js / .vbs / .ps1

Scripts

.docm / .xlsm

Office with macros

.html / .svg

Web pages as attachments

.iso / .img

Disk images

.lnk

Windows shortcuts

3 Detailed Analysis

Dangerous file types to watch for

Executables (.exe, .msi, .scr, .bat, .cmd, .com, .pif)

These files run code directly on your computer. Never open an executable received by email or chat, and only install software from its official site or your device's app store.

Script files (.js, .vbs, .ps1, .wsf)

Scripts are just as dangerous as executables. A .js file received by email does not open in your browser: Windows runs it directly. It is almost always malicious.

Office documents with macros (.docm, .xlsm, .pptm)

Even with macros blocked by default, be very wary of any document that asks you to "Enable Content", "Enable Editing" or unblock the file to read it.

Disk images and archives (.iso, .img, .zip, .rar, .7z)

These containers hide their content from some security filters. An .iso opens as a virtual drive and may contain a program or a shortcut disguised as a document.

Shortcut files (.lnk)

A Windows shortcut can contain hidden commands. A .lnk that looks like a document may actually launch PowerShell in the background.

HTML and SVG attachments

They open in your browser and can display a fake login page or assemble a malicious file on the fly, without any link in the email. Legitimate companies rarely send them. See Phishing links.

Size and metadata anomalies

A 50 KB PDF claiming to contain a 20-page report is suspiciously light; a 15 MB "photo" or a 300 MB "invoice" is abnormally heavy. Every file also carries metadata: author, creation date, software used. A document supposedly sent by your bank but created a few hours earlier, by an unknown author, with a tool unrelated to the bank, should raise questions. Analysis tools extract these details and compare them with what you would expect (see Reading a file analysis report).

How to check a file safely

Show file extensions

In Windows 11, open File Explorer, then View > Show > File name extensions (in Windows 10: View tab, "File name extensions"). Double extensions become visible.

Check the file properties

Right-click the file and choose Properties. The "Type of file" field shows the real type, whatever the icon.

Search its hash, then scan it

Compute the file's hash and look it up on an analysis service. Only upload the file itself if it contains nothing personal or confidential: on public platforms, uploaded files can be shared with others.

Open in a sandbox

If the file really must be opened, let your IT team do it in a sandbox or virtual machine, isolated from your real system.

What to do if you receive a suspicious file

1

Do not open it

The first rule: never open a file you have doubts about. A double-click can be enough to trigger the infection.

2

Check with the sender

Were you expecting this file from this person? If in doubt, contact them through another channel (phone, known address), never by replying to the message.

3

Have it analyzed

Search its hash on an analysis service, or submit it if it contains nothing sensitive. You get a verdict without risking your machine.

4

Report it

Alert your IT or security team. This protects colleagues who may have received the same file. If you already opened it, say so right away: every minute counts.

Try it on mlab.sh

Got a suspicious file? Check its true file type, compute its hash and scan it against detection engines, without risking your own machine.

Check a suspicious file

4 Red Flags

Double extension

Any file with two extensions such as report.pdf.exe or photo.jpg.scr is almost certainly malicious. Only the last extension counts.

Asked to enable content, macros or to unblock the file

A document that needs you to enable macros, "enable content" or unblock it in its properties before showing anything is almost certainly malicious.

Password-protected archive from an unknown sender

Attackers send password-protected ZIPs with the password in the email body, precisely so that security scanners cannot look inside.

Unexpected file type for the context

An .iso disk image, a .js script or an .html "invoice" received by email is highly unusual in normal communication. These formats should raise immediate suspicion.

Misleading icon or size

A program can display a PDF or folder icon, and a file's size can betray it: a "simple invoice" of several megabytes, a "photo" of a few kilobytes. Trust the real type, not the appearance.

Artificial urgency

"Open this document immediately", "Unpaid invoice: final notice", "Your account will be blocked". Pressure is meant to make you act without thinking (see Social engineering).

Related Modules