Module: Msf::Exploit::Remote::Kerberos::Client::ApRequest

Included in:
Msf::Exploit::Remote::Kerberos::Client
Defined in:
lib/msf/core/exploit/remote/kerberos/client/ap_request.rb

Overview

Helpers for constructing and wrapping Kerberos AP-REQ messages.

Constant Summary collapse

AP_USE_SESSION_KEY =
0x40000000
AP_MUTUAL_REQUIRED =
0x20000000

Instance Method Summary collapse

Instance Method Details

#build_service_ap_request(opts = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/msf/core/exploit/remote/kerberos/client/ap_request.rb', line 16

def build_service_ap_request(opts = {})
  authenticator = opts.fetch(:authenticator) do
    build_authenticator(opts.merge(
      subkey: nil,
      authenticator_enc_key_usage: Rex::Proto::Kerberos::Crypto::KeyUsage::AP_REQ_AUTHENTICATOR
    ))
  end

  ap_req_options = 0
  ap_req_options |= AP_MUTUAL_REQUIRED if mutual_auth

  ap_req = opts.fetch(:ap_req) do
    build_ap_req(opts.merge(authenticator: authenticator, ap_req_options: ap_req_options))
  end

  ap_req
end

#encode_gss_kerberos_ap_request(ap_request_asn1, ap_request_der: nil) ⇒ String

Returns a GSS-Kerberos token.

Parameters:

  • ap_request_asn1 (OpenSSL::ASN1::ASN1Data)

    the ASN.1 AP-REQ

  • ap_request_der (String, nil) (defaults to: nil)

    a pre-encoded AP-REQ

Returns:

  • (String)

    a GSS-Kerberos token

See Also:



38
39
40
41
42
# File 'lib/msf/core/exploit/remote/kerberos/client/ap_request.rb', line 38

def encode_gss_kerberos_ap_request(ap_request_asn1, ap_request_der: nil)
  Rex::Proto::Gss::KerberosToken.build_gss_ap_req(
    ap_request_der || ap_request_asn1.to_der
  )
end

#encode_gss_spnego_ap_request(ap_request_asn1, ap_request_mech: nil) ⇒ String

Returns a SPNEGO GSS blob.

Parameters:

  • ap_request_asn1 (OpenSSL::ASN1::ASN1Data)

    the ASN.1 KRB_AP_REQ defined in RFC 1964 section 1.1.1

  • ap_request_mech (String, nil) (defaults to: nil)

    a pre-encoded GSS-Kerberos AP-REQ token

Returns:

  • (String)

    a SPNEGO GSS blob

See Also:



48
49
50
51
# File 'lib/msf/core/exploit/remote/kerberos/client/ap_request.rb', line 48

def encode_gss_spnego_ap_request(ap_request_asn1, ap_request_mech: nil)
  ap_request_mech ||= encode_gss_kerberos_ap_request(ap_request_asn1)
  Rex::Proto::Gss::KerberosToken.build_spnego_init(ap_request_mech)
end