Suspicious HTML File Creation

Last updated 7 months ago on 2025-01-15
Created 3 years ago on 2022-07-03

About

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.
Tags
Domain: EndpointOS: WindowsUse Case: Threat DetectionTactic: Initial AccessData Source: Elastic DefendLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Initial Access (TA0001)(opens in a new tab or window)

Defense Evasion (TA0005)(opens in a new tab or window)

License
Elastic License v2(opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process-*logs-endpoint.events.file-*
Related Integrations

endpoint(opens in a new tab or window)

Query
sequence by user.id with maxspan=2m

 [file where host.os.type == "windows" and event.action in ("creation", "rename") and

  /* Check for HTML files with high entropy and size */
  file.extension : ("htm", "html") and ((file.Ext.entropy >= 5 and file.size >= 150000) or file.size >= 1000000) and

  /* Check for file paths in common download and temporary directories */
  file.path : (
    "?:\\Users\\*\\Downloads\\*",
    "?:\\Users\\*\\Content.Outlook\\*",
    "?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*",
    "?:\\Users\\*\\AppData\\Local\\Temp\\7z*",
    "?:\\Users\\*\\AppData\\Local\\Temp\\Rar$*")]
 [process where host.os.type == "windows" and event.action == "start" and
  (
   /* Check for browser processes opening HTML files with single argument */
   (process.name in ("chrome.exe", "msedge.exe", "brave.exe", "whale.exe", "browser.exe", "dragon.exe", "vivaldi.exe", "opera.exe")
    and process.args == "--single-argument") or

   /* Optionally, check for browser processes opening HTML files with two arguments */
   (process.name == "iexplore.exe" and process.args_count == 2) or

   /* Optionally, check for browser processes opening HTML files with URL argument */
   (process.name in ("firefox.exe", "waterfox.exe") and process.args == "-url")
  )
  /* Check for file paths in common download and temporary directories targeted in the process arguments */
  and process.args : ("?:\\Users\\*\\Downloads\\*.htm*",
                      "?:\\Users\\*\\Content.Outlook\\*.htm*",
                      "?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*.htm*",
                      "?:\\Users\\*\\AppData\\Local\\Temp\\7z*.htm*",
                      "?:\\Users\\*\\AppData\\Local\\Temp\\Rar$*.htm*")]

Install detection rules in Elastic Security

Detect Suspicious HTML File Creation in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).