Hunting for Unusual Service Installations
Overview
Attackers frequently install malicious Windows services for persistence and privilege escalation (MITRE ATT&CK T1543.003 — Create or Modify System Process: Windows Service). Event ID 7045 in the System event log records every new service installation. This skill parses .evtx log files to extract service installation events, flags suspicious binary paths (temp directories, PowerShell, cmd.exe, encoded commands), and correlates with known attack patterns.
When to Use
Trigger phrases:
"hunting for unusual service installations"
"Detect suspicious Windows service installations (MITRE ATT&CK T1543"
When investigating security incidents that require hunting for unusual service installations
When building detection rules or threat hunting queries for this domain
When SOC analysts need structured procedures for this analysis type
When validating security monitoring coverage for related attack techniques
Prerequisites
- Python 3.9+ with
python-evtx, lxml
- Windows System event log (.evtx) files
- Access to live System event log (optional, for real-time monitoring)
- Sysmon logs for enhanced process tracking (optional)
Steps
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Parse System.evtx for Event ID 7045 (new service installed)
- Extract service name, binary path, service type, and account
- Flag services with suspicious binary paths (temp dirs, encoded commands)
- Detect PowerShell-based service creation patterns
- Identify services running as LocalSystem with unusual paths
- Cross-reference with known legitimate service baselines
- Generate threat hunting report with MITRE ATT&CK T1543.003 mapping
Expected Output
- JSON report listing all new service installations with risk scores, suspicious indicators, and remediation recommendations
- Timeline of service installation events with binary path analysis
When NOT to Use
- You're responding to a known incident (use IR skills)
- Task is about analyzing confirmed malware (use analyzing-* skills)
- You need to implement detection rules (use implementing-* skills)
- Task is about vulnerability scanning (use scanning tools)
- You don't have access to endpoint/network data
- Task requires compliance auditing (use auditing-* skills)
Red Flags
- Performing actions without explicit written authorization from the asset owner
- Testing against production systems without a defined scope and rules of engagement
- Acting on threat intelligence without validating source reliability
- Sharing classified or sensitive indicators without proper handling procedures
- Alerting threat actors to detection capabilities through visible response actions
Process
- Reconnaissance — Gather target information, identify attack surface, enumerate services
- Analysis/Exploitation — Execute the technique, analyze results, document findings
- Reporting — Document IOCs, write findings, provide remediation recommendations
Verification
- All steps executed successfully against a test environment before production use
- Output documented with screenshots or logs demonstrating expected behavior
- Results validated against known-good baselines or reference implementations
- Documentation complete enough for another analyst to reproduce findings
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: hunting-for-unusual-service-installations3description: Use when detect suspicious Windows service installations (MITRE ATT&CK4 T1543.003) by parsing System event logs for Event ID 7045, analyzing service binary5 paths, and identifying indicators of persistence mechanisms. Use when detecting6 suspicious windows service installations (mitre att&ck t1543.003) by parsing.7domain: cybersecurity8subdomain: threat-hunting9tags:10- threat-hunting11- T1543.00312- service-installation13- persistence14- Event-704515- Sysmon16- Windows-services17version: '1.0'18author: oyi7719license: Apache-2.020d3fend_techniques:21- Platform Hardening22- System Configuration Permissions23- Restore Object24- Restore Database25- Asset Inventory26nist_csf:27- DE.CM-0128- DE.AE-0229- DE.AE-0730- ID.RA-0531category: cybersecurity32metadata:33 source: https://skillmd.com/skills/oyi77/hunting-for-unusual-service-installations34---353637# Hunting for Unusual Service Installations3839## Overview4041Attackers frequently install malicious Windows services for persistence and privilege escalation (MITRE ATT&CK T1543.003 — Create or Modify System Process: Windows Service). Event ID 7045 in the System event log records every new service installation. This skill parses .evtx log files to extract service installation events, flags suspicious binary paths (temp directories, PowerShell, cmd.exe, encoded commands), and correlates with known attack patterns.424344## When to Use45**Trigger phrases:**46- "hunting for unusual service installations"47- "Detect suspicious Windows service installations (MITRE ATT&CK T1543"484950- When investigating security incidents that require hunting for unusual service installations51- When building detection rules or threat hunting queries for this domain52- When SOC analysts need structured procedures for this analysis type53- When validating security monitoring coverage for related attack techniques5455## Prerequisites5657- Python 3.9+ with `python-evtx`, `lxml`58- Windows System event log (.evtx) files59- Access to live System event log (optional, for real-time monitoring)60- Sysmon logs for enhanced process tracking (optional)6162## Steps6364```python65# Example: IOC detection66import re6768IOC_PATTERNS = {69 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",70 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",71 "hash_md5": r"\b[a-f0-9]{32}\b",72 "hash_sha256": r"\b[a-f0-9]{64}\b",73}7475def extract_iocs(text: str) -> dict:76 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}77```78791. Parse System.evtx for Event ID 7045 (new service installed)802. Extract service name, binary path, service type, and account813. Flag services with suspicious binary paths (temp dirs, encoded commands)824. Detect PowerShell-based service creation patterns835. Identify services running as LocalSystem with unusual paths846. Cross-reference with known legitimate service baselines857. Generate threat hunting report with MITRE ATT&CK T1543.003 mapping8687## Expected Output8889- JSON report listing all new service installations with risk scores, suspicious indicators, and remediation recommendations90- Timeline of service installation events with binary path analysis91## When NOT to Use9293- You're responding to a known incident (use IR skills)94- Task is about analyzing confirmed malware (use analyzing-* skills)95- You need to implement detection rules (use implementing-* skills)96- Task is about vulnerability scanning (use scanning tools)97- You don't have access to endpoint/network data98- Task requires compliance auditing (use auditing-* skills)99100101## Red Flags102103- Performing actions without explicit written authorization from the asset owner104- Testing against production systems without a defined scope and rules of engagement105- Acting on threat intelligence without validating source reliability106- Sharing classified or sensitive indicators without proper handling procedures107- Alerting threat actors to detection capabilities through visible response actions108109## Process1101111. **Reconnaissance** — Gather target information, identify attack surface, enumerate services1121. **Analysis/Exploitation** — Execute the technique, analyze results, document findings1131. **Reporting** — Document IOCs, write findings, provide remediation recommendations114115## Verification116117- All steps executed successfully against a test environment before production use118- Output documented with screenshots or logs demonstrating expected behavior119- Results validated against known-good baselines or reference implementations120- Documentation complete enough for another analyst to reproduce findings121122## Anti-Rationalization Table123124| Rationalization | Reality |125|---|---|126| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |127| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |128| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |