Svchost process function in Windows

Source: Internet
Author: User

Svchost.exe is a very important process in the Windows operating system based on ntversions. Many viruses and Trojans reside in the system and are closely related to this process. Therefore, it is necessary to have a deep understanding of this process. This article describes the functions of the Svchost process and its knowledge.
Svchost Process Overview

Microsoft defines "Svchost process" as the general host process name of the Service Running in Svchost.exe from the dynamic link library DLL. The Svchost.exe file is located in the "% SystemRoot % \ System32" folder. When the system starts, Svchost checks the service section in the Registry to build a list of services to be loaded. Multiple instances of Svchost can run simultaneously. Each Svchost session can contain a set of services to run different services based on the Svchost Startup Mode and location. This allows for better control and debugging.
The Svchost group is identified by the registry [HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows NT \ CurrentVersion \ Svchost. Each value under this registry key represents a separate Svchost group and is displayed as a separate instance when we view the active process. The key values here are of the REG_MULTI_SZ type and contain the service name 1 running in the Svchost group ).

 


In fact, Svchost serves only as the service host and does not implement any functions. If you need to use Svchost to start a service implemented in the form of a DLL, the Loader of the DLL points to Svchost. when starting the service, Svchost calls the DLL of the Service to start the service. The DLL file that uses Svchost to start a service is determined by the Parameters in the registry. Each registry key that needs to start the service has a "Parameters" subitem, the "ServiceDll" key value indicates which DLL file is responsible for the service, and this DLL file must be exported with a ServiceMain function to support service tasks.
Tip: different versions of Windows have different numbers of Svchost processes. In general, Windows 2000 has two Svchost processes, while Windows XP has four or more Svchost processes.
Svchost process example

To view the list of services running in Svchost, enter the "Tasklist/svc" command in the Windows XP Command Prompt window and press enter to run Windows 2000, you can use the Tlist tool provided by Support Tools. The command is "Tlist-s "). The Tasklist command displays the list of active processes, and the/svc command switch specifies to display the list of active services in each process. As you can see, the Svchost process starts many system services, such as RpcSsRemote Procedure Call, DhcpDHCP Client, NetmanNetwork Connections, and so on ).

 


Here we take the RpcSs Service as an example to learn more about the relationship between the Svchost process and the service. Run Regedit, open the Registry Editor, and expand the [HKEY_LOCAL_MACHINE \ SYSTEM CurrentControlSet \ Services \ RpcSs] branch in sequence. In the Parameters subitem, there is a key named "ServiceDll, the value is "% SystemRoot % \ system32 \ rpcss. dll ". This indicates that when the system starts the RpcSs Service, it calls the Rpcss. dll dynamic link library file under the "% SystemRoot % \ system32" directory.
Next, double-click "Administrative Tools> Services" from the Control Panel to open the service console. In the right pane, double-click the Remote Procedure CallRPC service item. In the displayed Properties dialog box, the executable file path of the RpcSs Service is "C: \ Windows \ system32 \ svchost-k rpcss ", which indicates that the RpcSs is started by Svchost."-k rpcss "indicates that this service is included in the Rpcss Service Group of Svchost.
Svchost process Trojan Analysis

We have learned from the previous introduction that, in the branch of the registry [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ Current-Version \ Svchost, stores the groups started by Svchost and various services in the group. Many Trojans and viruses use this to automatically load the data. Their common methods include:
• Add a new group and a service name to the group;
• Add a service name to an existing group or use an uninstalled service from the existing group;
• Modify the service in an existing group and point its ServiceDll to its own DLL file.
For example, PortLess BackDoor is a typical BackDoor tool loaded using the Svchost process. How can we detect and clear Trojans and viruses like PortLess BackDoor? Taking Windows XP as an example, we can first use a process tool such as "process spyware" To View module information in the Svchost process 3) and compare it with the previous module information, the Svchost process contains a suspicious DLL file "SvchostDLL. dll ". In addition, a new service "Intranet Services" is displayed in the "Administrative Tools> Services" list. The service name is Iprip, Which is started by Svchost, "-k netsvcs" indicates that this service is included in the Netsvcs Service Group.


Tip: in Windows 2000, the system's Iprip service listens for the route update Information sent by the router using the Routing Information Protocol version 1r00001, the name displayed in the service list is "RIP Listener ".
Run Regedit, open registry editor, and expand [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet

Services \ IPRIP] branch, view its "Parameters" subitem, where the "ServiceDll" key value points to the called DLL file path and full name, which is the backdoor DLL file. After knowing this, you can clear it by right-clicking the "Intranet Services" service in the service list and selecting "stop" from the menu ", then, delete the "Iprip" entry in the Registry branch. Restart the computer and delete the main file of the backdoor program according to the location indicated by the "ServiceDll" key value. The reader should be reminded that the registry should be backed up before modification so that the registry can be restored in time when an error occurs.


Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.