Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› Masquerading: Double File Extension
Threats, Abuse & Incident Response

Masquerading: Double File Extension

← Back to Glossary
By NHI Mgmt Group Updated December 3, 2026 Domain: Threats, Abuse & Incident Response

Masquerading: Double File Extension is a technique where a malicious file is named with two extensions so the visible name looks harmless, such as document.pdf.exe. It relies on users or tools trusting the first or displayed extension, while the operating system still treats the file as an executable.

How Double File Extensions Work

A double file extension disguises an executable by placing a harmless-looking extension first, so the filename appears to be a document or image while the operating system still recognises the final executable type. The trick depends on display settings, user habits, and tooling that trust the visible name more than the underlying file structure.

This is why extension-based trust is fragile. A file named as if it were a PDF may still launch code if the system resolves the last extension or if a user double-clicks it without checking the real type.

For a practical overview of how hidden and double endings can disguise programs, see File Types and Extensions for Beginners.

Why the Technique Is Effective

Masquerading works because many users scan filenames quickly, and some environments hide known extensions or compress the visual significance of the last one. The attacker is not breaking the file system, they are exploiting a trust gap between what people see and what the platform actually executes.

The technique is especially effective in email attachments, chat downloads, and shared folders where a filename can be copied, renamed, or wrapped in a social-engineering story. It often succeeds before any payload runs, which makes it a delivery and deception problem as much as a malware problem.

Double extensions are one of several masquerading patterns. The broader ATT&CK technique is covered in T1036 Masquerading Defensive Guide, which also helps defenders look for renamed files and metadata mismatches.

How Defenders Validate the Real File Type

Good detection does not rely on the filename alone. Defenders compare extension, content, metadata, and execution context, because a genuine document should look like a document throughout the stack, not just in the visible name. File signature checks, MIME inspection, and file-format verification are all useful ways to catch mismatch cases.

That matters in gateway filtering, endpoint protection, and upload validation. If a control only checks the last extension, a malicious file can still pass through as long as the wrapper looks benign enough to satisfy the rule.

Where a file’s claimed type must be checked against its actual structure, D3-FFV File Format Verification explains the verification logic, and D3-FMBV File Magic Byte Verification shows why signatures are often more trustworthy than the displayed name.

Where the Technique Matters Most in Practice

Double extension masquerading shows up most often in download handling, attachment triage, and file upload workflows. These are the places where people and systems must decide whether a file is safe before opening, storing, or serving it back to others. If the decision logic is weak, the filename becomes part of the attack surface.

Defensive controls are strongest when they layer together: user interface settings that expose full names, allowlists for risky file types, content-based validation, and malware scanning. On the operational side, security teams should treat suspiciously named files as a signal to inspect the origin, the real file type, and any execution attempts around the file.

For practical guidance on reducing exposure in upload and attachment workflows, see File Upload Security Guide and Malicious Attachments for Beginners.

Risk and Threat Considerations

Double file extension masquerading is dangerous because it converts a simple naming trick into code execution risk. If users, mail filters, or upload handlers trust the visible extension, the attacker can smuggle an executable past a control that was never designed to verify content.

Failure mechanism: The environment shows one extension but processes another, or a user opens the file based on the harmless-looking name instead of the file’s true type and origin.

Impact: The result can be malware execution, initial access, or a malicious attachment slipping through a control gap that should have blocked it.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKT1036.007 — Masquerade File TypeCovers double extensions as a file-type masquerading technique.
Recommendation — Map suspicious filenames to T1036.007 and inspect the file’s real type, not just the displayed extension.
NIST SP 800-53 Rev 5SI-3 — Malicious Code ProtectionSupports screening files for malicious content before execution or delivery.
CM-7 — Least FunctionalityLimits execution paths that let disguised files run or be handled as trusted content.
Recommendation — Apply SI-3 to scan attachments and uploads for executable content hidden behind benign-looking names. Restrict unnecessary file types and execution paths so disguised payloads have fewer ways to run.
OWASP ASVSV5 — File HandlingFile handling controls cover validating uploaded files beyond the extension label.
Recommendation — Validate uploaded files by content and structure, not by extension alone.

Practitioner Guidance

What to watch for: Treat files with multiple extensions, mismatched metadata, or suspicious source paths as inspection candidates, especially when they arrive through email, messaging, or upload portals. The safest operational habit is to verify the file’s true type before allowing execution or publication.

Governance implication: File-type policy should be written around content and risk, not just filename patterns. Teams that own mail gateways, endpoint controls, and upload validation should align on which extensions are blocked, which are scanned, and where the system must never trust the visible name alone.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on December 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org