T1036.008

Masquerade File Type

Adversaries may masquerade malicious payloads as legitimate files through changes to the payload's formatting, including the file's signature, extension, icon, and contents. Various file types have a typical standard format, including how they are encoded and organized. For example, a file's signature (also known as header or magic bytes) is the beginning bytes of a file and is often used to identify the file's type. Adversaries may edit the header's hex code and/or the file extension of a malicious payload in order to bypass file validation checks and/or input sanitization. This behavior is commonly used when payload files are transferred and stored so that adversaries may move their malware without triggering detections. Polyglot files, which function differently based on the application that executes them, may also be used to disguise malicious capabilities.

Microsoft Sentinel / Defender
kusto
let SuspiciousMismatch = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified")
| extend FileExt = tolower(tostring(split(FileName, ".")[-1]))
| where FileExt in ("jpg", "jpeg", "png", "gif", "bmp", "txt", "pdf", "doc", "mp3", "wav", "avi")
| where FileSize > 50000
| project Timestamp, DeviceName, FileName, FolderPath, FileExt, FileSize, SHA256,
         InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName;
let ExecutableDrops = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType == "FileCreated"
| extend FileExt = tolower(tostring(split(FileName, ".")[-1]))
| where FileExt in ("gif", "jpg", "png", "bmp", "txt", "mp3", "pub", "accdb")
| where InitiatingProcessFileName in~ ("powershell.exe", "cmd.exe", "wscript.exe", "cscript.exe", "mshta.exe", "certutil.exe", "bitsadmin.exe")
| project Timestamp, DeviceName, FileName, FolderPath, FileExt, FileSize,
         InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName;
union SuspiciousMismatch, ExecutableDrops
| sort by Timestamp desc
high severity medium confidence

Data Sources

File: File Creation File: File Modification Microsoft Defender for Endpoint

Required Tables

DeviceFileEvents

False Positives

  • Legitimate image processing or media conversion software creating files with standard extensions from command-line tools
  • Web browsers saving downloaded images or documents that trigger file creation events from child processes
  • Backup and archival tools that rename or copy media files as part of automated workflows
  • Software build systems that generate resource files with image extensions during compilation

Unlock Pro Content

Get the full detection package for T1036.008 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections