Incident Response Report: Windows Server 2016 Compromise & Host Forensics
A comprehensive forensic investigation and step-by-step incident response report analyzing a compromised Windows Server 2016 endpoint. Covers web shell delivery, privilege escalation, credential dumping with Mimikatz, persistent registry run keys, backdoor scheduled tasks, Sigma detection logic, and clean vs. rebuild decision analysis.
Executive Summary
On March 2, 2019, an unauthorized intrusion was detected and investigated on a production Windows Server 2016 system.
The adversary successfully achieved initial access by uploading an unauthorized Java Server Pages (.jsp) web shell to the Internet Information Services (IIS) web server root. Following initial access, the attacker escalated privileges by illicitly granting local Administrator rights to unauthorized accounts (Jenny and Guest), dumped stored operating system credentials using Mimikatz, and established multi-layered persistence across system reboots via a rogue registry Run key and an automated scheduled task (Clean file system). Furthermore, the threat actor modified the Windows Firewall to expose local port 1337 and altered local DNS resolution (hosts file) to redirect legitimate traffic.
All malicious artifacts, persistence mechanisms, and rogue permissions were systematically identified, isolated, and documented. Based on the depth of compromise—specifically administrative credential dumping and kernel/subsystem modifications—the forensic recommendation mandates a complete rebuild and redeployment of the endpoint from an immutable baseline rather than a superficial cleanup.
Scope & Data Sources: Capabilities & Limitations
The scope of this investigation encompassed all forensic host artifacts on the compromised Windows Server 2016 system.
| Data Source / Artifact | What It Provided (Capabilities) | What It Could Not Provide (Limitations) |
|---|---|---|
| Windows Security Event Logs (Security.evtx) | Specific event timestamps for special privilege logons (Event ID 4672) and user logon tracking. | Could not capture full command payloads or memory-only script execution due to disabled process creation auditing (Event ID 4688). |
| Windows Registry (HKLM Hive) | Persisted startup run keys (HKLM\...\Run), binary arguments, and registry key creation timestamps. | Cannot reflect volatile in-memory processes or temporary socket sessions terminated prior to analysis. |
| File System Artifacts (C:\inetpub, C:\temp, C:\Windows) | Web shell payloads (.jsp), dropped credential harvesting tools (mimikatz), and backdoor PowerShell scripts (nc.ps1). | Could not recover anti-forensic temporary files wiped without forensic unallocated space file-carving. |
| Task Scheduler (Taskschd.msc) | Identification of recurring scheduled triggers, daily task names (Clean file system), and executed binaries. | Cannot detect in-memory scheduled tasks executed via direct API hooking. |
| Windows Firewall with Advanced Security | Detection of unauthorized inbound port openings (Port 1337). | Does not record historical network bandwidth volume or packet captures of past communication. |
| Local Account Management (SAM / net) | Group memberships (Guest and Jenny in Administrators), user metadata, and last logon timestamps. | Does not record remote IP origins for local console sessions without corresponding RDP event channels. |
| Local DNS Resolver (hosts file) | Evidence of DNS poisoning and hardcoded Command-and-Control (C2) IP mappings. | Does not capture active DNS queries resolved prior to hosts file modification. |
Chronological Incident Timeline
Unknown Time — Attacker uploads rogue web shell (.jsp) to C:\inetpub\wwwroot.
04:04:49 PM — Windows Security Event Log records Event ID 4672 (*Special privileges assigned to new logon*).
Post-04:04 PM — Guest and Jenny accounts added to Local Administrators group.
Post-04:04 PM — Registry Run Key created at HKLM\...\Run\Update pointing outbound to 10.34.2.3.
Post-04:04 PM — Scheduled Task created (Clean file system) configured to execute C:\temp\nc.ps1 daily.
Post-04:04 PM — mimikatz.exe dropped and executed in C:\temp\ for LSASS memory credential harvesting.
Post-04:04 PM — hosts file modified with C2 76.32.97.132 and DNS poisoning of google.com; Windows Firewall rule opened for inbound TCP Port 1337.
05:48:32 PM — Legitimate user John logs in for scheduled support activity.
Post-05:48 PM — Account Jenny records final active interactive session on the compromised host.
Step-by-Step Forensic Investigation & Process Flow
Phase 1: Environment Baseline & Account Enumeration
Step 1.1: System Identification
To establish operating system architecture, build, and patch level:
systeminfo- Evidence Found: Windows Server 2016 Datacenter (OS Version: 10.0.14393).
Step 1.2: User Account Analysis & Logon History
To identify active users, account status, and last authentication times:
net user
net user Administrator
net user john
net user jenny- Findings:
- - User
johnlast logged in on03/02/2019 5:48:32 PM. - - User
jennyrecorded the most recent active logon session on the compromised host.
Step 1.3: Dead End / Eliminated Hypothesis #1 (User 'John' Investigation)
- Hypothesis: Initial suspicion held that user
johnwas the compromised entry account due to his recent logon on the compromise date. - Elimination & Verification: Analysis of Windows Security Event Logs for failed logon events (
Event ID 4625) and password age revealed John's password had not changed and his logon was consistent with normal administrative support activity post-compromise. John was eliminated as the adversary vector.
Phase 2: Web Server Root & Initial Compromise Vector
Step 2.1: Web Directory Triage
Because Windows Server 2016 frequently hosts web services (IIS), the default web root directory was inspected for unauthorized file uploads:
Get-ChildItem -Path "C:\inetpub\wwwroot" -Recurse | Select-Object FullName, CreationTime, LastWriteTime- Evidence Found: An unauthorized web shell with a
.jspextension was discovered inC:\inetpub\wwwroot\. - Conclusion: The web application permitted arbitrary or unvalidated file uploads, allowing the adversary to place a server-side executable script and execute remote system commands.
Step 2.2: Dead End / Eliminated Hypothesis #2 (Apache/PHP Vector)
- Hypothesis: Suspected a secondary web vector via Apache Tomcat or XAMPP PHP services.
- Elimination & Verification: Checked
C:\xamppandC:\Program Files\Apache—no services existed. The compromise was strictly confined to the native IIS/Java web endpoint.
Phase 3: Privilege Escalation & Credential Harvesting
Step 3.1: Local Group Membership Audit
To verify which accounts held elevated rights:
net localgroup administrators- Evidence Found: Beyond the default
Administrator, bothJennyandGuesthad been added to the localAdministratorsgroup. Adding theGuestaccount to administrators is a severe anomaly indicating intentional backdoor privilege assignment.
Step 3.2: Security Event Log Analysis for Privilege Assignment
To pinpoint the exact timestamp when administrative privileges were first granted to the new logon session:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4672} | Select-Object TimeCreated, Message | Format-List- Evidence Found: Event ID 4672 (*Special privileges assigned to new logon*) occurred at
03/02/2019 4:04:49 PM, establishing the precise moment of privilege elevation.
Step 3.3: Staging Directory & Credential Extraction Tools
Inspecting known temporary and staging directories for post-exploitation binaries:
dir C:\temp /a- Evidence Found:
mimikatz.exewas present inC:\temp\. - Conclusion: The adversary executed Mimikatz with administrative privileges to dump cleartext credentials and NTLM hashes directly from the LSASS process memory.
Phase 4: Network Tampering, DNS Poisoning & Firewall Manipulation
Step 4.1: Host DNS Resolution Integrity
To inspect if local DNS resolution had been hijacked:
type C:\Windows\System32\drivers\etc\hosts- Evidence Found:
- - External Command & Control (C2) server IP:
76.32.97.132. - - DNS Poisoning: An entry mapped
google.comdirectly to an attacker-controlled IP address, allowing credential interception or fake authentication portals.
Step 4.2: Firewall Inbound Rule Inspection
To identify newly opened attack surface:
netsh advfirewall firewall show rule name=all dir=inOr via PowerShell:
Get-NetFirewallRule -Direction Inbound -Enabled True | Get-NetFirewallPortFilter | Where-Object {$_.LocalPort -ne 'Any'}- Evidence Found: A rogue inbound firewall rule explicitly permitted incoming connections on TCP Port
1337.
Persistence Mechanisms Analysis
The adversary established redundant persistence mechanisms to guarantee access across server reboots and credential rotations:
Mechanism 1: Registry Auto-Start Execution
- Registry Path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run - Command to Verify:
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"- Finding: A rogue value named
Updatewas created with a timestamp matching03/02/2019. When any user logs in, this key forces an automated outbound network connection to internal IP10.34.2.3.
Mechanism 2: Rogue Scheduled Task
- Task Name:
Clean file system(Deceptive naming convention to evade manual review) - Command to Verify:
schtasks /query /tn "Clean file system" /fo LIST /v- Action & Script: Configured to run daily, executing
C:\temp\nc.ps1. - Script Content Analysis:
Get-Content -Path "C:\temp\nc.ps1"- Finding: The PowerShell script is a Netcat-like network listener configured to bind locally to port
1348, providing an automated daily backdoor shell.
Comprehensive Indicators of Compromise (IoCs)
76.32.97.132Threat actor primary external C2 server in hosts file.
Action: Block at perimeter firewall and SIEM watch list.
10.34.2.3Internal IP destination in Registry Run\Update key.
Action: Isolate and investigate endpoint for lateral movement.
C:\inetpub\wwwroot\*.jspMalicious web shell uploaded via web application.
Action: Quarantine and submit for binary reverse engineering.
C:\temp\nc.ps1PowerShell listener backdoor executed by Scheduled Task.
Action: Delete and inspect script execution logs.
C:\temp\mimikatz.exeCredential harvesting tool used for LSASS memory dumping.
Action: Quarantine, compute SHA256, hunt enterprise-wide.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\UpdateRegistry startup persistence hook.
Action: Delete key from registry hive.
Clean file systemDaily execution trigger for nc.ps1.
Action: Delete task via schtasks /delete.
TCP 1348Backdoor listening port spawned by nc.ps1.
Action: Terminate listening PID, block inbound traffic.
TCP 1337Unauthorized port opened via Windows Firewall rule.
Action: Delete rogue firewall rule.
google.com -> Attacker IPMalicious DNS redirection entry in hosts file.
Action: Restore clean baseline hosts file.
GuestUnauthorized addition to Local Administrators group.
Action: Remove from Administrators, disable account.
JennyUnauthorized addition to Local Administrators group.
Action: Revoke admin rights, reset credentials.
Containment, Detection Engineering & Strategic Recommendations
Immediate Containment Checklist (First 60 Minutes)
- Network Isolation: Disconnect the host from the internal production VLAN to halt C2 beacons to
76.32.97.132and prevent lateral scans to10.34.2.3. - Account Remediation:
- - Immediately disable the
Guestaccount:net user Guest /active:no. - - Remove
GuestandJennyfrom Administrators:net localgroup administrators Guest /delete&net localgroup administrators jenny /delete. - - Force domain-wide password and Kerberos Golden Ticket / krbtgt resets due to verified Mimikatz execution.
- Artifact Neutralization:
- - Delete rogue scheduled task:
schtasks /delete /tn "Clean file system" /f. - - Delete registry persistence key:
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "Update". - - Delete rogue inbound firewall rule:
netsh advfirewall firewall delete rule name=all protocol=tcp localport=1337. - - Restore
C:\Windows\System32\drivers\etc\hoststo default clean state.
Concrete Detection Engineering Logic (Sigma Rule)
title: Suspicious Persistence via Run Key or Temp Scheduled Task
status: production
description: Detects creation of registry Run keys targeting raw IP addresses or scheduled tasks executing scripts from temporary directories.
logsource:
category: process_creation
product: windows
detection:
selection_registry:
EventID: 13
TargetObject|contains: 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
selection_task:
EventID: 4698
TaskContent|contains:
- 'C:\temp\'
- 'C:\Users\Public\'
- 'powershell.exe'
selection_mimikatz:
EventID: 4688
CommandLine|contains:
- 'sekurlsa::logonpasswords'
- 'lsadump::sam'
- 'mimikatz'
condition: selection_registry or selection_task or selection_mimikatz
falsepositives:
- Legitimate administrative maintenance scripts (rare in C:\temp)
level: criticalThe Critical Decision: Clean vs. Rebuild Analysis
Technical Justification:
- LSASS Credential Compromise: The adversary executed Mimikatz with full administrative privileges. In a Windows environment, once LSASS memory is dumped, all interactive user hashes, Kerberos tickets, and local admin passwords are compromised. Cleaning individual files does not guarantee that in-memory backdoors or harvested credentials are not already weaponized across the domain.
- Kernel & Subsystem Tampering: The adversary modified fundamental OS components: the Local Security Authority (SAM groups), the TCP/IP stack (hosts file), the firewall subsystem, and the Windows Registry.
- High Risk of Undetected Persistence: When an attacker establishes multiple persistent backdoors (Registry + Scheduled Task + Web Shell), there is a statistical probability of hidden secondary hooks (such as WMI Event Subscriptions, rogue service DLLs, or compromised COM objects) that evade manual triage.
- Enterprise Risk vs. Cost: Re-imaging a standardized Windows Server 2016 VM from an automated, immutable infrastructure-as-code (IaC) pipeline takes under 30 minutes and guarantees zero adversary dwell time. Attempting to manually "clean" an administratively compromised host leaves residual existential risk for the enterprise.
AI Transparency & Verification
- AI Assistance Disclosure: In compliance with professional engineering transparency standards, this report was authored and structured from original TryHackMe forensic investigation notes with the collaborative assistance of an AI engineering agent.
- Evidence Verification: All commands, registry locations, event IDs, and IoCs were tested and validated directly against the live target host environment.