Detection rules › Elastic

Archive File with Unusual Extension

Status
production
Kind
building block (feeds higher-level correlation rules; not a standalone alert)
Severity
low
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies the creation of an archive file with an unusual extension. Attackers may attempt to evade detection by masquerading files using the file extension values used by image, audio, or document file types.

MITRE ATT&CK coverage

Rule body

[metadata]
bypass_bbr_timing = true
creation_date = "2023/09/25"
integration = ["endpoint"]
maturity = "production"
updated_date = "2024/05/21"

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies the creation of an archive file with an unusual extension. Attackers may attempt to evade detection by
masquerading files using the file extension values used by image, audio, or document file types.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Archive File with Unusual Extension"
risk_score = 21
rule_id = "cffbaf47-9391-4e09-a83c-1f27d7474826"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Data Source: Elastic Defend",
    "Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where host.os.type == "windows" and event.action != "deletion" and

  /* common archive file headers - Rar, 7z, GZIP, MSCF, XZ, ZIP */
  file.Ext.header_bytes : ("52617221*", "377ABCAF271C*", "1F8B*", "4d534346*", "FD377A585A00*", "504B0304*", "504B0708*") and

  (
    /* common image file extensions */
    file.extension : ("jpg", "jpeg", "emf", "tiff", "gif", "png", "bmp", "ico", "fpx", "eps", "inf") or

    /* common audio and video file extensions */
    file.extension : ("mp3", "wav", "avi", "mpeg", "flv", "wma", "wmv", "mov", "mp4", "3gp") or

    /* common document file extensions */
    (file.extension : ("doc", "docx", "rtf", "ppt", "pptx", "xls", "xlsx") and

    /* exclude ZIP file header values for OPENXML documents */
    not file.Ext.header_bytes : ("504B0304*", "504B0708*"))
  ) and

  not (process.executable : "?:\\Windows\\System32\\inetsrv\\w3wp.exe" and file.path : "?:\\inetpub\\temp\\IIS Temporary Compressed Files\\*")
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.008"
name = "Masquerade File Type"
reference = "https://attack.mitre.org/techniques/T1036/008/"



[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Stages and Predicates

Stage 1: file

file where host.os.type == "windows" and event.action != "deletion" and
  file.Ext.header_bytes : ("52617221*", "377ABCAF271C*", "1F8B*", "4d534346*", "FD377A585A00*", "504B0304*", "504B0708*") and
  (
    file.extension : ("jpg", "jpeg", "emf", "tiff", "gif", "png", "bmp", "ico", "fpx", "eps", "inf") or
    file.extension : ("mp3", "wav", "avi", "mpeg", "flv", "wma", "wmv", "mov", "mp4", "3gp") or
    (file.extension : ("doc", "docx", "rtf", "ppt", "pptx", "xls", "xlsx") and
    not file.Ext.header_bytes : ("504B0304*", "504B0708*"))
  ) and
  not (process.executable : "?:\\Windows\\System32\\inetsrv\\w3wp.exe" and file.path : "?:\\inetpub\\temp\\IIS Temporary Compressed Files\\*")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.pathstarts_with?:\inetpub\temp\IIS Temporary Compressed Files\excludes:file.path field:"file.path" value:"?:\inetpub\temp\IIS Temporary Compressed Files\"
process.executableeq?:\Windows\System32\inetsrv\w3wp.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\inetsrv\w3wp.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionne
  • deletion corpus 86 (elastic 86)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 1F8B* corpus 2 (elastic 2)
  • 377ABCAF271C* corpus 2 (elastic 2)
  • 4d534346*
  • 504B0304*
  • 504B0708*
  • 52617221*
  • FD377A585A00* corpus 2 (elastic 2)
field:"file.Ext.header_bytes" kind:wildcard
file.extensionwildcard
  • 3gp corpus 2 (elastic 2)
  • avi corpus 2 (elastic 2)
  • bmp corpus 2 (elastic 2)
  • doc corpus 3 (elastic 3)
  • docx corpus 3 (elastic 3)
  • emf corpus 2 (elastic 2)
  • eps corpus 2 (elastic 2)
  • flv corpus 2 (elastic 2)
  • fpx corpus 2 (elastic 2)
  • gif corpus 2 (elastic 2)
  • ico
  • inf corpus 2 (elastic 2)
  • jpeg corpus 2 (elastic 2)
  • jpg corpus 3 (elastic 3)
  • mov corpus 2 (elastic 2)
  • mp3 corpus 2 (elastic 2)
  • mp4 corpus 2 (elastic 2)
  • mpeg corpus 2 (elastic 2)
  • png corpus 4 (elastic 4)
  • ppt corpus 3 (elastic 3)
  • pptx corpus 3 (elastic 3)
  • rtf corpus 2 (elastic 2)
  • tiff corpus 2 (elastic 2)
  • wav corpus 2 (elastic 2)
  • wma corpus 2 (elastic 2)
  • wmv corpus 2 (elastic 2)
  • xls corpus 3 (elastic 3)
  • xlsx corpus 3 (elastic 3)
field:"file.extension" kind:wildcard