1. 程式人生 > 其它 >Cobaltstrike系列教程(十一)提權與橫向移動

Cobaltstrike系列教程(十一)提權與橫向移動

0x00-前文

有技術交流或滲透測試培訓需求的朋友歡迎聯絡QQ/VX-547006660,需要程式碼審計、滲透測試、紅藍對抗網路安全相關業務可以看置頂博文

2000人網路安全交流群,歡迎大佬們來玩
群號820783253

Cobaltstrike系列教程(一)簡介與安裝
https://bbs.ichunqiu.com/thread-52937-1-1.html
Cobaltstrike系列教程(二)Listner與Payload生成
https://bbs.ichunqiu.com/thread-52982-1-1.html
Cobaltstrike系列教程(三)beacon詳解
https://bbs.ichunqiu.com/thread-52994-1-1.html


Cobaltstrike系列教程(四)選單欄與檢視
https://bbs.ichunqiu.com/thread-52997-1-1.html
Cobaltstrike系列教程(五)憑據匯出
https://bbs.ichunqiu.com/thread-53001-1-1.html
Cobaltstrike系列教程(六)檔案/程序管理與鍵盤記錄
https://bbs.ichunqiu.com/thread-53003-1-1.html
Cobaltstrike系列教程(七)埠掃描與Net View
https://bbs.ichunqiu.com/thread-53012-1-1.html
Cobaltstrike系列教程(八)截圖與瀏覽器代理
https://bbs.ichunqiu.com/thread-53013-1-1.html

Cobaltstrike系列教程(九)內建Socks與神器EW
https://bbs.ichunqiu.com/thread-53014-1-1.html

0x001-提權

1.右鍵選單提權:

選擇beacon,右鍵,執行-->提權

我由於載入了外掛,所以比官方多了幾種提權方式
外掛下載請看我之前的帖子

ms14-058/ms15-051/ms16-016/ms16-032

這些都是大家耳熟能詳的Windows本地提權漏洞,在此外掛中都已經整合

UAC-DLL

這是一種繞過UAC的攻擊,它試圖將本地管理員執行的有效負載從低許可權提升到高許可權。此攻擊使用UAC漏洞將ArtifactKit生成的DLL複製到特權位置。此攻擊適用於Windows7和Windows8及更高版本的未修補版本。

uac-token-duplication

這是另一種繞過UAC的攻擊,將其從低許可權提升到高許可權(作為本地管理員)。這種攻擊使用一個UAC漏洞,允許非提升程序使用從提升程序中竊取的令牌啟動任意程序。此漏洞要求攻擊刪除分配給提升令牌的多個許可權。此攻擊適用於Windows7及更高版本。如果AlwaysNotify處於其最高設定,則此攻擊要求提升的程序已在當前桌面會話中執行(作為同一使用者),此漏洞使用PowerShell生成會話。

Uac-eventvwr

這種提權方法是利用時間檢視器eventvwr,通過登錄檔之後,執行Eventvwr.exe會自動載入我們的A.exe(exp),這個時候他的許可權就是高了,成功繞過UAV

Uac-wscript

這種繞過uac提權的方法最初是在Empire框架中現身的,該方法只針對Windows7有效

2.自用EXP提權

這種方式就是比較常規的方法,自己上傳最新的EXP進行提權,至於檔案上傳和執行的方法,之前已經講過,在此不多贅述
最近測試CVE-2019-0803的提權效果不錯,影響版本非常廣

Microsoft Windows Server 2019 0
Microsoft Windows Server 2016 0
Microsoft Windows Server 2012 R2 0
Microsoft Windows Server 2012 0
Microsoft Windows Server 2008 R2 for x64-based Systems SP1
Microsoft Windows Server 2008 R2 for Itanium-based Systems SP1
Microsoft Windows Server 2008 for x64-based Systems SP2
Microsoft Windows Server 2008 for Itanium-based Systems SP2
Microsoft Windows Server 2008 for 32-bit Systems SP2
Microsoft Windows Server 1803 0
Microsoft Windows Server 1709 0
Microsoft Windows RT 8.1
Microsoft Windows 8.1 for x64-based Systems 0
Microsoft Windows 8.1 for 32-bit Systems 0
Microsoft Windows 7 for x64-based Systems SP1
Microsoft Windows 7 for 32-bit Systems SP1
Microsoft Windows 10 Version 1809 for x64-based Systems 0
Microsoft Windows 10 Version 1809 for ARM64-based Systems 0
Microsoft Windows 10 Version 1809 for 32-bit Systems 0
Microsoft Windows 10 Version 1803 for x64-based Systems 0
Microsoft Windows 10 Version 1803 for ARM64-based Systems 0
Microsoft Windows 10 Version 1803 for 32-bit Systems 0
Microsoft Windows 10 version 1709 for x64-based Systems 0
Microsoft Windows 10 Version 1709 for ARM64-based Systems 0
Microsoft Windows 10 version 1709 for 32-bit Systems 0
Microsoft Windows 10 version 1703 for x64-based Systems 0
Microsoft Windows 10 version 1703 for 32-bit Systems 0
Microsoft Windows 10 Version 1607 for x64-based Systems 0
Microsoft Windows 10 Version 1607 for 32-bit Systems 0
Microsoft Windows 10 for x64-based Systems 0
Microsoft Windows 10 for 32-bit Systems 0

EXP的下載連結為:https://github.com/k8gege/K8tools/raw/master/CVE-2019-0803.exe
用法:CVE-2019-0803.exe cmd cmdline,可能需要多執行幾次才可以成功

3.Powershell提權

在此需要使用beacon中的命令-powershell-import

beacon> help powershell-import
Use: powershell-import [/path/to/local/script.ps1]

Import a powershell script which is combined with future
calls to the powershell command. You may only use one
imported script at a time.


使用 powershell-import 本地匯入我們的指令碼,powershell執行,PowerUp.ps1 這個模組是個提權輔助模組
下載連結:https://github.com/HarmJ0y/PowerUp

0x002-橫向移動

橫向滲透概念:

橫向滲透攻擊技術是複雜網路攻擊中廣泛使用的一種技術,特別是在高階持續威脅(Advanced Persistent Threats,APT)中更加熱衷於使用這種攻擊方法。攻擊者可以利用這些技術,以被攻陷的系統為跳板,訪問其他主機,獲取包括郵箱、共享資料夾或者憑證資訊在內的敏感資源。攻擊者可以利用這些敏感資訊,進一步控制其他系統、提升許可權或竊取更多有價值的憑證。藉助此類攻擊,攻擊者最終可能獲取域控的訪問許可權,完全控制基於Windows系統的基礎設施或與業務相關的關鍵賬戶。
在提權後,我們可以用mimikatz dump目標機的憑證,並進行內網橫向移動

1.Psexec橫向移動

在執行埠掃描後
目標檢視中,選擇一個目標,右鍵-->登入--p**ec,即可選擇憑證進行橫向移動

如果該機使用了和之前的目標機一樣的憑證,則會成功返回一個system beacon

2.竊取令牌

在程序列表中,尋找以域管理員身份執行的程序,並選定進行steal token,如果成功,則會返回域管許可權的beacon,但是一般情況下絕不會那麼簡單的...在此就不演示了。

3.其他手段橫向移動

①使用各種系統漏洞:比如說用ms17-010,ms08-067批量檢測一下內網~
我之前的帖子發過cobaltstrike中ms17-10的利用指令碼,貌似是從Empire框架上拔下來的。如圖,該指令碼集成了掃描與漏洞利用,可謂是非常方便

PS:等到cve2019-0708一出,又是一場腥風血雨
②弱口令檢測
內網中ssh弱口令,各種資料庫的弱口令可謂是層出不窮。Mysql可以mof提權,sqlserver可以xp_cmdshell,redis寫shell,oracle也有方法執行系統命令。
③中介軟體漏洞
這個就非常常見了,比如weblogic各種rce漏洞等等
④Web端漏洞
挖掘web端漏洞,大家都懂
⑤其他
大家自行總結~