Password-protected ZIP attachments: why they're risky and how to handle them
A password-protected ZIP, 7z or RAR attachment can't be opened by a scanner, so malware inside it reaches the inbox unseen. Attackers put the password in the email body, where only the person can use it. Quarantine encrypted archives with a mail flow rule or Gmail's encrypted attachment setting, and release only expected ones.
On this page 9 sections
Security tools can't scan what they can't open. A password-protected archive is exactly that: a locked box with the key taped to the outside, in the email body, where only a person will use it. That's why encrypted ZIP, 7z and RAR attachments turn up so often in malware campaigns. This guide explains the risk, how containers interact with Windows protections, and how to quarantine encrypted attachments in Microsoft 365 and Google Workspace. For the full list of risky file types, see dangerous email attachment types.
Why do attackers send password-protected ZIP files?
To get past the scanner. MITRE ATT&CK describes spearphishing attachments that include "instructions on how to decrypt an attachment, such as a zip file password," in order "to evade email boundary defenses."
The encryption doesn't protect anything from the attacker's point of view. It protects the payload from your filters. The email gives the person the password, often with a plausible reason:
- "The invoice is encrypted for your security. Password: 4471."
- "Confidential HR document. Use your employee ID to open."
- "Secure statement attached. Password in the next email."
Real-world examples in MITRE's Encrypted/Encoded File technique (T1027.013) include droppers "delivered as password-protected zip files" and password-protected malicious Word documents.
What can a scanner see?
| Attachment | What a mail scanner can check |
|---|---|
| Ordinary ZIP, 7z, RAR | File names, true file types and contents of every file inside |
| Password-protected archive | That it's encrypted, and often the file names; not the contents |
| Archive with encrypted file names | Very little beyond the fact that it's encrypted |
| Password-protected Office file or PDF | That it's encrypted; not macros, links or embedded files |
| Archive inside an archive | Depends on how many levels the scanner opens |
Some scanners try a password found in the email body. MITRE notes that "some email scanning devices can open and analyze compressed and encrypted formats." Don't assume yours does. Ask, and test it.
What file types are involved?
Encryption isn't limited to ZIP files. Common formats in these attacks:
- ZIP, which Windows opens natively, so it needs no extra software.
- 7z and RAR, which need an archive tool but support stronger encryption and can hide file names.
- Encrypted Office documents and PDFs, which open in familiar apps after a password prompt.
- Disk images (
.iso,.img,.vhd,.vhdx), which aren't encrypted but are containers with similar effects on Windows protections.
What's inside is usually something that runs code: a script, a shortcut (.lnk), an executable, an HTML file or a macro-enabled document.
What does an encrypted-archive lure look like?
The email around the archive does most of the work. Watch for these patterns:
- A short message with a password and little else. "Please see attached. Password: 7721." Genuine senders usually explain what the file is and why it's protected.
- Urgency tied to money or HR. Overdue invoices, payment confirmations, salary reviews, disciplinary notices and tax documents.
- A reply in an existing thread. Attackers who steal old conversations insert an encrypted attachment into a real thread, so the sender name and subject look familiar. Our guide to email thread hijacking explains the pattern.
- A mismatch between name and contents. A file called
Invoice_0923.zipthat contains a script, a shortcut or an HTML file instead of a PDF. - Password in a second email. Some campaigns send the password separately to look more professional. It doesn't make the attachment safer.
None of these proves an attack on its own. Together with an encrypted attachment you weren't expecting, they're enough to stop and check.
How do archives and disk images bypass Mark of the Web?
Mark of the Web (MOTW) is a tag Windows adds to files from the internet, such as browser downloads and email attachments (Microsoft Learn). Office uses it to block macros in internet files, and other Windows security checks also look for it.
Containers can break that chain. MITRE ATT&CK T1553.005 explains that "container files downloaded from the Internet will be marked with MOTW but the files within may not inherit the MOTW" after extraction or mounting, because "MOTW is a NTFS feature and many container files do not support NTFS alternative data streams." Once extracted or mounted, the files "may be treated as local files."
Microsoft's Q1 2026 email threat report says plainly: "Threat actors commonly use ZIP files to circumvent Mark of the Web (MOTW) protections."
Whether MOTW carries through depends on the Windows version, the tool used to extract the archive and its settings. You don't control which tool a user picks, so treat the gateway as the place to stop containers. MITRE's suggested mitigations are to "consider blocking container file types at web and/or email gateways" and to consider disabling auto-mounting of disk image files. Our guide to Office macros blocked from the internet explains how MOTW drives macro blocking.
How do you quarantine encrypted attachments in Microsoft 365?
Microsoft's common attachments filter blocks by file type, but a ZIP is a ZIP whether or not it's encrypted. To act on encryption, use a mail flow rule. At the time of writing (October 2026), Exchange Online offers these attachment conditions (Microsoft Learn):
| Condition in the EAC | PowerShell parameter | What it matches |
|---|---|---|
| Any attachment is password protected | AttachmentIsPasswordProtected |
Password-protected attachments; Microsoft says detection works for Office documents, .zip and .7z archives, and .pdf files |
| Any attachment's content can't be inspected | AttachmentIsUnsupported |
Attachments of a type the rules engine can't read |
| The message didn't complete scanning | AttachmentProcessingLimitExceeded |
Messages the rules engine couldn't fully scan |
Note the detection list: .rar isn't named for password detection, so add a second rule that matches the .rar file extension if you want RAR attachments held too. Microsoft also says all these attachment conditions scan compressed archive attachments.
A practical rule:
- In the Exchange admin center, go to Mail flow > Rules and create a rule.
- Apply this rule if: The sender is located Outside the organization, and Any attachment is password protected.
- Do the following: Redirect the message to hosted quarantine.
- Except if: the sender's domain is one of a short list of partners who genuinely send encrypted files.
- Set the mode to test first, review what it catches for a week, then enforce.
Our guide to mail flow rules for security covers rule ordering and testing.
How do you quarantine encrypted attachments in Google Workspace?
In the Google Admin console, go to Menu > Apps > Google Workspace > Gmail > Safety, then scroll to Attachments (Google Workspace Admin Help). The setting is Protect against encrypted attachments from untrusted senders, described as protection "against attackers who use encrypted attachments, which can't be scanned for malware."
The default action is Keep email in inbox and show warning. Change it to Quarantine or Move email to spam if you want the message held rather than delivered with a banner. Our guide to Google Workspace advanced phishing and malware protection covers the neighboring settings for scripts and unusual attachment types.
Should you block or quarantine encrypted archives?
Quarantine is usually right. Some businesses do receive encrypted files legitimately: payroll exports, legal documents, medical records, accountants' year-end packs. A block bounces those; a quarantine holds them for a quick check.
| File | Suggested action | Why |
|---|---|---|
| Password-protected ZIP, 7z, RAR | Quarantine | Can't be scanned; occasionally legitimate |
| Password-protected Office file or PDF | Quarantine | Same reason; common in legal and finance |
| ISO, IMG, VHD, VHDX | Block | Rarely needed by email; containers |
| Ordinary archives | Scan contents and apply the same rules | The contents are what matter |
A release checklist
Before releasing an encrypted attachment from quarantine:
- Was the recipient expecting a file from this sender?
- Does the sender's address match previous genuine mail, letter by letter? See lookalike domain phishing.
- Did the sender confirm through another channel, such as a phone number you already had?
- Is the password in the same email? Legitimate senders often send it separately or agree on it in advance.
- After release, does the archive contain the file type you expected? A "PDF invoice" archive containing a
.js,.lnkor.exefile is an attack.
How should staff handle encrypted attachments?
Give people a simple rule: an encrypted attachment you weren't expecting is suspicious, especially when the password is in the same email.
- Don't open it. Report it through your normal button or address. See how to report phishing.
- If you expected it, confirm with the sender by phone before opening.
- After opening, if the archive contains anything other than the document you expected, close it and tell IT.
- If you already ran something from inside an archive, follow what to do after clicking a phishing link and contact IT straight away.
For files you send, stop using encrypted ZIPs with the password in the email. A shared link with named-user access or your platform's message encryption protects the content better. Our guide to email encryption types compares the options.
Next steps
- Check what your filter does today with a password-protected ZIP: send a harmless test file from an outside account and see where it lands.
- In Microsoft 365, add a mail flow rule for Any attachment is password protected. In Google Workspace, change the encrypted attachment action to quarantine.
- Block disk image attachments outright.
- Write down who can release quarantined encrypted files and what they must check first.
- iBlockSpam includes attachment-type filters and a personal quarantine for every user, with scheduled digests. See quarantine and digests.
Browse our other phishing and threat guides.
Frequently asked questions
Why would an email include the password for its own ZIP file?
Because the password is there to stop your scanner, not a thief. The attachment is encrypted so security tools can't look inside it, and the password in the body lets the person open it anyway. MITRE ATT&CK lists 'instructions on how to decrypt an attachment, such as a zip file password' as a way attackers evade email defenses.
Can antivirus scan a password-protected ZIP?
Not the contents. Without the password, a scanner sees only an encrypted container and file names, if those aren't encrypted too. That's why mail systems treat encrypted archives as a special case. Endpoint antivirus can still check the files after the person extracts them, but by then the file is on the device.
How do I block password-protected attachments in Microsoft 365?
Create a mail flow rule in the Exchange admin center with the condition 'Any attachment is password protected' and an action such as redirecting to hosted quarantine. Microsoft says password detection works for Office documents, .zip and .7z archives, and PDF files. Add an exception for trusted partners if needed.
Are ISO and IMG files the same risk as encrypted ZIPs?
They're a related risk. Disk images and archives are containers. MITRE notes that files inside containers may not inherit Mark of the Web, the Windows tag that triggers extra protections. Most businesses never need disk images by email, so block them outright rather than quarantining them.
How should we share confidential files instead of encrypted ZIPs?
Use a shared link from a service your organization controls, such as OneDrive, SharePoint or Google Drive, limited to named people. Or use your mail platform's message encryption. Both protect the content without hiding it from security scanning on your side, and neither puts a password in the same email as the file.
Sources
- MITRE ATT&CK: Phishing: Spearphishing Attachment (T1566.001)
- MITRE ATT&CK: Subvert Trust Controls: Mark-of-the-Web Bypass (T1553.005)
- MITRE ATT&CK: Obfuscated Files or Information: Encrypted/Encoded File (T1027.013)
- Microsoft Learn: Use mail flow rules to inspect message attachments in Exchange Online
- Google Workspace Admin Help: Advanced phishing and malware protection
- Microsoft Security Blog: Email threat landscape, Q1 2026 trends and insights
- Microsoft Learn: Macros from the internet are blocked by default in Office
See how your domain measures up
Run a free Email Health Check: MX, SPF, DKIM, DMARC and transport security in one scan, with the raw records shown. No sign-up.
Keep reading
What is email thread hijacking, and how do you spot it?
How attackers reply inside real email threads from a compromised partner mailbox, why SPF, DKIM and DMARC still pass, the red flags, and how to verify safely.
9 min read Phishing & threatsWhy does Office block macros in files from the internet?
Why Office blocks VBA macros in files from the internet, what the SECURITY RISK banner means, how Mark of the Web works, and how admins allow trusted macros safely.
9 min read Phishing & threatsWhich email attachment types are dangerous, and what should you block?
Which email attachment types are dangerous, from .exe and scripts to macros, HTML, SVG, ISO and OneNote files, and which to block outright versus quarantine.
9 min read