Suspicious HTML File Creation
editSuspicious HTML File Creation
editIdentifies 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.
Rule type: eql
Rule indices:
- logs-endpoint.events.process-*
- logs-endpoint.events.file-*
Severity: medium
Risk score: 47
Runs every: 5m
Searches indices from: now-9m (Date Math format, see also Additional look-back time
)
Maximum alerts per execution: 100
References: None
Tags:
- Domain: Endpoint
- OS: Windows
- Use Case: Threat Detection
- Tactic: Initial Access
- Data Source: Elastic Defend
Version: 108
Rule authors:
- Elastic
Rule license: Elastic License v2
Investigation guide
editThis rule may have a low to medium performance impact due variety of file paths potentially matching each EQL sequence.
Setup
editSetup
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
events will not define event.ingested
and default fallback for EQL rules was not added until version 8.2.
Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
event.ingested
to @timestamp.
For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
Rule query
editsequence 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*")]
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Initial Access
- ID: TA0001
- Reference URL: https://attack.mitre.org/tactics/TA0001/
-
Technique:
- Name: Phishing
- ID: T1566
- Reference URL: https://attack.mitre.org/techniques/T1566/
-
Sub-technique:
- Name: Spearphishing Attachment
- ID: T1566.001
- Reference URL: https://attack.mitre.org/techniques/T1566/001/
-
Sub-technique:
- Name: Spearphishing Link
- ID: T1566.002
- Reference URL: https://attack.mitre.org/techniques/T1566/002/
-
Tactic:
- Name: Defense Evasion
- ID: TA0005
- Reference URL: https://attack.mitre.org/tactics/TA0005/
-
Technique:
- Name: Obfuscated Files or Information
- ID: T1027
- Reference URL: https://attack.mitre.org/techniques/T1027/
-
Sub-technique:
- Name: HTML Smuggling
- ID: T1027.006
- Reference URL: https://attack.mitre.org/techniques/T1027/006/