Pradish
06/14/2024, 5:56 AMconst std::map<std::string, std::map<std::string, std::string>>
kAutoExecTableMappings = {
{"startup_items", {{"name", "name"}, {"path", "path"}}},
{"services", {{"module_path", "path"}, {"name", "name"}}},
{"scheduled_tasks", {{"name", "name"}, {"path", "path"}}},
{"ie_extensions", {{"name", "name"}, {"path", "path"}}},
{"drivers", {{"description", "name"}, {"image", "path"}}}};
Elaborating further, There are two ways to implement or create a Windows Services: one as a standalone executable and the other as a dynamic link library (DLL), also called the ServiceDLL. However, DLLs cannot run on their own; they require a host process to run, which is where svchost.exe comes into the picture. In the service table, the “module_path” column points to the path of this DLL.
The svchost.exe can host multiple service DLLs with related functionality, promoting resource efficiency. An example could be a service managing multiple network protocols, where each protocol is implemented in a separate DLL within svchost.exe, so this svchost.exe is a host for multiple services with related functionality implemented in a separate DLL. kind of a shared process.
to conclude we can say that if the service type is of "SHARE_PROCESS", only in those cases this module_path will have a valid path otherwise for all other types this value will be empty, I think this is what is happening in this case.
proposed fix:
by replacing the "module_path" with "path" this issue can be fixed, but it will be a breaking change, as the new path will not only include the full path to the service executable but will also include the command line arguments.
const std::map<std::string, std::map<std::string, std::string>>
kAutoExecTableMappings = {
{"startup_items", {{"name", "name"}, {"path", "path"}}},
{"services", {{"path", "path"}, {"name", "name"}}},
{"scheduled_tasks", {{"name", "name"}, {"path", "path"}}},
{"ie_extensions", {{"name", "name"}, {"path", "path"}}},
{"drivers", {{"description", "name"}, {"image", "path"}}}};