我有一台笔记本电脑,它的用户正在运行一个访客帐户,
有 2 个程序会在系统启动时自动启动(NetLimiter 和 TeamViewer)。这些程序隐藏在托盘中,但访客用户可以根据需要关闭它们。有没有办法防止这种情况?
我可以完全访问笔记本电脑,所以如果有任何配置或程序要安装,我可以做到。
RJF*_*ner 50
获取“进程资源管理器”并将两个程序上的“访客”权限设置为没有“终止”权限。
这仍然不能阻止他们正常关闭程序。您必须使用 3rd 方程序或注册表来隐藏窗口和系统托盘图标。
这似乎是您的实际问题。
看:
Ben*_*n N 35
Process Explorer 的答案只适用一次,但您可能希望即使在计算机重新启动后也能应用此方法。为此,您可以使用 PowerShell:
Param (
[string[]]$ProcessNames,
[string]$DenyUsername
)
$cscode = @"
using System;
using System.Security;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
public class ProcessSecurity : NativeObjectSecurity
{
public ProcessSecurity(SafeHandle processHandle)
: base(false, ResourceType.KernelObject, processHandle, AccessControlSections.Access)
{
}
public void AddAccessRule(ProcessAccessRule rule)
{
base.AddAccessRule(rule);
}
// this is not a full impl- it only supports writing DACL changes
public void SaveChanges(SafeHandle processHandle)
{
Persist(processHandle, AccessControlSections.Access);
}
public override Type AccessRightType
{
get { return typeof(ProcessAccessRights); }
}
public override AccessRule AccessRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
{
return new ProcessAccessRule(identityReference, (ProcessAccessRights)accessMask, isInherited, inheritanceFlags, propagationFlags, type);
}
public override Type AccessRuleType
{
get { return typeof(ProcessAccessRule); }
}
public override AuditRule AuditRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
{
throw new NotImplementedException();
}
public override Type AuditRuleType
{
get { throw new NotImplementedException(); }
}
}
public class ProcessAccessRule : AccessRule
{
public ProcessAccessRule(IdentityReference identityReference, ProcessAccessRights accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
: base(identityReference, (int)accessMask, isInherited, inheritanceFlags, propagationFlags, type)
{
}
public ProcessAccessRights ProcessAccessRights { get { return (ProcessAccessRights)AccessMask; } }
}
[Flags]
public enum ProcessAccessRights
{
STANDARD_RIGHTS_REQUIRED = (0x000F0000),
DELETE = (0x00010000), // Required to delete the object.
READ_CONTROL = (0x00020000), // Required to read information in the security descriptor for the object, not including the information in the SACL. To read or write the SACL, you must request the ACCESS_SYSTEM_SECURITY access right. For more information, see SACL Access Right.
WRITE_DAC = (0x00040000), // Required to modify the DACL in the security descriptor for the object.
WRITE_OWNER = (0x00080000), // Required to change the owner in the security descriptor for the object.
PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF, //All possible access rights for a process object.
PROCESS_CREATE_PROCESS = (0x0080), // Required to create a process.
PROCESS_CREATE_THREAD = (0x0002), // Required to create a thread.
PROCESS_DUP_HANDLE = (0x0040), // Required to duplicate a handle using DuplicateHandle.
PROCESS_QUERY_INFORMATION = (0x0400), // Required to retrieve certain information about a process, such as its token, exit code, and priority class (see OpenProcessToken, GetExitCodeProcess, GetPriorityClass, and IsProcessInJob).
PROCESS_QUERY_LIMITED_INFORMATION = (0x1000),
PROCESS_SET_INFORMATION = (0x0200), // Required to set certain information about a process, such as its priority class (see SetPriorityClass).
PROCESS_SET_QUOTA = (0x0100), // Required to set memory limits using SetProcessWorkingSetSize.
PROCESS_SUSPEND_RESUME = (0x0800), // Required to suspend or resume a process.
PROCESS_TERMINATE = (0x0001), // Required to terminate a process using TerminateProcess.
PROCESS_VM_OPERATION = (0x0008), // Required to perform an operation on the address space of a process (see VirtualProtectEx and WriteProcessMemory).
PROCESS_VM_READ = (0x0010), // Required to read memory in a process using ReadProcessMemory.
PROCESS_VM_WRITE = (0x0020), // Required to write to memory in a process using WriteProcessMemory.
SYNCHRONIZE = (0x00100000), // Required to wait for the process to terminate using the wait functions.
}
"@
Add-Type -TypeDefinition $cscode
$ProcessNames | % {
Get-Process -ProcessName $_ | % {
$handle = $_.SafeHandle
$acl = New-Object ProcessSecurity $handle
$ident = New-Object System.Security.Principal.NTAccount $DenyUsername
$ace = New-Object ProcessAccessRule ($ident, 'PROCESS_TERMINATE, PROCESS_SUSPEND_RESUME, WRITE_DAC', $false, 'None', 'None', 'Deny')
$acl.AddAccessRule($ace)
$acl.SaveChanges($handle)
}
}
Run Code Online (Sandbox Code Playgroud)
它基于此 Stack Overflow 答案。基本上,您向它提供要保护的进程列表和要保护的用户列表,它会适当地调整进程的 ACL。将其保存为.ps1
文件(用户可以读取但不能写入的地方),然后在用户的启动中放置一个包含类似内容的批处理文件:
powershell \path\to\script.ps1 ('snippingtool', 'mspaint') 'Guest' -executionpolicy bypass
Run Code Online (Sandbox Code Playgroud)
这可以保护snippingtool.exe
和mspaint.exe
(截图工具和油漆)不被来宾杀死。
请注意,这必须在这些进程启动后运行。您可能需要在 PowerShell 脚本块sleep 10
之后添加一个左右Param
。完成后,尝试使用任务管理器终止这些进程将导致:
另请注意,如果您测试它的帐户是管理员,或者更准确地说是SeDebugPrivilege
.
单击其窗口上的 X 或使用应用程序自己的关闭功能仍会使进程退出,因为所有进程都可以自由决定停止运行。您可能需要隐藏通知区域,如另一个答案中所述。此外,由于这些重要进程以访客用户身份运行,因此该用户是进程对象的所有者,并且无论如何都能够将 ACL 调整回来,或者可以使用PROCESS_VM_WRITE
能力来涂抹进程的内存并使它们崩溃。可以通过分别为OWNER RIGHTS
和 更改'PROCESS_TERMINATE, PROCESS_SUSPEND_RESUME, WRITE_DAC'
为来解决这些问题'PROCESS_ALL_ACCESS'
。
拒绝通过 GPO 访问任务管理器会阻止用户使用任务管理器(显然),这是最直接的解决方案,但没有什么能阻止他们运行自己的程序(或taskkill
不遵守组策略的程序)。如果您试图防御的进程以与您试图防御的用户不同的用户身份运行,那将是最好的。
当然,如果您的客人愿意不惜一切代价绕过这些各种“保护措施”,那么您可能会遇到更多的社会问题而不是技术问题。
小智 8
这实际上取决于您想要锁定访客用户帐户的程度,因此有关您希望访客帐户能够做什么/不做什么的更多信息会很方便。是否连接了计算机域?
也就是说,我个人的观点是,任何连接或未连接的来宾帐户域都应该被严格锁定,以确保使用该机器不会做任何恶意行为,特别是如果它不小心落入坏人之手。我首先使用组策略执行以下操作。
完全隐藏通知区域,以便您的用户无法访问任何在后台运行的应用程序。如果您需要它们与 NetLimiter 和 TeamViewer 交互,那么它们始终可以从开始菜单启动它们。
您需要的特定 GP 项目位于用户配置 > 管理模板 > 开始菜单和任务栏 > 隐藏通知区域
禁用对任务管理器的访问,这应该会阻止他们终止进程。
用户配置 > 管理模板 > 系统 > 删除任务管理器
我相信 NetLimiter 具有为不同用户设置权限的能力。探索这些,看看您是否可以删除控制应用程序的用户帐户能力。
这是一个良好的开端,如果您的用户稍微高级一点,那么它应该会限制大多数用户,那么您可能需要设置一些更全面的组策略
如果您需要,这是使用 GP 将策略限制到特定用户的很好指南http://www.sevenforums.com/tutorials/151415-group-policy-apply-specific-user-group.html
谢谢大家的所有详细回答,我最终使用了评论中的一些建议,这就是我所做的:
完全禁用来宾帐户,因为由于某种原因编辑注册表项不起作用,您需要管理员权限,一旦获得该权限,修改也将应用于管理员帐户(不确定这是否是常见的事情)或者对我来说只是一个错误)
创建一个新用户并为其执行以下操作:
禁用托盘图标(在注册表中)
禁用控制面板(在注册表中)
禁用任务管理器(在注册表中)
拒绝某些权限,以便他无法访问这些软件的位置(无法删除或卸载它们)
我这样做是为了让我的兄弟不能使用超过 20% 的互联网速度(他只是不会停止流媒体和种子下载......),我认为这些足以让他被锁定。
再次感谢!
归档时间: |
|
查看次数: |
15343 次 |
最近记录: |