返回目錄html
本實踐目標是掌握metasploit的基本應用方式,重點經常使用的三種攻擊方式的思路。具體須要完成:python
- 一個主動攻擊實踐,如ms08_067(1分)
- 一個針對瀏覽器的攻擊,如ms11_050(1分)
- 一個針對客戶端的攻擊,如Adobe(1分)
- 成功應用任何一個輔助模塊(0.5分)
以上四個小實踐可不限於以上示例,並要求至少有一個是和其餘全部同窗不同的,不然扣除0.5分。linux
返回目錄ios
10.211.55.10
)10.211.55.14
)10.211.55.16
)返回目錄nginx
exploit
,payload
,encode
:
exploit
:利用漏洞,將真正要負責攻擊的代碼傳送到靶機中。payload
:載荷,實際上就是以前咱們實驗中作到的shellcode,exploit把它傳送到靶機中後,它就負責執行相應的攻擊代碼。Skoudis在他的《決戰惡意代碼》中這樣寫道,病毒一般會作一些有害的或者惡性的動做。在病毒代碼中實現這個功能的部分叫作「有效負載」(payload)。payload能夠實現任何運行在受害者環境中的程序所能作的事情,而且可以執行動做包括破壞文件刪除文件,向病毒的做者或者任意的接收者發送敏感信息,以及提供通向被感染計算機的後門。encode
:編碼,主要是爲了不以前的payload中出現壞字符,從而影響payload的功能,其次是爲了實現免殺,不讓殺毒軟件很輕易的就發現payload是攻擊代碼。返回目錄git
Armitage基本介紹
- Armitage是一款基於Java的Metasploit圖形界面化的攻擊軟件,能夠用它結合 Metasploit中已知的exploit來針對主機存在的漏洞自動化攻擊。經過命令行的方式使用Metasploit難度較高,須要記憶的命令過多,而Armitage完美的解決了這一問題,用戶只須要簡單的點擊菜單,就能夠實現對目標主機的安全測試和攻擊。Armitage良好的圖形展現界面,使得攻擊過程更加直觀,用戶體驗更好。因其操做的簡單性,尤爲適合Metasploit初學者對目標系統進行安全測試和攻擊。githubArmitage攻擊目標主機的的通常方法sql
- **目標網絡掃描**:爲了肯定目標主機所在網絡結構的網絡拓撲,爲後續目標主機信息搜索和攻擊奠基基礎。 - **目標主機信息蒐集**:爲了收集目標主機的漏洞信息,根據收集到的漏洞信息能夠利用Armitage在Metasploit中自動搜索合適的攻擊模塊。 - **目標主機攻擊模塊搜索**:主要方法是依據發現的漏洞信息尋找能夠突破目標系統的現有漏洞利用模塊,爲具體的攻擊方案制定提供儘量多的可靠支撐。
返回目錄shell
/etc/init.d/postgresql start
命令啓動postgresql服務:armitage
命令啓動Armitage:Hosts
->Nmap Scan
->Quick Scan(OS detect)
:10.211.55.0/24
:10.211.55.16
,右鍵選擇Services
,查看靶機上開啓的服務:10.211.55.16
,右鍵選擇Scan
,Armitage會調用Metasploit的漏洞掃描模塊,定向掃描靶機,尋找存在的漏洞,爲下一步肯定攻擊方法提供參考依據:10.211.55.16
,依次選擇菜單欄Attacks
->Find Attacks
,Armitage會開始自動搜索尋找合適的攻擊模塊:ms08_067漏洞介紹:windows
This module exploits a parsing flaw in the path canonicalization code of NetAPI32.dll through the Server Service. This module is capable of bypassing NX on some operating systems and service packs. The correct target must be used to prevent the Server Service (along with a dozen others in the same process) from crashing. Windows XP targets seem to handle multiple successful exploitation events, but 2003 targets will often crash or hang on subsequent attempts. This is just the first version of this module, full support for NX bypass on 2003, along with other platforms, is still in development.
10.211.55.16
主機右鍵能夠發現多了Attack
菜單。依次選擇Attack
->smb
->ms08_067_netapi
菜單,選擇smb漏洞下的ms08_067漏洞對XP靶機進行攻擊(也能夠在Armitage左側樹型目錄下依次選擇exploit
->windows
->smb
->ms08_067_netapi
找到該漏洞):Targets
處配置靶機的系統(通常默認自動檢測靶機系統),勾選Use a reverse connection
,點擊Launch
開始攻擊:Meterpreter 1
->Interact
->Command Shell
,輸入dir
命令查看靶機C:\WINDOWS\system32
目錄下的系統文件:在攻擊成功的靶機上右鍵選擇Meterpreter 1
->Interact
->Meterpreter Shell
,輸入getuid
命令查看靶機當前用戶的權限是SYSTEM權限:
攻擊完成(⁎⁍̴̛ᴗ⁍̴̛⁎):
ms14_064_ole_code_execution漏洞簡介:
This module exploits the Windows OLE Automation array vulnerability, CVE-2014-6332. The vulnerability is known to affect Internet Explorer 3.0 until version 11 within Windows 95 up to Windows 10, and no patch for Windows XP. However, this exploit will only target Windows XP and Windows 7 box due to the Powershell limitation. Windows XP by defaults supports VBS, therefore it is used as the attack vector. On other newer Windows systems, the exploit will try using Powershell instead.
exploit
->windows
->browser
->ms14\_064\_ole\_code\_execution
找到該漏洞並雙擊打開配置界面開始配置。注意!此處須要把AllowPowershellPrompt
置爲1!!而後配置好LHOST/RHOST、LPORT/RPORT等信息(把LPORT改爲學號,其他均取默認值),Targets
處配置靶機的系統Windows XP,點擊Launch
開始攻擊:http://10.211.55.10:8080/0KO2YrGZdZ1viW/SrEsdO/
並回車,在靶機看來彷佛並無發生什麼!然而此時Armitage中靶機的圖標已發生明顯變化,代表Kali攻擊機已攻擊成功!!Meterpreter 1
,發現除了上個攻擊實踐中查看Command Shell
和Meterpreter Shell
功能以外,還具備查看瀏覽器文件、進程、截屏等功能!
Explore
->Browse Files
查看瀏覽器文件: Explore
->Show Processes
查看靶機進程(這個比較有用啊emmm):Explore
->Screenshot
進行截屏(據說你是截屏狂魔?):Explore
->Webcam shot
調一波網絡攝像頭(顏控必備233):ms17_010_eternalblue漏洞介紹:
This module is a port of the Equation Group ETERNALBLUE exploit, part of the FuzzBunch toolkit released by Shadow Brokers. There is a buffer overflow memmove operation in Srv!SrvOs2FeaToNt. The size is calculated in Srv!SrvOs2FeaListSizeToNt, with mathematical error where a DWORD is subtracted into a WORD. The kernel pool is groomed so that overflow is well laid-out to overwrite an SMBv1 buffer. Actual RIP hijack is later completed in srvnet!SrvNetWskReceiveComplete. This exploit, like the original may not trigger 100% of the time, and should be run continuously until triggered. It seems like the pool will get hot streaks and need a cool down period before the shells rain in again. The module will attempt to use Anonymous login, by default, to authenticate to perform the exploit. If the user supplies credentials in the SMBUser, SMBPass, and SMBDomain options it will use those instead. On some systems, this module may cause system instability and crashes, such as a BSOD or a reboot. This may be more likely with some payloads.
Hosts
->Nmap Scan
->Quick Scan(OS detect)
並填寫靶機所在網段10.211.55.0/24
搜索存活的主機:10.211.55.16
)一臺win7(IP爲10.211.55.14
):Attacks
->Find Attacks
,Armitage會開始自動搜索靶機尋找合適的攻擊模塊,對於win7右鍵依次選擇Attack
->smb
,能夠發現Armitage提供了5個可供攻擊的smb漏洞,選擇check exploits
檢查這些漏洞是否能被攻擊:ipass_pipe_exec
沒有檢測結果不知道可否進行攻擊以外其餘4個所有陣亡,要麼不可利用(not exploitable)要麼檢測不出來(not support check):exploit
->windows
->smb
->ms17_010_eternalblue
找到傳說中的eternalblue永恆之藍並雙擊打開配置界面,相關配置均用默認值便可:Launch
開始攻擊win7:Use a reverse connection
,點擊Launch
開始攻擊:不過另外一臺靶機就沒那麼給面子了,可能因爲eternalblue只能攻擊Windows 7和Windows server 2008,攻擊xp時會顯示操做系統不匹配攻擊不成功(._.)
Microsoft Office CVE-2017-11882漏洞介紹:
Module exploits a flaw in how the Equation Editor that allows an attacker to execute arbitrary code in RTF files without interaction. The vulnerability is caused by the Equation Editor, to which fails to properly handle OLE objects in memory.
apt-get install nginx
cd /usr/share/nginx/html/
systemctl start nginx
git clone https://github.com/Ridter/CVE-2017-11882.git
cd CVE-2017-11882/
cve.doc
(靶機在打開該測試文件時同時會自動打開計算器程序calc.exe
,以驗證Office CVE-2017-11882漏洞的存在):python Command43b_CVE-2017-11882.py -c "cmd.exe /c calc.exe" -o cve.doc
cve.doc
放到網站根目錄:cp cve.doc /usr/share/nginx/html/
ls /usr/share/nginx/html/
cve.doc
:
ncat.exe -lv 5314 > cve.doc
ncat -nv 10.211.55.14 5314 < cve.doc
cve.doc
,成功彈出calc.exe
計算器程序,測試成功:exploit
->windows
->fileformat
->office\_ms17\_11882
找到該漏洞並雙擊打開配置界面開始配置,注意有兩處配置須要手動修改:
cve2.doc
!Launch
開始自動化攻擊流程:cve2.doc
所在路徑!cve2.doc
傳到靶機上:win7靶機進入ncat目錄,打開cve2.doc
,觸發訪問10.211.55.10:8080/5314
就會獲得反彈到5314
端口的TCP會話:
因而可憐的靶機又被我攻陷了哈哈哈哈哈!!
來抓個屏笑一個?^_^
jtr_linux密碼破解模塊簡介:
This module uses John the Ripper to identify weak passwords that have been acquired from unshadowed passwd files from Unix systems. The module will only crack MD5 and DES implementations by default. Set Crypt to true to also try to crack Blowfish and SHA implementations. Warning: This is much slower.
John the Ripper簡介:
The John The Ripper module is used to identify weak passwords that have been acquired as hashed files (loot) or raw LANMAN/NTLM hashes (hashdump). The goal of this module is to find trivial passwords in a short amount of time. To crack complex passwords or use large wordlists, John the Ripper should be used outside of Metasploit. This initial version just handles LM/NTLM credentials from hashdump and uses the standard wordlist and rules.
分別將不一樣用戶名對應的密碼通過MD5在線加密以後獲得Hash值,得到下面這張表:
用戶名 | 密碼 | Hash |
---|---|---|
admin | admin | 21232f297a57a5a743894a0e4a801fc3 |
user | user | ee11cbb19052e40b07aac0ca060c23ee |
Tom | password | 5f4dcc3b5aa765d61d8327deb882cf99 |
jtr_linux | abc123 | e99a18c428cb38d5f260853678922e03 |
20155314 | qwertyu123. | 682e9cfe26d949a10009cfc9969076ad |
kxjsjc@163.com | kxjsjc_wx_1553 | d80b3f4f2517d9a3ecf2a1e8031f6ff1 |
hashes.txt
的文本文件,把表中信息添加進去,每行包含一個用戶名和一個Hash,以:
分隔(username:hash
):auxiliary
->analyze
->jtr_linux
並雙擊打開開始配置,配置好JOHN_PATH而後點Launch
:show options
命令還能夠查看模塊的有效選項及其詳細描述:hashes.txt
而報錯:(john --wordlist=/tmp/jtrtmp20180502-5917-ctqwpk --format=raw-md5 hashes.txt
至於剩下的兩個,多是我把密碼設置得太複雜的緣由吧一直沒破解出來(ー ー;)將--wordlist
選項去掉採用暴力破解的方式也一直沒跑出來(ー ー;)時間緣由跑了不到10分鐘就被我掐掉了感受速度仍是比彩虹表要慢不少啊(ー ー;)
/etc/init.d/postgresql start
命令啓動postgresql服務,重啓Armitage便可: Hacker的漏洞攻擊也不是萬能的。本次漏洞攻擊實驗讓我感到很是疲憊,從週三開始裝各類虛擬機挨個找漏洞一直弄到週六纔可貴成功第一次攻擊。在作第一個ms08_067漏洞攻擊時,首先是靶機操做系統的選擇上,因爲第一個常用的win7虛擬機已在清明假期被我用騰訊電腦管家打好了補丁極可能沒辦法實施攻擊,所以我先拿PKI實驗課上裝的沒有任何安全防禦的win7客戶機作試驗,發現不行,那就換xp試試唄!而後我便用硬盤裏珍藏多年的xp professional鏡像安裝了一個xp虛擬機,興高采烈地配置好Armitage,一攻擊發現仍是不行!!最後問了不少大佬才知道用英文版的xp能夠成功,但這我仍是攻擊了好幾回的結果……而「永恆之藍」的攻擊更是連xp都不行而只能用PKI的win7虛擬機才能完成……總的來講,漏洞攻擊因「機」而異,尋找漏洞更是徹底取決於Hacker的眼力和本領。網絡攻防其實就是「找漏洞」和「堵漏洞」之間的較量,而所謂「道高一尺魔高一丈」,漏洞攻擊更具備先手優點。現在,在安全技術已經比較成熟的幾大主流操做系統又在各類知名殺軟的保護加持之下,每每被用戶認爲相對「安全」,但一個新漏洞的發現每每能引發軒然大波,拿到「黑市」中去賣能一晚上暴富;更有甚者如去年不法分子利用NSA武器庫泄漏的危險漏洞「永恆之藍」製做出一款蠕蟲式勒索病毒軟件WannaCry並藉助網絡大範圍傳播,鎖定被感染用戶的系統、加密所有數據並向直接其索取高額比特幣,致使一場全球性互聯網災難!
給咱們的啓示在於,打補丁的方式雖然能夠防範漏洞攻擊,但這畢竟是被動的,是在攻擊發生以後採起的行爲。首先從源頭上來講,操做系統研發者就不該該讓這些攻擊成爲可能,但無奈地球上畢竟不存在完美的程序猿,寫代碼時不免會產生bug。從安全人員的角度來看,要保護一個系統,必須主動一點,像Hacker那樣並搶在Hacker以前對當前系統可能存在的全部漏洞進行檢測,把漏洞堵起來,不安全的因素找出來,各類安全屏障立起來,讓Hacker無機可乘!
最後仍是要感謝一下一路陪我走來的Mac,他的性能足夠強勁以致於讓我能同時開3個虛擬機作滲透測試(>_<)辛苦啦(>_<)