Service Creation and Modification
What you'll learn: How attackers abuse Windows services and Linux systemd units to maintain persistent access to compromised systems.
The Core Concept
Services (Windows) and systemd units (Linux) are privileged background processes that start automatically with the operating system. Unlike scheduled tasks that run at specific times, services run continuously or on-demand, often with elevated privileges. Attackers exploit this by creating malicious services, disguising them among legitimate ones, or hijacking existing service configurations.
Think of services as security guards at a building: they're always on duty, highly trusted, and have access to restricted areas. If an attacker can impersonate or corrupt a guard, they gain powerful, persistent control.
Windows Service Attacks
Service Creation: Attackers use sc.exe or direct registry manipulation to create new services that execute their malware. Example: a service named "Windows Update Helper" (mimicking legitimate names) set to start automatically.
Service Masquerading: Malicious services are given names and descriptions similar to legitimate Windows services to avoid detection during manual inspection. A service called "WindowsDefenderService" (note the subtle misspelling) blends into a list of real services.
Service DLL Hijacking: Many Windows services load DLLs at startup. If an attacker places a malicious DLL in a directory the service searches before the legitimate path, their code executes with service privileges. This exploits search order vulnerabilities.
Linux systemd Unit Abuse
On Linux, attackers create or modify systemd unit files (.service files in /etc/systemd/system/) to launch malware at boot. Similar masquerading tactics apply—naming units to resemble legitimate services like "networkd-helper.service."
Detection Challenges
These techniques are powerful because services operate in the background, require elevated privileges to modify (making detection seem "official"), and blend into dozens of legitimate services on typical systems.
Key Takeaway: Attackers create, masquerade, or hijack services and systemd units to achieve privileged, automatic persistence—detection requires monitoring service creation, verifying DLL paths, and recognizing naming deceptions.