Detect Double File Extension by flagging files whose visible name differs from the true executable type, such as documents that end in a second hidden programme extension. Scan email, web downloads, and user-writeable locations for mismatched extensions, especially where file association settings can hide the real type. Train users to inspect full filenames before opening.
How detection works in practice
Detection is less about spotting a single bad filename and more about finding a mismatch between the label a user sees and the file type the system will execute. The strongest signals come from mail gateways, web download telemetry, endpoint file inspection, and controls that can reveal the real extension rather than the rendered one. A useful starting point is to baseline normal naming patterns, then alert on files that present as a document but resolve to an executable or script type.
That means security teams should look for chained extensions, hidden extensions, and naming tricks that exploit default file association behaviour. For example, a file that appears to be a PDF or image may actually end in an executable programme extension once full filename display is enabled. The detection logic is usually strongest when it combines extension analysis with content-type, magic-byte, or execution-reputation checks rather than trusting the filename alone.
One practical way to operationalise this is to correlate email attachment telemetry with endpoint downloads and user-writeable locations. The same tactic that catches malicious attachments also helps identify files staged in Downloads, Desktop, temp paths, and shared folders where users are likely to open them quickly. NHIMG’s Phishing Guide is a useful companion because double extensions are commonly used to support deceptive delivery through email and lookalike files.
What to inspect when filenames are deceptive
Security teams should inspect the full filename, the final resolved extension, and the file’s actual format. Pay special attention to files whose visible name contains a harmless extension early in the name, followed by a second extension that controls execution, especially when the operating system hides known extensions by default. If your telemetry can surface both the displayed name and the normalized filesystem name, compare them and alert when they differ in ways that change execution risk.
File type validation is also important because attackers can pair misleading names with content that does not match the expected document type. A file may be labelled as a report, image, or invoice while containing executable code, a script, or another active payload. NHIMG’s File Upload Security Guide covers the same validation problem from the receiving side, including file extension allowlists, magic bytes, and filename sanitisation.
In environments where users exchange files frequently, browser download controls and endpoint detection can also help. If the security stack can quarantine suspicious downloads before the user opens them, the extension trick becomes much less effective. When downloads are allowed to land on endpoints, look for files in user-writeable paths with recent creation times, unusual parent processes, or a filename that is inconsistent with the MIME type or executable signature.
Why attackers use double extensions and how to reduce exposure
Double extensions work because humans tend to trust the first recognizable part of a filename while systems may act on the final extension or the underlying file format. The trick is especially effective when file associations are configured to hide known extensions, because the dangerous part of the name is no longer obvious to the user. That makes awareness useful, but not sufficient, because the control failure is ultimately in how filenames are displayed and interpreted.
Attackers often use the technique to slip malicious files past casual review, then rely on a user opening the file from email, chat, or a download folder. Once opened, the payload may execute directly or hand off to another process. NHIMG’s Browser Extension Security Guide is relevant to the delivery and user-interaction layer, while Persistence Techniques Guide helps defenders think about what comes next if a disguised file is launched successfully.
Reducing exposure usually comes down to making the real file type visible, blocking risky file classes at the perimeter, and enforcing controls on user-writeable locations. If your environment allows users to receive executable content routinely, then detection alone is not enough, because the organisation has already accepted a high-risk path to execution. The safer pattern is to restrict execution from common staging folders, scan files before delivery, and make sure file type mismatches generate a response instead of a warning buried in telemetry.
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 CIS Controls v8 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1036 — Masquerading | Double file extensions are a file-name deception technique. |
| Recommendation — Hunt for masquerading files whose displayed name hides the true executable type. | ||
| CIS Controls v8 | CIS-9 — Email and Web Browser Protections | Email and web delivery are common paths for disguised attachments and downloads. |
| CIS-13 — Data Protection | File handling controls help reduce exposure from misleading or unsafe files. | |
| Recommendation — Block or quarantine suspicious attachments and downloads before users open them. Validate file type and restrict risky file execution from user-writeable locations. | ||
Practitioner Guidance
What to verify: Confirm that your endpoint and mail telemetry can show the real extension, not just the rendered name. If investigators cannot see the full filename and file type together, double-extension detection will be inconsistent and easy to bypass.
Decision rule: If the filename looks benign but the resolved type is executable, scriptable, or otherwise active, treat it as a security event rather than a formatting issue. If the file is confined to a sandbox or quarantine path, the response can be narrower.
What to prioritise: Focus first on email attachments, downloaded files, and files created in user-writeable directories, because that is where the deception is most likely to reach a user before controls intervene. Add stricter handling for file types that your organisation regularly receives but does not need to execute.
Common mistake: Relying on user training alone. Training helps, but the control has to be in the display, filtering, and inspection layers, otherwise a hidden extension can still reach the point of execution.
Practitioner takeaway: The best detection is the one that compares what the user sees with what the system will actually run, then blocks the mismatch before it becomes an execution path.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
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.
Reviewed and updated by the NHIMG editorial team on October 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org