diff --git a/lib/rex/proto/kerberos/model.rb b/lib/rex/proto/kerberos/model.rb index bbdbb57eef..f0c2261793 100644 --- a/lib/rex/proto/kerberos/model.rb +++ b/lib/rex/proto/kerberos/model.rb @@ -17,6 +17,57 @@ module Rex AUTHENTICATOR = 2 AP_REQ = 14 + # Kerberos error codes + ERROR_CODES = { + 0 => ['KDC_ERR_NONE', 'No error'], + 1 => ['KDC_ERR_NAME_EXP', 'Client\'s entry in database has expired'], + 2 => ['KDC_ERR_SERVICE_EXP', 'Server\'s entry in database has expired'], + 3 => ['KDC_ERR_BAD_PVNO', 'Requested protocol version number not supported'], + 4 => ['KDC_ERR_C_OLD_MAST_KVNO', 'Client\'s key encrypted in old master key'], + 5 => ['KDC_ERR_S_OLD_MAST_KVNO', 'Server\'s key encrypted in old master key'], + 6 => ['KDC_ERR_C_PRINCIPAL_UNKNOWN', 'Client not found in Kerberos database'], + 7 => ['KDC_ERR_S_PRINCIPAL_UNKNOWN', 'Server not found in Kerberos database'], + 8 => ['KDC_ERR_PRINCIPAL_NOT_UNIQUE', 'Multiple principal entries in database'], + 9 => ['KDC_ERR_NULL_KEY', 'The client or server has a null key'], + 10 => ['KDC_ERR_CANNOT_POSTDATE', 'Ticket not eligible for postdating'], + 11 => ['KDC_ERR_NEVER_VALID', 'Requested start time is later than end time'], + 12 => ['KDC_ERR_POLICY', 'KDC policy rejects request'], + 13 => ['KDC_ERR_BADOPTION', 'KDC cannot accommodate requested option'], + 14 => ['KDC_ERR_ETYPE_NOSUPP', 'KDC has no support for encryption type'], + 15 => ['KDC_ERR_SUMTYPE_NOSUPP', 'KDC has no support for checksum type'], + 16 => ['KDC_ERR_PADATA_TYPE_NOSUPP', 'KDC has no support for padata type'], + 17 => ['KDC_ERR_TRTYPE_NOSUPP', 'KDC has no support for transited type'], + 18 => ['KDC_ERR_CLIENT_REVOKED', 'Clients credentials have been revoked'], + 19 => ['KDC_ERR_SERVICE_REVOKED', 'Credentials for server have been revoked'], + 20 => ['KDC_ERR_TGT_REVOKED', 'TGT has been revoked'], + 21 => ['KDC_ERR_CLIENT_NOTYET', 'Client not yet valid - try again later'], + 22 => ['KDC_ERR_SERVICE_NOTYET', 'Server not yet valid - try again later'], + 23 => ['KDC_ERR_KEY_EXPIRED', 'Password has expired - change password to reset'], + 24 => ['KDC_ERR_PREAUTH_FAILED', 'Pre-authentication information was invalid'], + 25 => ['KDC_ERR_PREAUTH_REQUIRED', 'Additional pre-authentication required'], + 31 => ['KRB_AP_ERR_BAD_INTEGRITY', 'Integrity check on decrypted field failed'], + 32 => ['KRB_AP_ERR_TKT_EXPIRED', 'Ticket expired'], + 33 => ['KRB_AP_ERR_TKT_NYV', 'Ticket not yet valid'], + 34 => ['KRB_AP_ERR_REPEAT', 'Request is a replay'], + 35 => ['KRB_AP_ERR_NOT_US', 'The ticket isn\'t for us'], + 36 => ['KRB_AP_ERR_BADMATCH', 'Ticket and authenticator don\'t match'], + 37 => ['KRB_AP_ERR_SKEW', 'Clock skew too great'], + 38 => ['KRB_AP_ERR_BADADDR', 'Incorrect net address'], + 39 => ['KRB_AP_ERR_BADVERSION', 'Protocol version mismatch'], + 40 => ['KRB_AP_ERR_MSG_TYPE', 'Invalid msg type'], + 41 => ['KRB_AP_ERR_MODIFIED', 'Message stream modified'], + 42 => ['KRB_AP_ERR_BADORDER', 'Message out of order'], + 44 => ['KRB_AP_ERR_BADKEYVER', 'Specified version of key is not available'], + 45 => ['KRB_AP_ERR_NOKEY', 'Service key not available'], + 46 => ['KRB_AP_ERR_MUT_FAIL', 'Mutual authentication failed'], + 47 => ['KRB_AP_ERR_BADDIRECTION', 'Incorrect message direction'], + 48 => ['KRB_AP_ERR_METHOD', 'Alternative authentication method required'], + 49 => ['KRB_AP_ERR_BADSEQ', 'Incorrect sequence number in message'], + 50 => ['KRB_AP_ERR_INAPP_CKSUM', 'Inappropriate type of checksum in message'], + 60 => ['KRB_ERR_GENERIC', 'Generic error'], + 61 => ['KRB_ERR_FIELD_TOOLONG', 'Field is too long for this implementation'] + } + KDC_OPTION_RESERVED = 0 KDC_OPTION_FORWARDABLE = 1 KDC_OPTION_FORWARDED = 2 diff --git a/modules/auxiliary/admin/kerberos/ms14_068_kerberos_checksum.rb b/modules/auxiliary/admin/kerberos/ms14_068_kerberos_checksum.rb index 5e5dc2344f..486b89cc5e 100644 --- a/modules/auxiliary/admin/kerberos/ms14_068_kerberos_checksum.rb +++ b/modules/auxiliary/admin/kerberos/ms14_068_kerberos_checksum.rb @@ -84,6 +84,7 @@ class Metasploit4 < Msf::Auxiliary ) unless res.msg_type == Rex::Proto::Kerberos::Model::AS_REP + vprint_warning("#{peer} - #{warn_error(res)}") if res.msg_type == Rex::Proto::Kerberos::Model::KRB_ERROR print_error("#{peer} - Invalid AS-REP, aborting...") return end @@ -132,6 +133,7 @@ class Metasploit4 < Msf::Auxiliary ) unless res.msg_type == Rex::Proto::Kerberos::Model::TGS_REP + vprint_warning("#{peer} - #{warn_error(res)}") if res.msg_type == Rex::Proto::Kerberos::Model::KRB_ERROR print_error("#{peer} - Invalid TGS-REP, aborting...") return end @@ -143,5 +145,18 @@ class Metasploit4 < Msf::Auxiliary path = store_loot('windows.kerberos', 'application/octet-stream', rhost, cache.encode) print_good("#{peer} - MIT Credential Cache saved on #{path}") end + + def warn_error(res) + msg = '' + + if Rex::Proto::Kerberos::Model::ERROR_CODES.has_key?(res.error_code) + error_info = Rex::Proto::Kerberos::Model::ERROR_CODES[res.error_code] + msg = "#{error_info[0]} - #{error_info[1]}" + else + msg = 'Unknown error' + end + + msg + end end