这个问题还是由我专业回答一下吧,我敢肯定悟空问答里的人百分之九十九都答不对,像我看的回答里的@BaSierL的回答,最终给大家了一个system权限,但是win10下最高权限不是system,而是TrustedInstaller。
举个小例子,你用@basierL的回答,得到一个系统权限之后:
例如路径C:\Windows\servicing,使用system权限无法在该路径创建文件。
查看文件夹属性,显示system不具有写入权限,只有TrustedInstaller可以,如下图:
启动TrustedInstaller服务会启动进程TrustedInstaller.exe,位置为C:\Windows\servicing\TrustedInstaller.exe,在powershell下查看该程序权限:
Get-Acl -Path C:\Windows\servicing\TrustedInstaller.exe |select Owner
显示为NT SERVICE\TrustedInstaller,如上图。
关于如何获得TrustedInstaller权限,可参考James Forshaw的这篇文章,很值得学习。
https://tyranidslair.blogspot.nl/2017/08/the-art-of-becoming-trustedinstaller.html
国外黑客James Forshaw的实现思路为借用TrustedInstaller.exe的token创建子进程,这样子进程就有了TrustedInstaller权限,具体powershell代码如下:
Set-NtTokenPrivilege SeDebugPrivilege
$p = Get-NtProcess -Name TrustedInstaller.exe
$pc = New-Win32Process cmd.exe -CreationFlags NewConsole -ParentProcess $p
powershell默认不支持Set-NtTokenPrivilege命令,该模块需要下载安装
下载地址:
https://www.powershellgallery.com/packages/NtObjectManager/1.1.1
安装命令:
Save-Module -Name NtObjectManager -Path c:\test
Install-Module -Name NtObjectManager
Save-Module需要powershell v5.0支持,正好WIN10支持power5.0。
然后我们再执行代码:
Set-ExecutionPolicy Unrestricted
Import-Module NtObjectManager
sc.exe start TrustedInstaller
Set-NtTokenPrivilege SeDebugPrivilege
$p = Get-NtProcess -Name TrustedInstaller.exe
$proc = New-Win32Process cmd.exe -CreationFlags NewConsole -ParentProcess $p
最后执行whoami /groups /fo list,发现你获得的CMD已经有了TrustedInstaller权限。
这个方法还是很复杂的。如果使用metasploit下的incognito也能够获得TrustedInstaller权限。但是需要安装metasploit,我就不再举例了。
再说一下@BaSierL的获取系统权限的方法,其实用psexec一条命令就可以做到。
psexec.exe -accepteula -s -d cmd.exe。
不过这是一个很冷的知识了,一般人都不会想到WIN10最高权限为TrustedInstaller。
最后,你想学到正确的黑客或电脑知识,欢迎关注我,我的头条号每篇文章都是实例测试,多方理论证实,争取让错误最少,争议最小,给你最通俗易懂的黑客知识。
联系客服