T1583.008 Elastic Security · Elastic

Detect Malvertising in Elastic Security

Adversaries may purchase online advertisements to distribute malware to victims. Ads can be positioned prominently in search results or on popular websites, exploiting user trust in those platforms. Malvertising campaigns frequently spoof legitimate software vendors, tricking users into downloading trojanized installer packages. Because the adversary's infrastructure purchase occurs entirely outside the victim environment, detection must pivot to observable victim-side indicators: browsers spawning unexpected child processes, executable file downloads staged in user-writable directories, and drive-by script execution patterns consistent with clicking a malicious ad.

MITRE ATT&CK

Tactic
Resource Development
Technique
T1583 Acquire Infrastructure
Sub-technique
T1583.008 Malvertising
Canonical reference
https://attack.mitre.org/techniques/T1583/008/

Elastic Detection Query

Elastic Security (Elastic)
eql
process where event.type == "start" and
  process.parent.name in~ ("chrome.exe", "msedge.exe", "firefox.exe", "iexplore.exe", "opera.exe", "brave.exe", "safari.exe") and
  process.name in~ ("powershell.exe", "pwsh.exe", "cmd.exe", "mshta.exe", "wscript.exe", "cscript.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe", "certutil.exe", "bitsadmin.exe") and
  (
    process.working_directory like~ "*\\Downloads\\*" or
    process.working_directory like~ "*\\Temp\\*" or
    process.working_directory like~ "*\\AppData\\Local\\Temp\\*" or
    process.args like~ "*http://*" or
    process.args like~ "*https://*" or
    process.args like~ "*-enc*" or
    process.args like~ "*-EncodedCommand*" or
    process.args like~ "*DownloadString*" or
    process.args like~ "*DownloadFile*" or
    process.args like~ "*WebClient*" or
    process.args like~ "*Invoke-WebRequest*" or
    process.args like~ "*iex*" or
    process.args like~ "*-WindowStyle Hidden*" or
    process.args like~ "*-w hidden*" or
    process.args like~ "*/quiet*" or
    process.args like~ "*/silent*" or
    process.args like~ "*/verysilent*"
  )
high severity high confidence

Detects malvertising drive-by execution by identifying web browsers spawning high-risk child processes (interpreters, LOLBins, installers) that exhibit one or more suspicious indicators: download-path working directory, inline network references, encoded/download commands, or silent/hidden execution flags. Matches the scoring logic of the reference KQL/SPL — any hit here already carries at least one suspicious indicator, correlating with a SuspicionScore ≥ 2 in the reference queries.

Data Sources

EndpointWindows SysmonElastic Endpoint Security

Required Tables

logs-endpoint.events.process-*winlogbeat-*

False Positives & Tuning

  • Enterprise software deployment tools that launch Chrome/Edge to authenticate and then invoke msiexec or powershell as part of a legitimate SSO or MDM enrollment workflow.
  • Developer IDEs (VS Code, JetBrains) that embed Chromium and spawn cmd.exe or powershell.exe for integrated terminal sessions.
  • Automated Selenium/Playwright test runners that control a browser and invoke helper scripts, triggering the browser→child-process pattern without malicious intent.
Download portable Sigma rule (.yml)

Other platforms for T1583.008


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Simulate Browser Spawning PowerShell (Malvertising Drive-by Pattern)

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, ParentImage=cmd.exe, CommandLine containing '-WindowStyle Hidden'. Sysmon Event ID 11: File Create for malv-test.txt in Temp. Security Event ID 4688 (if command line auditing enabled). PowerShell ScriptBlock Log Event ID 4104 showing Write-Output command.

  2. Test 2Stage and Execute Trojanized Installer from Downloads Folder

    Expected signal: Sysmon Event ID 11: File Create for 7zip-2400-x64.exe in the Downloads folder. Sysmon Event ID 1: Process Create with Image path inside the Downloads folder — anomalous for any legitimate software. Security Event ID 4688 if command line auditing is enabled.

  3. Test 3HTA Drive-by Execution Simulating Malvertising Redirect

    Expected signal: Sysmon Event ID 1: Process Create for mshta.exe with TargetFilename in Temp path. Sysmon Event ID 11: File Create for hta-atomic.txt. Security Event ID 4688 for mshta.exe execution. If launched from a browser parent, the main detection fires on mshta.exe as a SuspiciousChild with DownloadPath=1.

  4. Test 4PowerShell Download Cradle Spawned from Browser Context (Simulated Raspberry Robin Pattern)

    Expected signal: Sysmon Event ID 1: Process Create for powershell.exe, ParentImage=cmd.exe, CommandLine containing 'Net.WebClient' and 'DownloadString'. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:18080 (connection refused, but event still fires). PowerShell ScriptBlock Log Event ID 4104 showing the download cradle code.

Unlock Pro Content

Get the full detection package for T1583.008 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections