Picture a small print shop at 6:40 on a Friday evening. An email lands from the paper supplier the shop pays every month, in the same thread as last month's order. It says "Updated invoice attached, please process before the weekend," and the attachment is called Invoice_4471.zip. The supplier is real and the thread is real. But this supplier has always sent plain PDFs, nobody at the shop was expecting a correction, and accounts staff at that company do not usually write on Friday night.
The right move is to leave that file closed until someone at the supplier confirms it on a phone number the shop already has. As a general rule, an attachment is reasonably safe when you expected it, the sender checks out, and the file type fits the story. It deserves real suspicion when any one of those fails, and the danger usually starts when you run, extract or "enable" something, rather than when you read the message. Most of this article is about how to make those three judgments quickly, and how to limit the harm when you cannot.
Working through the Friday invoice
The example above is useful because the usual advice fails on it. "Do not open files from strangers" does not help when the sender is someone you pay. So look at what actually changed. The format changed, from PDF to a compressed archive. The timing changed. The message pushes for action before a weekend, when nobody can easily check. Each of these could have an innocent explanation, but together they are enough to stop and verify.
Next comes the possibility the shop owner may not think of: the message may truly have come from the supplier's mailbox. Criminals who get into one account often reply inside existing conversations, because an old thread carries trust that a cold message cannot. This is called thread hijacking. It means that a correct sender address and a familiar subject line do not settle anything, and it is why the final check has to happen outside email.
A sensible sequence for the owner would be:
- Do not reply to the message to ask whether it is genuine. If the mailbox is compromised, the reply goes to the person running the scam.
- Look up the supplier's number from an old paper invoice, the contract or the phone's contact list. Do not use the number in the email signature.
- Ask a plain question: "Did you send a corrected invoice tonight?" If the office is closed, the invoice can wait until Monday. A real supplier will accept a Monday payment far more readily than a criminal will.
- If the supplier has an online portal, sign in by typing its address and see whether the invoice appears there.
- If the answer is no, warn the supplier that their mailbox may be compromised, then report and delete the message.
The same example has a quieter variant that no scanner would catch. The attachment could be a clean, ordinary PDF of a perfectly real invoice with one altered detail: the bank account. No malware is involved and the file is harmless to your computer, yet the money still goes to the wrong place. Any change to payment details deserves that same phone call, whatever the file format.
What a harmful attachment is trying to do
Attachments remain popular with attackers for a simple reason. Mail services cannot refuse every file, because people need to exchange invoices, CVs, contracts and photos, and the recipient opens the file by choice. A malicious file usually aims for one of four outcomes, and knowing which one a given format allows is most of the skill.
- It runs code directly. A program or script starts when you double-click it and has the same permissions you do.
- It persuades another application to run code, using macros, embedded objects or a flaw in the software.
- It sends you elsewhere. A PDF or document holds only a button leading to a fake sign-in page, so the file can be clean while the destination is the attack.
- It collects what you type. An HTML attachment opens in your browser as a local page that imitates a login screen and sends your password to someone else.
A JPEG photo in an updated viewer cannot do any of the first three by itself. A Windows shortcut file can run a command line while showing the icon of a document. That gap between formats explains the table below.
File types, ranked by what they can do
The ratings assume the file came from an unknown or unexpected sender. They are a judgment based on what each format is capable of, and context can move a file up or down. A .xlsm spreadsheet from your accountant in tax season is normal. The same file from an unknown address about a missed delivery is not.
| Extensions | What it is | Risk | Why |
|---|---|---|---|
| .exe, .msi, .scr, .com, .pif | Windows programs and installers | Very high | They run code with your permissions. A .scr "screensaver" is an ordinary program. |
| .js, .jse, .vbs, .vbe, .wsf, .hta, .ps1, .bat, .cmd | Scripts | Very high | Windows has built-in interpreters for these. A stranger almost never has a good reason to send one. |
| .lnk | Windows shortcut | Very high | Can launch a command with arguments behind a harmless-looking icon. |
| .iso, .img, .vhd, .vhdx | Disk images | High | A double-click mounts them like a drive, and they have been used to package programs and shortcuts. |
| .docm, .xlsm, .pptm, .xlam | Macro-enabled Office files | High | The "m" means the file can carry VBA macros. Legitimate use exists but is uncommon from strangers. |
| .doc, .xls | Older Office formats | Medium to high | Can hold macros with no clue in the name, and have a long history of abuse. |
| .zip, .rar, .7z, .gz, .tar | Archives | Depends on contents | Can hold anything in this table. Encrypted ones cannot be scanned. |
| .html, .htm, .svg | Web pages and vector images | Medium to high | Open in a browser and can show fake login forms, run scripts or assemble a file on the spot. |
| .one | OneNote notebook | Medium to high | Has been used to hide scripts behind a fake "click to view" button. |
| Portable document | Low to medium | Mostly passive, but can hold links, embedded files and scripts. | |
| .docx, .xlsx, .pptx | Modern Office files | Low to medium | Cannot store VBA macros, but can contain links, external references and embedded objects. |
| .jpg, .png, .gif, .webp | Raster images | Low | Passive data. The risk is a rare viewer flaw, which updates address. |
| .txt, .csv | Text and data | Low, with one caveat | Text cannot run itself, but a CSV opened in a spreadsheet can contain formulas, so refuse prompts to enable external content. |
Mail providers do part of this sorting for you. Gmail, for instance, refuses a list of file types that includes .exe, .js, .lnk and .iso, and also looks inside archives when it can. Outlook blocks many program and script types as well. That is why criminals favor formats the filters have to let through, and why an unusual container is often more telling than an obviously dangerous name.
How a file's real type gets hidden
Windows hides known extensions by default, which makes the oldest trick still work. A file named invoice.pdf.exe appears as invoice.pdf. Turn this off once and it stays off. In Windows 11, open File Explorer and choose View, Show, File name extensions. In Windows 10, it is a checkbox on the View tab. On a Mac, go to Finder, Settings, Advanced and tick Show all filename extensions.
Other disguises need more attention. Long names padded with spaces, such as statement.pdf .js, push the true ending out of a narrow column. A Unicode control character, the right-to-left override (U+202E), can reverse how the end of a name is displayed, so a file really ending in .exe can appear to end in .pdf. Programs and shortcuts can also carry any icon they like, including a PDF or Word icon, so an icon proves nothing.
The email itself can lie too. Each attachment comes with a declared content type such as application/pdf, but the sender chooses that label. What happens on your device depends on the file's real format and extension. So check the Type column or the file's Properties on Windows, Get Info on a Mac, and the details view of the file manager on a phone.
Office documents and the two colored bars
Office files deserve their own section because they are everywhere and have been abused for decades. A macro is a small program written in Visual Basic for Applications, stored inside a document, and it can automate useful work or download and start something else. The file format gives a partial clue: .docx and .xlsx cannot store VBA macros, while .docm and .xlsm can, and older .doc and .xls files can too without saying so.
When you open a file from the internet or an email in Office for Windows, you will usually meet one of two bars. The yellow one belongs to Protected View, which opens the document read-only in a restricted mode and offers Enable Editing. While you stay in Protected View, the file is far more limited in what it can do. You can read it, and for a document you only need to read, there is no reason to leave.
The red one is a security banner. Microsoft changed Office for Windows, with the rollout beginning in 2022, so that VBA macros in files from the internet are blocked by default in Word, Excel, PowerPoint, Access, Project, Publisher and Visio. The banner says macros were blocked because the source of the file is untrusted. According to Microsoft's documentation, this change does not cover Office on a Mac, on Android or iOS, or on the web, so do not assume the same behavior everywhere.
The block depends on the Mark of the Web, a tag Windows adds to files that came from an untrusted location such as a browser download or an email attachment. A person can remove the tag by ticking Unblock in the file's Properties, and that gives you a clear warning sign. If a document or a helpful email tells you to right-click the file, tick Unblock and reopen it, you are being walked past the protection. Close it.
Attackers responded with persuasion. A typical trap document shows a blurred page and a line such as "This document was created in a newer version. Enable editing and content to view." No genuine document needs macros simply to be read. If the file came from someone you cannot verify, treat that message as the answer to your question about whether it is safe.
The cat-and-mouse history explains some of the odd formats in the table. Disk images became popular partly because files inside an ISO did not receive the Mark of the Web, until Microsoft fixed that in November 2022 (CVE-2022-41091). Abuse of OneNote files then rose, with embedded scripts and shortcuts behind fake buttons, and in 2023 Microsoft announced that OneNote for Microsoft 365 and retail Office would block embedded files with dangerous extensions. Each fix pushes attackers to the next container, so an unfamiliar format from a stranger is reason enough to pause.
PDFs, web pages and pictures
The vast majority of PDFs are harmless, and the realistic risk is rarely a clever exploit. It is far more often a one-page PDF with a logo and a large "View secure document" button leading to a fake sign-in page. A PDF can also carry its own embedded files, which a viewer may offer to open, and it can contain JavaScript. PDF readers have had security flaws over the years, so keep yours updated. Opening an unexpected PDF in a current browser's built-in viewer is a reasonable default, and if you use Adobe Acrobat Reader and rarely need scripting, you can untick Enable Acrobat JavaScript under Edit, Preferences, JavaScript. A PDF that exists only to say "your document is ready, click here" is a doorway, not a document.
HTML attachments are worse than they look. One opens in your browser as a local page and can show a perfect copy of a login screen with your email address already filled in. Because no suspicious web address was ever in the message, link scanners in your mail service may never see one. An HTML file can also build a file inside the browser from encoded data and offer it as a download, a technique called HTML smuggling, which can get past filters that only inspect attachments. No real company needs you to sign in from a file attached to an email. Treat any such page as phishing, and go to the service by typing its address.
SVG files look like images and are defined in XML, which means they can include scripts and links. In an image viewer they act like a picture, while in a browser they can act like a web page. An unexpected SVG from a stranger deserves the same doubt as an HTML file.
Ordinary JPEG, PNG, GIF and WebP files are passive data, and the theoretical risk of a viewer flaw is what system updates address. The practical risk is different: a picture may simply be bait, such as a "screenshot" of an invoice that tells you to call a phone number. The file is safe, and the instructions in it are not.
Archives: judge the contents, not the wrapper
A ZIP file is neither safe nor dangerous. It is exactly as safe as what is inside. Archives suit attackers because the message shows only "documents.zip" while the real file type stays hidden, and because an archive inside another archive, or a less common format, can confuse some scanners.
Encryption adds a further problem. Mail security tools cannot look inside a password-protected archive, which is why a message containing an encrypted archive and its password together is a classic pattern. Think about what that arrangement achieves: it provides no secrecy, since anyone holding the email holds the password, and the only thing it reliably does is blind the scanner. A genuine sender who encrypts a file normally shares the password some other way, such as by phone or in a separate chat.
If you have verified that the archive should exist and still want to see inside:
- Open the archive to view its file list without extracting anything. File Explorer on Windows and archive programs such as 7-Zip can show the list. A Mac usually unpacks by default when you double-click, so use an archive tool there.
- Read every name and extension. A single
.lnk,.js,.exeor.isoin something that was described as paperwork is the end of the matter, so delete the archive. - Check that the contents match the story. A "PDF guide" should be a PDF, not a folder holding a shortcut.
- Extract only the specific file you need, then apply the same checks to that file.
Checking the sender, briefly
The file is half of the attack, and the believable story around it is the other half. Our guide to spotting phishing emails goes through this in detail, so here are the checks that matter most for attachments.
Start with the real address, because the display name can be set to anything by anyone. "Accounts Department" could be billing@example-pay.example. On a computer, hover over or click the name, and on a phone, tap the sender line. Look for domains with added words, hyphens or swapped letters ("rn" pretending to be "m"), free webmail addresses claiming to be a company's billing or legal department, and a domain that does not match the website you already know.
Then look at where a reply would go. A message can come from one address and send replies to another. Mailing lists and ticketing systems, as well as newsletters you subscribed to, sometimes do this for ordinary reasons, but a personal-looking note about an urgent payment should not.
The technical check takes a minute. In Gmail, open the three-dot menu and choose Show original. In Outlook on the web, use View, View message source. Look for spf=pass, dkim=pass and dmarc=pass. SPF lists which servers may send for a domain, DKIM is a cryptographic signature that shows the domain authorized the message and it was not altered, and DMARC ties those results to the visible From domain and tells receivers what to do on failure. Read the results in one direction only. A failure on a message claiming to be from your bank is a strong warning. A pass does not make a message safe, because criminals can register a look-alike domain and authenticate it properly, and a hijacked mailbox passes every check.
That leaves the question no header can answer: does this fit a real conversation? You would want to be able to say that you expected this file from this person about this subject, and that it contains details you can verify in your account. Pressure works against that. Urgency, secrecy and fear ("legal action", "do not tell anyone", "account closed today") together with a file are the usual pattern. When in doubt, contact the sender using details you already had before this message arrived. If the invoice is real, it will be in your account too.
When you must open a file from someone new
Sometimes the file is the whole point: a job applicant's CV, a supplier's first quote, a reply to something you listed for sale. The aim then is to see the content while giving the file as little power as possible. These options run from least to most effort, and most people will stop after the second or third.
Ask whether you need to open it at all. If the file is unexpected and the story is generic, deleting costs little, since real senders follow up.
Use your mail service's preview. Webmail services often render PDFs, images and Office documents on their own servers, so the file is displayed rather than run on your device. Preview first, and download only if you must. This is the single most useful habit for anyone who receives files from strangers for work.
Open documents read-only. Staying in Protected View, or opening the file in a web-based office suite, limits what it can do. Leave Enable Editing and Enable Content alone.
Scan it. On Windows, you can right-click a saved file and scan it with Microsoft Defender, and other security products offer the same. For a file containing nothing private, a multi-engine online scanner such as VirusTotal gives a second opinion. Uploads to services of this kind may be shared with security companies and researchers, so never upload contracts, IDs, invoices or anything confidential. A clean result is also not a guarantee, because a new or customized file may not yet be detected by anything.
Ask for a different format. A real applicant can resend a CV as a standard PDF. A customer can paste text into the email body. Asking is free, and someone trying to deliver a particular file tends to push back.
Use an isolated environment for anything unusual. Windows Sandbox is available in the Pro, Enterprise and Education editions of Windows, is turned on through Turn Windows features on or off, and requires virtualization to be enabled. It gives you a throwaway desktop, and everything inside is discarded when you close it. It still has network access by default unless you turn that off in a configuration file, so a file running inside it can reach the internet, and you should not sign in to anything from there. A virtual machine or a spare device serves the same purpose.
A quick test before you double-click
Run through these when something feels off. Two or more worrying answers is enough reason to delete the message or verify it first.
- Do I know this sender, and was I expecting this file now?
- Does the real address and domain match who they claim to be?
- Is this the file type I would expect for this subject?
- Is the file inside a container, especially a password-protected one?
- Is the message pushing urgency, secrecy, payment or sign-in?
- Does the document ask me to enable editing, content or macros?
- Can I confirm this through a separate channel first?
Phones and Macs are different, not immune
Windows programs and scripts simply do not run on iOS or Android, and mobile systems confine apps more strictly than traditional desktop systems do. That removes a large class of threat. But phones have weaknesses of their own, and phishing works at least as well on a small screen, where full addresses are hidden and a fake login button looks like any other.
On Android, the main file risk is the APK, an app package sent as an attachment. It can be installed only if you have allowed the app that opened it to install unknown apps. Check this under Settings, Apps, Special app access, Install unknown apps, though the exact path varies between manufacturers. Keep it off for your mail app and browser, and install apps from official stores only. On iPhone and iPad, watch for configuration profiles, which can change settings such as VPN and trusted certificates. Installed profiles appear under Settings, General, VPN & Device Management. Do not install one because an email asked you to.
Mail apps on phones also tend to hide the sender's full address and the file extension, so you need to tap to reveal them. If a file looks important and you cannot read its details comfortably, wait until you are at a larger screen. Very few honest attachments cannot wait an hour.
Macs have their own protection, Gatekeeper, which checks downloaded apps before they first run and warns about software that is not from an identified developer. Scam instructions sometimes tell you to bypass that warning by opening the file a different way or by pasting a command into Terminal. Treat those instructions just as you would "Enable Content" in a Word document. Watch for .dmg, .pkg, .app and .command files from strangers, which are the Mac counterparts of the first rows of the table.
Settings that change the odds
None of these need specialist tools. Going down this list once takes about as long as a coffee break, and most of it never needs repeating.
| Setting | Where | What it helps with |
|---|---|---|
| Show file name extensions | File Explorer View menu; Finder Settings, Advanced | Double extensions and disguised files |
| Automatic updates | System and app store settings | Known flaws in viewers, browsers and Office |
| Security software on | Windows Security, or your chosen product | Known malware when files are saved or opened |
| Protected View and macro blocking | Office: File, Options, Trust Center, Trust Center Settings (normally on) | Documents running code without your decision |
| Block unknown app installs | Android: Special app access | APK files received by email |
| Standard, non-admin account for daily use | System account settings | Malware easily gaining system-wide rights |
| Multi-factor sign-in on important accounts | Each account's security page | Account takeover after a stolen password |
| A separate address for sign-ups | A secondary address, alias or temporary inbox | Your main inbox becoming a target |
Common attachments and how they usually go wrong
The situations below are examples of patterns that come up often. What matters in each is the gap between how the real thing normally arrives and what you are looking at.
| The claim | What the real thing looks like | What should stop you | What to do |
|---|---|---|---|
| Invoice from a company you do not use | You would have an account or an order | No relationship, and often an archive, HTML file or macro document | Delete it |
| Invoice from a company you do use | Visible in your account, in the usual format | New format, new bank details, odd timing | Sign in directly or call a known number |
| Shared document "preview" | A link from the sharing service, opening where you are already signed in | An attached HTML file with a login page | Go to the service yourself and look for the share |
| CV or portfolio | A standard PDF or document | An archive, macro document or link to an odd download site | Preview it, and ask for a standard format |
| Voicemail or fax notice | Many phone systems send an audio file such as WAV or MP3 | HTML, an archive or a program | Check your phone system's portal |
| Urgent file from your "manager" | Normal channels and normal tone | Secrecy, haste, a request for payment | Confirm by phone or in person |
| New attachment in an old thread | Written in the person's own voice and on topic | Generic "please see attached", a file type they never send | Contact them separately before opening |
The job applicant row deserves a word for anyone who hires. Hiring is exactly the case where unknown people are supposed to send you files, which is why attackers imitate it. A published rule saying "PDF only, no archives or links" costs real applicants nothing and removes most of the risk before anything arrives.
For small teams
If you look after email for a team, a few controls reduce how much depends on any one person's judgment on a busy afternoon. Configure the mail service to block high-risk types such as programs and scripts outright, and hold password-protected archives from outside for review. Publish SPF, DKIM and DMARC for your own domain so that your name is harder to forge, and read the DMARC reports to see who is sending as you. A visible banner on messages from outside the organization helps people notice when "the boss" is writing from elsewhere.
Internally, shared links from a platform you trust are better than attachments, because any attachment from outside then stands out. Agree on a written rule that a change of bank details is always confirmed by phone, on a number already on file, no matter who asks or how urgent it seems. And give staff a one-click way to report suspicious mail, and thank people who use it, including the ones who already clicked. Someone embarrassed into silence gives an intruder hours of extra time.
If you already opened it
Careful people make this mistake too, usually when they are tired or busy. The first minutes count, and what you do depends on what actually happened.
You opened an image or a PDF in an updated viewer and clicked nothing. The realistic risk is low. Run a scan and carry on, staying alert for follow-up messages.
You ran something, extracted something or enabled macros. Follow these steps in order:
- Close the file and stop answering its prompts. Do not enter any passwords.
- Turn off Wi-Fi or unplug the network cable. This can stop malware from fetching further components or sending data out.
- On a work device, report it at once from another device, and do not try to clean it yourself. Early reports let IT or security staff contain the problem before it spreads.
- Run a full scan. In Windows Security, go to Virus & threat protection, Scan options, where a Microsoft Defender Offline scan restarts the computer and scans before Windows loads.
- From a different, clean device, change your important passwords, starting with email, since email can reset everything else. Then do banking and anything you recently signed in to on the affected machine.
- Review your email account's recent sign-ins, forwarding rules, filters and connected apps. Attackers sometimes add a hidden rule so that they keep receiving your mail after you change the password.
- Turn on multi-factor sign-in, or confirm it is still on, for the accounts that matter.
You typed a password into a page the attachment opened. Treat that password as stolen. Change it on the real site by typing the address yourself, and change it everywhere else you used it.
You entered card details. Call your bank or card provider on the number printed on your card, and ask them to block it.
The device still behaves strangely. New programs, disabled security tools and browser redirects are signs that a scan was not enough. Restoring from a known good backup or reinstalling the system is the dependable fix, and it is why keeping an offline or versioned backup is part of attachment safety in practice.
Where a temporary inbox fits, and where it does not
Everything above acts after a risky message has reached you. Inbox privacy works earlier, by limiting who can reach your important address at all. Every site holding your real address can leak it, sell it or be breached. Reducing that exposure means fewer unknown senders later, which also makes the odd unexpected file easier to notice. Our article on organizing your personal email explains how to split addresses by level of trust.
A temporary inbox is one tool for the lowest tier. If you use one for a one-off download or a single forum question, where the site's terms allow it, that sender never learns your main address. Our guide to signing up without your real email covers when that is appropriate and when a permanent address is the right choice. Developers also use temporary inboxes to check that their own application sends attachments correctly, without filling a personal mailbox.
Be clear about the limits. A temporary address protects your address, not your device. Once you download a file, every check in this article applies in full. Temporary inboxes are not for contracts, IDs, medical or financial records, and they are not suitable for banking, government services or any account you need to recover. The mail is not end-to-end encrypted, so nothing confidential belongs there, and a random address is the safer choice.
In VookMail, an address is ready when the page loads, with no sign-up. Attachments work, within size limits, and the inbox displays the message and lists the files without executing anything. Common program files such as .exe, .bat and .apk are refused, and archives such as .zip show a caution, which is a useful prompt to apply the archive steps above. Our domains receive mail through our own mail server, which passes it to the site over HTTPS. Messages and attachments are deleted after about a day, so download what you need promptly and do not treat the inbox as storage. The privacy policy and methodology page explain the handling in more detail.
The QR button can help with attachment caution as well. It shows a private link as a code you can scan on another device within 10 minutes, which opens that inbox there, so if you would rather look at a doubtful file on a phone or a spare device than on your main computer, you can. A file you downloaded on purpose should still match what you were promised. If a site offered a PDF guide and you received a ZIP holding a shortcut, delete it.
Mistakes worth unlearning
- Forwarding a suspicious file to a colleague "to check". That spreads the risk. Use your organization's reporting route instead.
- Extracting an archive to see what is inside, when listing the contents would have told you.
- Using a password supplied in the same email. That hands the attacker what they wanted, a file your scanner never saw.
- Clicking Enable Editing out of habit. For a document you only need to read, there is nothing to gain.
- Treating a clean scan as proof. It means no scanner recognized the file today.
- Uploading confidential files to public scanners, which may share private data with third parties.
- Delaying updates. Many attachment exploits target flaws already fixed in current versions of Office, PDF readers, browsers and operating systems.
- Keeping quiet after a bad click. On a work account, an hour of silence helps nobody except the attacker.
Questions that often come up
Can you get a virus just by opening an email?
In an updated mail app, opening and reading a message is very unlikely to infect a device. The danger usually begins when you open or run an attachment, enable macros or click a link. Loading images can, however, tell the sender that you opened the message, which is a privacy issue rather than an infection.
Does antivirus protect me from all malicious attachments?
No. Antivirus and mail filters catch a large share of known threats, but new or customized files can pass through, and a fake sign-in page may contain no malware at all. Scanning is one layer alongside checking the sender, knowing file types, blocked macros and updates.
Should I trust an attachment because it came from a friend?
Trust the person, and still check the message. Accounts get hijacked, so an odd file from a friend with an unusually short note is worth a quick text to ask whether they sent it.
Is it safer to open a suspicious file on my phone?
It can be, for Windows programs, which will not run there. It does nothing against fake login pages, and those are the likelier threat in a PDF or HTML file. A phone is a different risk, and a spare device or sandbox is the better choice when you want real separation.
Is it safe to receive attachments in a temporary inbox?
Receiving them is the same as in any inbox, since the service stores and displays the file and does not run it. What matters is what happens after you download it. Apply the same checks, and keep anything confidential out of a temporary inbox.
