Using a Legitimate Service as a Host

The second method involves using a legitimate service as a host for a malicious one. Attackers inject malicious code into the service process, effectively transforming it into a vehicle for their nefarious activities. The service retains its original function, making this type of service hijacking even harder to detect.

To identify this, we look for anomalous behavior in the service. This could be unusual CPU usage, unexpected network connections, or the service accessing files and directories it normally wouldn’t. Memory analysis can also be used to find the injected code, but this requires a more advanced skill set. In this form of service hijacking, rather than changing the configuration of an existing service, the attacker injects malicious code into the process space of a running service.

Let’s look at an example of this technique, also known as process hollowing or process injection, where the `svchost.exe` process on a Windows machine is a common target.

`svchost.exe` is a generic host process name for services that run from dynamic-link libraries (DLLs), and it’s not uncommon to find multiple instances of `svchost.exe` running at any given time. This makes it an ideal candidate for an attacker seeking to blend in with legitimate system activities. The attacker might use a technique like DLL injection, where they force `svchost.exe` to load a malicious DLL. The code in this DLL could perform a variety of tasks, from keylogging, to establishing a reverse shell for the attacker.

From the system’s point of view, it just looks like `svchost.exe` is running as usual. However, underneath the surface, the service is hosting malicious activities.

As noted above, detection of this type of service hijacking is challenging and requires looking for anomalous behavior. This could include unexpected network connections from `svchost.exe,` unusual CPU usage, or the service accessing files and directories it normally wouldn’t. Sophisticated detection mechanisms like memory forensics can also be useful. Specific tools can help identify injected code in a process’ memory space.

Using a legitimate service as a host for malicious activities is a stealthy technique that threat actors employ. It highlights the importance of comprehensive monitoring and a deep understanding of normal service behavior in order to spot anomalies indicative of a compromise. Recognizing these tactics and knowing how to detect them are key skills in the modern landscape of cybersecurity.

 

Deeper Security Brings Peace of Mind

Both variants of service hijacking underscore the necessity for comprehensive monitoring and analysis. Simply relying on identifying unrecognized services is insufficient. It is paramount to build robust baseline knowledge of your network’s normal behavior and use that information to spot anomalies. Furthermore, regular audits of service configurations and the use of advanced detection techniques like memory analysis can significantly enhance your ability to detect service hijacking.

 

DeepSeas MDR+ for OT, IT, mobile and cloud is a comprehensive Managed Detection & Response solution designed to protect businesses from sophisticated cyber threats – offering peace of mind through 24/7 protection, fast and complete threat response, and a way to optimize existing security investments.

Remember, your adversaries may be relentless, but with the right knowledge and tools, so are you.

 

This beginner’s guide to nuances of service hijacking was written by a valued member of our DeepSeas crew,