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.
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 Data Sources
Required Tables
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
References (7)
- https://attack.mitre.org/techniques/T1036/008/
- https://unit42.paloaltonetworks.com/polyglot-file-icedid-payload
- https://www.secureworks.com/research/bronze-silhouette-targets-us-government-and-defense-organizations
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1036.008/T1036.008.md
- https://www.withsecure.com/en/research/publications/kapeka
- https://www.netskope.com/blog/lumma-stealer
Unlock Pro Content
Get the full detection package for T1036.008 including response playbook, investigation guide, and atomic red team tests.