Suspicious HTML File Creation

Identifies the execution of a browser process to open an HTML file with high entropy and size. Adversaries may smuggle data and files past content filters by hiding malicious payloads inside of seemingly benign HTML files.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2022/07/03"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/08/08"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies the execution of a browser process to open an HTML file with high entropy and size. Adversaries may smuggle
 11data and files past content filters by hiding malicious payloads inside of seemingly benign HTML files.
 12"""
 13from = "now-9m"
 14index = ["logs-endpoint.events.process-*", "logs-endpoint.events.file-*"]
 15language = "eql"
 16license = "Elastic License v2"
 17name = "Suspicious HTML File Creation"
 18note = "This rule may have a low to medium performance impact due variety of file paths potentially matching each EQL sequence."
 19risk_score = 47
 20rule_id = "f0493cb4-9b15-43a9-9359-68c23a7f2cf3"
 21setup = """## Setup
 22
 23If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 24events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 25Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 26`event.ingested` to @timestamp.
 27For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 28"""
 29severity = "medium"
 30tags = [
 31    "Domain: Endpoint",
 32    "OS: Windows",
 33    "Use Case: Threat Detection",
 34    "Tactic: Initial Access",
 35    "Data Source: Elastic Defend",
 36]
 37type = "eql"
 38
 39query = '''
 40sequence by user.id with maxspan=2m
 41
 42 [file where host.os.type == "windows" and event.action in ("creation", "rename") and
 43
 44  /* Check for HTML files with high entropy and size */
 45  file.extension : ("htm", "html") and ((file.Ext.entropy >= 5 and file.size >= 150000) or file.size >= 1000000) and
 46
 47  /* Check for file paths in common download and temporary directories */
 48  file.path : (
 49    "?:\\Users\\*\\Downloads\\*",
 50    "?:\\Users\\*\\Content.Outlook\\*",
 51    "?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*",
 52    "?:\\Users\\*\\AppData\\Local\\Temp\\7z*",
 53    "?:\\Users\\*\\AppData\\Local\\Temp\\Rar$*")]
 54 [process where host.os.type == "windows" and event.action == "start" and
 55  (
 56   /* Check for browser processes opening HTML files with single argument */
 57   (process.name in ("chrome.exe", "msedge.exe", "brave.exe", "whale.exe", "browser.exe", "dragon.exe", "vivaldi.exe", "opera.exe")
 58    and process.args == "--single-argument") or
 59
 60   /* Optionally, check for browser processes opening HTML files with two arguments */
 61   (process.name == "iexplore.exe" and process.args_count == 2) or
 62
 63   /* Optionally, check for browser processes opening HTML files with URL argument */
 64   (process.name in ("firefox.exe", "waterfox.exe") and process.args == "-url")
 65  )
 66  /* Check for file paths in common download and temporary directories targeted in the process arguments */
 67  and process.args : ("?:\\Users\\*\\Downloads\\*.htm*",
 68                      "?:\\Users\\*\\Content.Outlook\\*.htm*",
 69                      "?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*.htm*",
 70                      "?:\\Users\\*\\AppData\\Local\\Temp\\7z*.htm*",
 71                      "?:\\Users\\*\\AppData\\Local\\Temp\\Rar$*.htm*")]
 72'''
 73
 74
 75[[rule.threat]]
 76framework = "MITRE ATT&CK"
 77[[rule.threat.technique]]
 78id = "T1566"
 79name = "Phishing"
 80reference = "https://attack.mitre.org/techniques/T1566/"
 81[[rule.threat.technique.subtechnique]]
 82id = "T1566.001"
 83name = "Spearphishing Attachment"
 84reference = "https://attack.mitre.org/techniques/T1566/001/"
 85
 86[[rule.threat.technique.subtechnique]]
 87id = "T1566.002"
 88name = "Spearphishing Link"
 89reference = "https://attack.mitre.org/techniques/T1566/002/"
 90
 91
 92
 93[rule.threat.tactic]
 94id = "TA0001"
 95name = "Initial Access"
 96reference = "https://attack.mitre.org/tactics/TA0001/"
 97[[rule.threat]]
 98framework = "MITRE ATT&CK"
 99[[rule.threat.technique]]
100id = "T1027"
101name = "Obfuscated Files or Information"
102reference = "https://attack.mitre.org/techniques/T1027/"
103[[rule.threat.technique.subtechnique]]
104id = "T1027.006"
105name = "HTML Smuggling"
106reference = "https://attack.mitre.org/techniques/T1027/006/"
107
108
109
110[rule.threat.tactic]
111id = "TA0005"
112name = "Defense Evasion"
113reference = "https://attack.mitre.org/tactics/TA0005/"

This rule may have a low to medium performance impact due variety of file paths potentially matching each EQL sequence.

Related rules

to-top