File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
lib/msf/core/exploit/remote Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -65,16 +65,32 @@ def connect_gkdi(opts = {})
6565 end
6666
6767 def bind_gkdi ( dcerpc_client )
68- dcerpc_client . connect
69- vprint_status ( 'Binding to GKDI...' )
68+ tower = gkdi_get_endpoints . first
69+ dcerpc_client . connect ( port : tower [ :port ] )
70+ vprint_status ( "Binding to GKDI via #{ tower [ :endpoint ] } ..." )
7071 dcerpc_client . bind (
71- endpoint : RubySMB ::Dcerpc ::Gkdi ,
7272 auth_level : RubySMB ::Dcerpc ::RPC_C_AUTHN_LEVEL_PKT_PRIVACY ,
7373 auth_type : RubySMB ::Dcerpc ::RPC_C_AUTHN_WINNT
7474 )
7575 vprint_status ( 'Bound to GKDI' )
7676 end
7777
78+ def gkdi_get_endpoints ( opts = { } )
79+ vprint_status ( 'Mapping GKDI endpoints...' )
80+ dcerpc_client = RubySMB ::Dcerpc ::Client . new (
81+ opts . fetch ( :rhost ) { rhost } ,
82+ RubySMB ::Dcerpc ::Epm
83+ )
84+ dcerpc_client . connect
85+ dcerpc_client . bind
86+ # This works around an odd error where if the target has just booted, then no towers (endpoint connection infos)
87+ # will be returned if max_towers is set to 1. Here we map it our self and set max_towers to a higher number to work
88+ # around the behavior. Subsequent mapping attempts will work with max_towers set to 1, but 4 will always work.
89+ towers = dcerpc_client . ept_map_endpoint ( RubySMB ::Dcerpc ::Gkdi , max_towers : 4 )
90+ dcerpc_client . close
91+ towers
92+ end
93+
7894 def gkdi_compute_kek ( gke , key_identifier )
7995 l2_key = gkdi_compute_l2_key ( gke , key_identifier )
8096
You can’t perform that action at this time.
0 commit comments