简体   繁体   English

将Windows服务作为“本地系统”运行有哪些安全风险?

[英]What are the security risks in running a Windows Service as “Local System”?

I have written a .NET Windows service which runs as "Local System". 我编写了一个运行为“本地系统”的.NET Windows服务。 Recently I read that, running as local system might expose system credential to hackers enabling them to take over the system. 最近我读到,作为本地系统运行可能会向黑客公开系统凭证,使他们能够接管系统。 What are the risks involved and how can I prevent them when I run service as Local System. 涉及的风险是什么?当我作为本地系统运行服务时,如何防止它们。

Services running as LocalSystem are part of the system's trusted space. 作为LocalSystem运行的服务是系统可信空间的一部分。 Technically speaking, they have the SeTcbName privilege. 从技术上讲,它们具有SeTcbName权限。 This means, inter alia , that such services can alter any security settings, grant themselves any privileges, and generally do anything Windows can do. 这意味着, 除其他外 ,此类服务可以更改任何安全设置,授予自己任何权限,并且通常可以执行Windows可以执行的任何操作。

As a result, any flaw in your service — unsanitized input passed to system functions, bad dll search paths, buffer overruns, whatever — becomes a critical security hole. 因此,您服务中的任何缺陷 - 传递给系统函数的未经过处理的输入,错误的dll搜索路径,缓冲区溢出等等 - 都成为一个关键的安全漏洞。 This is why no system administrator in an enterprise environment will permit your service to be installed if it runs under LocalSystem . 这就是为什么企业环境中的系统管理员如果在LocalSystem下运行则不允许安装服务的原因。 Use the LocalService and NetworkService accounts. 使用LocalServiceNetworkService帐户。

With any service that you run, or I believe any application, you should have the application remove permissions that are not needed, to reduce the impact of hackers. 对于您运行的任何服务,或者我相信任何应用程序,您应该让应用程序删除不需要的权限,以减少黑客的影响。

So, if the service doesn't need to write to the local directory, or delete, then remove that permission. 因此,如果服务不需要写入本地目录或删除,则删除该权限。

Also, you can look at whether you will need access to registry keys. 此外,您可以查看是否需要访问注册表项。

There are various permissions you can remove to limit the damage that can be done. 您可以删除各种权限以限制可以执行的损害。

Edit: You may want to do a find for S2. 编辑:您可能想要查找S2。 Window Services to find more information about the risks due to Local System. 窗口服务,用于查找有关本地系统风险的更多信息。 http://www.sans.org/top20/ http://www.sans.org/top20/

I think the main problem is that if someone will discover a security bug in your service that lets him access system resources and/or execute code - it access/execute with Local System rights (which are the same as built in Administrators). 我认为主要的问题是,如果有人在您的服务中发现一个安全漏洞,让他访问系统资源和/或执行代码 - 它使用本地系统权限(与管理员内置的相同)访问/执行。 The question is - are you totaly sure your service is hacker proof?? 问题是 - 你是否完全确定你的服务是黑客证明? :P :P

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在作为本地系统运行的 windows 服务中进行键盘和鼠标操作? - Making keyboard and mouse operations in a windows service running as a local system? 如何获取以用户身份运行的Windows 7应用程序的MainWindowHandle <foo> 从作为本地系统运行的服务中? - How can I get the MainWindowHandle of a Windows 7 application running as user <foo> from within a service running as Local System? 在本地系统下运行的Windows服务能否在其运行的计算机上创建新文件? - Can a Windows service running under Local System create new files on the computer it is running on? 在带有“本地系统帐户”的“ Windows服务”下运行时,.NET Windows 7截屏不起作用 - .NET Windows 7 take screenshot not working when running under 'Windows Service' with 'Local System Account' Windows服务作为本地服务运行-输入文件? - Windows service running as local service - input files? C#权限问题导致无法从以本地系统帐户身份运行的Windows服务创建文件夹。 - C# Privilege issues creating folders from Windows service running as Local System account. 我们可以访问在本地系统下运行的Windows服务中的网络文件吗? - Can we access network file in windows service running under local system? 作为系统帐户运行的 Windows 服务如何获取当前用户的 \AppData\Local\ 特殊文件夹? - How can Windows service running as System account get current user's \AppData\Local\ special-folder? 从服务运行msiexec(本地系统帐户) - Running msiexec from a service (Local System account) Windows 7操作系统中的服务不使用hosts文件作为本地服务 - Service in Windows 7 operating system not using the hosts file as local service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM