Services
Analyzing Malicious Service Activity in Windows Systems
Attackers often exploit Windows services to maintain persistence, execute malicious code, or disable security mechanisms. A thorough analysis of service-related activities is critical in identifying such threats.
Key Areas to Investigate
Newly Created or Modified Services
Disabled Security Services
1. Detecting Newly Created or Modified Services
How Attackers Leverage Services:
Create new services with legitimate-sounding names (e.g., "Chrome Update").
Modify existing services to execute malicious commands or scripts.
Detection via Event Logs:
Event ID 4697: A service was installed in the system.
Steps:
Open Event Viewer.
Navigate to:
Filter by Event ID 4697:
Review the following fields in the log:
Service Name: Check for names mimicking legitimate services.
Executable Path: Validate the path to ensure the service binary is not located in suspicious directories (e.g.,
C:\Temp\
orC:\Users\Public
).
Example: A newly installed service ChromeUpdate
points to C:\Temp\malicious.exe
. This is likely malicious, as Chrome’s update service typically resides in C:\Program Files
.
2. Identifying Disabled Security Services
Why Attackers Disable Security Services:
To bypass protection mechanisms such as antivirus, firewall, and Windows Defender.
Detection via Event Logs:
Event IDs:
7036: A service entered the stopped state.
7045: A service was installed in the system.
Steps:
Open Event Viewer.
Navigate to:
Filter by Event IDs 7036 and 7045:
Identify critical services that have been stopped unexpectedly (e.g., Windows Defender, Firewall).
Example: Logs show that Windows Defender was stopped shortly before suspicious network activity. This indicates the attacker may have disabled it to run malware without detection.
Service Analysis Tools
1. Autoruns (Sysinternals Tool)
Purpose: Detect auto-starting services and persistence mechanisms.
Steps:
Run Autoruns as Administrator.
Go to the Services tab.
Investigate:
Unfamiliar service names.
Unsigned services or those with no publisher information.
2. Command Line (CMD or PowerShell)
Using CMD:
Lists all services, including their state (running or stopped).
Using PowerShell:
Filters and lists all stopped services. Review why these were stopped, especially if they are critical security services.
Analyzing Deleted or Hidden Services
Attackers may delete services after use to evade detection. Logs can help trace these actions.
Log Sources:
Task Scheduler Logs: Trace services scheduled to run periodically.
Security Logs:
Event ID 4698: Service creation.
Event ID 4702: Service modification.
Example: A service named TempUpdater
was created and later deleted. Reviewing logs revealed it executed a script that established a reverse shell.
Eradication and Mitigation
Stop Malicious Services:
Disable the Service:
Delete the Service:
Remove Malicious Executables: Delete associated binaries:
Enable Critical Security Services: Re-enable services like Windows Defender and Firewall:
Key Takeaways
Persistence via Services: Attackers create or modify services to maintain long-term access.
Disabled Security Services: A common tactic to evade detection.
Critical Event IDs:
4697: Service installation.
7036: Service stopped.
7045: Service installed.
Recommended Action Steps:
Regularly review service-related logs.
Investigate newly created services and validate their file paths.
Monitor stopped critical services for signs of malicious activity.
Use Autoruns and PowerShell for comprehensive service analysis.
By employing these methods, incident responders can effectively detect and neutralize threats involving malicious Windows services.
Last updated