2002-07-09 20:49:27 +00:00
|
|
|
/* packet-ntlmssp.c
|
2009-10-06 14:20:59 +00:00
|
|
|
* Add-on for better NTLM v1/v2 handling
|
2009-10-06 09:13:57 +00:00
|
|
|
* Copyright 2009 Matthieu Patou <matthieu.patou@matws.net>
|
2002-07-09 20:49:27 +00:00
|
|
|
* Routines for NTLM Secure Service Provider
|
|
|
|
* Devin Heitmueller <dheitmueller@netilla.com>
|
2003-07-16 04:20:33 +00:00
|
|
|
* Copyright 2003, Tim Potter <tpot@samba.org>
|
2002-07-09 20:49:27 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2002-07-09 20:49:27 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2002-07-09 20:49:27 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2002-07-09 20:49:27 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2002-07-09 20:49:27 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2002-07-09 20:49:27 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2009-10-06 09:13:57 +00:00
|
|
|
#ifdef DEBUG_NTLMSSP
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
2004-08-02 23:40:09 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
2004-08-03 02:28:49 +00:00
|
|
|
#include "packet-windows-common.h"
|
2002-08-10 21:15:37 +00:00
|
|
|
#include "packet-smb-common.h"
|
2002-08-31 20:25:43 +00:00
|
|
|
#include "packet-frame.h"
|
2009-10-06 09:13:57 +00:00
|
|
|
#include <epan/asn1.h>
|
|
|
|
#include "packet-kerberos.h"
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2005-08-13 01:29:31 +00:00
|
|
|
#include <epan/emem.h>
|
2005-12-07 13:09:42 +00:00
|
|
|
#include <epan/tap.h>
|
2009-11-16 17:08:12 +00:00
|
|
|
#include <epan/expert.h>
|
2007-01-09 22:14:07 +00:00
|
|
|
#include <epan/crypt/crypt-rc4.h>
|
|
|
|
#include <epan/crypt/crypt-md4.h>
|
2009-10-06 09:13:57 +00:00
|
|
|
#include <epan/crypt/crypt-md5.h>
|
2007-01-09 22:14:07 +00:00
|
|
|
#include <epan/crypt/crypt-des.h>
|
2003-07-16 04:20:33 +00:00
|
|
|
#include "packet-dcerpc.h"
|
2005-03-10 10:16:49 +00:00
|
|
|
#include "packet-gssapi.h"
|
2011-08-31 09:00:54 +00:00
|
|
|
#include <wsutil/crc32.h>
|
2002-08-10 21:15:37 +00:00
|
|
|
|
2004-08-02 23:14:32 +00:00
|
|
|
#include "packet-ntlmssp.h"
|
|
|
|
|
2005-12-07 13:09:42 +00:00
|
|
|
static int ntlmssp_tap = -1;
|
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
/* Message types */
|
|
|
|
|
|
|
|
#define NTLMSSP_NEGOTIATE 1
|
|
|
|
#define NTLMSSP_CHALLENGE 2
|
|
|
|
#define NTLMSSP_AUTH 3
|
|
|
|
#define NTLMSSP_UNKNOWN 4
|
2009-10-06 09:13:57 +00:00
|
|
|
#define CLIENT_SIGN_TEXT "session key to client-to-server signing key magic constant"
|
|
|
|
#define CLIENT_SEAL_TEXT "session key to client-to-server sealing key magic constant"
|
|
|
|
#define SERVER_SIGN_TEXT "session key to server-to-client signing key magic constant"
|
|
|
|
#define SERVER_SEAL_TEXT "session key to server-to-client sealing key magic constant"
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
#define NTLMSSP_KEY_LEN 16
|
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
static const value_string ntlmssp_message_types[] = {
|
|
|
|
{ NTLMSSP_NEGOTIATE, "NTLMSSP_NEGOTIATE" },
|
|
|
|
{ NTLMSSP_CHALLENGE, "NTLMSSP_CHALLENGE" },
|
2010-10-03 18:23:46 +00:00
|
|
|
{ NTLMSSP_AUTH, "NTLMSSP_AUTH" },
|
|
|
|
{ NTLMSSP_UNKNOWN, "NTLMSSP_UNKNOWN" },
|
2002-08-10 23:16:37 +00:00
|
|
|
{ 0, NULL }
|
2002-07-09 20:49:27 +00:00
|
|
|
};
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
typedef struct _md4_pass {
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 md4[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
} md4_pass;
|
|
|
|
|
2010-01-19 00:37:39 +00:00
|
|
|
static unsigned char gbl_zeros[24] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
2009-10-06 09:13:57 +00:00
|
|
|
static GHashTable* hash_packet = NULL;
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
/*
|
|
|
|
* NTLMSSP negotiation flags
|
2002-07-09 20:49:27 +00:00
|
|
|
* Taken from Samba
|
2004-08-02 19:33:49 +00:00
|
|
|
*
|
|
|
|
* See also
|
|
|
|
*
|
2010-10-03 18:51:38 +00:00
|
|
|
* http://davenport.sourceforge.net/ntlm.html
|
2004-08-02 19:33:49 +00:00
|
|
|
*
|
|
|
|
* although that document says that:
|
|
|
|
*
|
2010-10-03 18:51:38 +00:00
|
|
|
* 0x00010000 is "Target Type Domain";
|
|
|
|
* 0x00020000 is "Target Type Server"
|
|
|
|
* 0x00040000 is "Target Type Share";
|
2004-08-02 19:33:49 +00:00
|
|
|
*
|
|
|
|
* and that 0x00100000, 0x00200000, and 0x00400000 are
|
|
|
|
* "Request Init Response", "Request Accept Response", and
|
|
|
|
* "Request Non-NT Session Key", rather than those values shifted
|
|
|
|
* right one having those interpretations.
|
2008-04-23 20:28:30 +00:00
|
|
|
*
|
2009-10-06 14:20:59 +00:00
|
|
|
* UPDATE: Further information obtained from [MS-NLMP]:
|
2008-04-23 20:28:30 +00:00
|
|
|
* NT LAN Manager (NTLM) Authentication Protocol Specification
|
|
|
|
* http://msdn2.microsoft.com/en-us/library/cc236621.aspx
|
|
|
|
*
|
2002-07-09 20:49:27 +00:00
|
|
|
*/
|
2010-10-03 19:43:14 +00:00
|
|
|
#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001
|
|
|
|
#define NTLMSSP_NEGOTIATE_OEM 0x00000002
|
|
|
|
#define NTLMSSP_REQUEST_TARGET 0x00000004
|
|
|
|
#define NTLMSSP_NEGOTIATE_00000008 0x00000008
|
|
|
|
#define NTLMSSP_NEGOTIATE_SIGN 0x00000010
|
|
|
|
#define NTLMSSP_NEGOTIATE_SEAL 0x00000020
|
|
|
|
#define NTLMSSP_NEGOTIATE_DATAGRAM 0x00000040
|
|
|
|
#define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080
|
|
|
|
#define NTLMSSP_NEGOTIATE_00000100 0x00000100
|
|
|
|
#define NTLMSSP_NEGOTIATE_NTLM 0x00000200
|
|
|
|
#define NTLMSSP_NEGOTIATE_NT_ONLY 0x00000400
|
|
|
|
#define NTLMSSP_NEGOTIATE_00000800 0x00000800
|
|
|
|
#define NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED 0x00001000
|
2008-04-23 20:28:30 +00:00
|
|
|
#define NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED 0x00002000
|
2010-10-03 19:43:14 +00:00
|
|
|
#define NTLMSSP_NEGOTIATE_00004000 0x00004000
|
|
|
|
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000
|
|
|
|
#define NTLMSSP_TARGET_TYPE_DOMAIN 0x00010000
|
|
|
|
#define NTLMSSP_TARGET_TYPE_SERVER 0x00020000
|
|
|
|
#define NTLMSSP_TARGET_TYPE_SHARE 0x00040000
|
|
|
|
#define NTLMSSP_NEGOTIATE_EXTENDED_SECURITY 0x00080000
|
|
|
|
#define NTLMSSP_NEGOTIATE_IDENTIFY 0x00100000
|
|
|
|
#define NTLMSSP_NEGOTIATE_00200000 0x00200000
|
|
|
|
#define NTLMSSP_REQUEST_NON_NT_SESSION 0x00400000
|
|
|
|
#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x00800000
|
|
|
|
#define NTLMSSP_NEGOTIATE_01000000 0x01000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_VERSION 0x02000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_04000000 0x04000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_08000000 0x08000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_10000000 0x10000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_128 0x20000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_KEY_EXCH 0x40000000
|
|
|
|
#define NTLMSSP_NEGOTIATE_56 0x80000000
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
static int proto_ntlmssp = -1;
|
|
|
|
static int hf_ntlmssp_auth = -1;
|
|
|
|
static int hf_ntlmssp_message_type = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_01 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_02 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_04 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_08 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_10 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_20 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_40 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_80 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_100 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_200 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_400 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_800 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_1000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_2000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_4000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_8000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_10000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_20000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_40000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_80000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_100000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_200000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_400000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_800000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_1000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_2000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_4000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_8000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_10000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_20000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_40000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_flags_80000000 = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_workstation_strlen = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_workstation_maxlen = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_workstation_buffer = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_workstation = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_domain_strlen = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_domain_maxlen = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_domain_buffer = -1;
|
|
|
|
static int hf_ntlmssp_negotiate_domain = -1;
|
2009-10-06 09:13:57 +00:00
|
|
|
static int hf_ntlmssp_ntlm_server_challenge = -1;
|
|
|
|
static int hf_ntlmssp_ntlm_client_challenge = -1;
|
2002-07-09 20:49:27 +00:00
|
|
|
static int hf_ntlmssp_reserved = -1;
|
2010-09-28 14:14:12 +00:00
|
|
|
static int hf_ntlmssp_challenge_target_name = -1;
|
2002-08-10 21:15:37 +00:00
|
|
|
static int hf_ntlmssp_auth_username = -1;
|
|
|
|
static int hf_ntlmssp_auth_domain = -1;
|
|
|
|
static int hf_ntlmssp_auth_hostname = -1;
|
|
|
|
static int hf_ntlmssp_auth_lmresponse = -1;
|
|
|
|
static int hf_ntlmssp_auth_ntresponse = -1;
|
2002-09-10 23:44:17 +00:00
|
|
|
static int hf_ntlmssp_auth_sesskey = -1;
|
|
|
|
static int hf_ntlmssp_string_len = -1;
|
|
|
|
static int hf_ntlmssp_string_maxlen = -1;
|
|
|
|
static int hf_ntlmssp_string_offset = -1;
|
|
|
|
static int hf_ntlmssp_blob_len = -1;
|
|
|
|
static int hf_ntlmssp_blob_maxlen = -1;
|
|
|
|
static int hf_ntlmssp_blob_offset = -1;
|
2010-10-03 18:23:46 +00:00
|
|
|
static int hf_ntlmssp_version = -1;
|
2010-09-28 14:14:12 +00:00
|
|
|
static int hf_ntlmssp_version_major = -1;
|
|
|
|
static int hf_ntlmssp_version_minor = -1;
|
|
|
|
static int hf_ntlmssp_version_build_number = -1;
|
|
|
|
static int hf_ntlmssp_version_ntlm_current_revision = -1;
|
2010-10-03 18:23:46 +00:00
|
|
|
|
|
|
|
static int hf_ntlmssp_challenge_target_info = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_len = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_maxlen = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_offset = -1;
|
|
|
|
|
|
|
|
static int hf_ntlmssp_challenge_target_info_item_type = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_item_len = -1;
|
|
|
|
|
|
|
|
static int hf_ntlmssp_challenge_target_info_end = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_nb_computer_name = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_nb_domain_name = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_dns_computer_name = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_dns_domain_name = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_dns_tree_name = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_flags = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_timestamp = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_restrictions = -1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_target_name =-1;
|
|
|
|
static int hf_ntlmssp_challenge_target_info_channel_bindings =-1;
|
|
|
|
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_item_type = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_item_len = -1;
|
|
|
|
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_end = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_nb_computer_name = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_nb_domain_name = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_dns_computer_name = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_dns_domain_name = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_dns_tree_name = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_flags = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_timestamp = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_restrictions = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_target_name =-1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_channel_bindings =-1;
|
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
static int hf_ntlmssp_message_integrity_code = -1;
|
2002-12-31 08:05:29 +00:00
|
|
|
static int hf_ntlmssp_verf = -1;
|
2002-11-10 09:38:22 +00:00
|
|
|
static int hf_ntlmssp_verf_vers = -1;
|
|
|
|
static int hf_ntlmssp_verf_body = -1;
|
2009-10-06 09:13:57 +00:00
|
|
|
static int hf_ntlmssp_verf_randompad = -1;
|
|
|
|
static int hf_ntlmssp_verf_hmacmd5 = -1;
|
2002-12-31 08:05:29 +00:00
|
|
|
static int hf_ntlmssp_verf_crc32 = -1;
|
|
|
|
static int hf_ntlmssp_verf_sequence = -1;
|
|
|
|
static int hf_ntlmssp_decrypted_payload = -1;
|
2010-10-03 18:23:46 +00:00
|
|
|
|
2004-08-02 23:14:32 +00:00
|
|
|
static int hf_ntlmssp_ntlmv2_response = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_hmac = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_header = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_reserved = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_time = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_chal = -1;
|
|
|
|
static int hf_ntlmssp_ntlmv2_response_unknown = -1;
|
2002-09-10 23:44:17 +00:00
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
static gint ett_ntlmssp = -1;
|
|
|
|
static gint ett_ntlmssp_negotiate_flags = -1;
|
2002-09-10 23:44:17 +00:00
|
|
|
static gint ett_ntlmssp_string = -1;
|
|
|
|
static gint ett_ntlmssp_blob = -1;
|
2010-09-28 14:14:12 +00:00
|
|
|
static gint ett_ntlmssp_version = -1;
|
2010-10-03 18:23:46 +00:00
|
|
|
static gint ett_ntlmssp_challenge_target_info = -1;
|
|
|
|
static gint ett_ntlmssp_challenge_target_info_item = -1;
|
2004-08-02 23:14:32 +00:00
|
|
|
static gint ett_ntlmssp_ntlmv2_response = -1;
|
2010-10-03 18:23:46 +00:00
|
|
|
static gint ett_ntlmssp_ntlmv2_response_item = -1;
|
2002-09-10 23:44:17 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
/* Configuration variables */
|
2010-01-22 22:34:24 +00:00
|
|
|
const char *gbl_nt_password = NULL;
|
2002-12-31 08:05:29 +00:00
|
|
|
|
|
|
|
#define MAX_BLOB_SIZE 256
|
|
|
|
typedef struct _ntlmssp_blob {
|
|
|
|
guint16 length;
|
2007-01-09 22:14:07 +00:00
|
|
|
guint8 contents[MAX_BLOB_SIZE];
|
2002-12-31 08:05:29 +00:00
|
|
|
} ntlmssp_blob;
|
|
|
|
|
|
|
|
/* Used in the conversation function */
|
|
|
|
typedef struct _ntlmssp_info {
|
|
|
|
guint32 flags;
|
2009-10-06 09:13:57 +00:00
|
|
|
int is_auth_ntlm_v2;
|
|
|
|
rc4_state_struct rc4_state_client;
|
|
|
|
rc4_state_struct rc4_state_server;
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 sign_key_client[NTLMSSP_KEY_LEN];
|
|
|
|
guint8 sign_key_server[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
guint32 server_dest_port;
|
|
|
|
unsigned char server_challenge[8];
|
|
|
|
unsigned char client_challenge[8];
|
2002-12-31 08:05:29 +00:00
|
|
|
int rc4_state_initialized;
|
|
|
|
ntlmssp_blob ntlm_response;
|
|
|
|
ntlmssp_blob lm_response;
|
|
|
|
} ntlmssp_info;
|
|
|
|
|
|
|
|
/* If this struct exists in the payload_decrypt, then we have already
|
|
|
|
decrypted it once */
|
|
|
|
typedef struct _ntlmssp_packet_info {
|
2003-03-04 20:52:33 +00:00
|
|
|
guint8 *decrypted_payload;
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 payload_len;
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 verifier[NTLMSSP_KEY_LEN];
|
2002-12-31 08:05:29 +00:00
|
|
|
gboolean payload_decrypted;
|
|
|
|
gboolean verifier_decrypted;
|
|
|
|
} ntlmssp_packet_info;
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
#ifdef DEBUG_NTLMSSP
|
2010-06-09 18:12:17 +00:00
|
|
|
static void printnbyte(const guint8* tab,int nb,const char* txt,const char* txt2)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
fprintf(stderr,"%s ",txt);
|
|
|
|
for(i=0;i<nb;i++)
|
|
|
|
{
|
|
|
|
fprintf(stderr,"%02hhX ",*(tab+i));
|
|
|
|
}
|
|
|
|
fprintf(stderr,"%s",txt2);
|
|
|
|
}
|
2010-10-03 18:23:46 +00:00
|
|
|
#if 0
|
2010-10-03 19:43:14 +00:00
|
|
|
static void printnchar(const guint8* tab,int nb,char* txt,char* txt2)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
fprintf(stderr,"%s ",txt);
|
|
|
|
for(i=0;i<nb;i++)
|
|
|
|
{
|
|
|
|
fprintf(stderr,"%c",*(tab+i));
|
|
|
|
}
|
|
|
|
fprintf(stderr,"%s",txt2);
|
|
|
|
}
|
2010-10-03 18:23:46 +00:00
|
|
|
#endif
|
2009-10-06 09:13:57 +00:00
|
|
|
#else
|
2010-06-09 18:12:17 +00:00
|
|
|
static void printnbyte(const guint8* tab _U_,int nb _U_, const char* txt _U_,const char* txt2 _U_)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2003-03-04 20:52:33 +00:00
|
|
|
/*
|
|
|
|
* GSlist of decrypted payloads.
|
|
|
|
*/
|
|
|
|
static GSList *decrypted_payloads;
|
|
|
|
|
2010-10-03 19:49:15 +00:00
|
|
|
#if 0
|
2010-10-03 19:43:14 +00:00
|
|
|
static int
|
|
|
|
LEBE_Convert(int value)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
char a,b,c,d;
|
|
|
|
/* Get each byte */
|
|
|
|
a=value&0x000000FF;
|
|
|
|
b=(value&0x0000FF00) >> 8;
|
|
|
|
c=(value&0x00FF0000) >> 16;
|
|
|
|
d=(value&0xFF000000) >> 24;
|
|
|
|
return (a << 24) | (b << 16) | (c << 8) | d;
|
|
|
|
}
|
2010-10-03 19:49:15 +00:00
|
|
|
#endif
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/*
|
|
|
|
Perform a DES encryption with a 16 bit key and 8bit data item.
|
|
|
|
It's in fact 3 susbsequent call to crypt_des_ecb with a 7 bit key.
|
|
|
|
Missing bits for the key are replaced by 0;
|
|
|
|
Returns output in response, which is expected to be 24 bytes.
|
|
|
|
*/
|
2010-10-03 19:43:14 +00:00
|
|
|
static int
|
|
|
|
crypt_des_ecb_long(guint8 *response,
|
|
|
|
const guint8 *key,
|
|
|
|
const guint8 *data)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
guint8 pw21[21]; /* 21 bytes place for the needed key */
|
|
|
|
|
|
|
|
memset(pw21, 0, sizeof(pw21));
|
|
|
|
memcpy(pw21, key, 16);
|
|
|
|
|
|
|
|
memset(response, 0, 24);
|
|
|
|
/* crypt_des_ecb(data,key)*/
|
|
|
|
crypt_des_ecb(response, data, pw21, 1);
|
|
|
|
crypt_des_ecb(response + 8, data, pw21 + 7, 1);
|
|
|
|
crypt_des_ecb(response + 16, data, pw21 + 14, 1);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
/*
|
|
|
|
Generate a challenge response, given an eight byte challenge and
|
|
|
|
either the NT or the Lan Manager password hash (16 bytes).
|
|
|
|
Returns output in response, which is expected to be 24 bytes.
|
|
|
|
*/
|
2010-10-03 19:43:14 +00:00
|
|
|
static int
|
|
|
|
ntlmssp_generate_challenge_response(guint8 *response,
|
|
|
|
const guint8 *passhash,
|
|
|
|
const guint8 *challenge)
|
2002-12-31 08:05:29 +00:00
|
|
|
{
|
|
|
|
guint8 pw21[21]; /* Password hash padded to 21 bytes */
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
memset(pw21, 0x0, sizeof(pw21));
|
|
|
|
memcpy(pw21, passhash, 16);
|
|
|
|
|
|
|
|
memset(response, 0, 24);
|
|
|
|
|
|
|
|
crypt_des_ecb(response, challenge, pw21, 1);
|
|
|
|
crypt_des_ecb(response + 8, challenge, pw21 + 7, 1);
|
|
|
|
crypt_des_ecb(response + 16, challenge, pw21 + 14, 1);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
|
|
|
|
/* Ultra simple ainsi to unicode converter, will only work for ascii password ...*/
|
2010-10-03 19:43:14 +00:00
|
|
|
static void
|
|
|
|
str_to_unicode(const char *nt_password, char *nt_password_unicode)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
2009-10-07 22:36:33 +00:00
|
|
|
size_t password_len = 0;
|
|
|
|
size_t i;
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
password_len = strlen(nt_password);
|
|
|
|
if(nt_password_unicode != NULL)
|
|
|
|
{
|
|
|
|
for(i=0;i<(password_len);i++)
|
|
|
|
{
|
|
|
|
nt_password_unicode[i*2]=nt_password[i];
|
|
|
|
nt_password_unicode[i*2+1]=0;
|
|
|
|
}
|
2009-10-06 19:21:29 +00:00
|
|
|
nt_password_unicode[2*password_len]='\0';
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-06 14:20:59 +00:00
|
|
|
/* This function generate the Key Exchange Key
|
2009-10-06 09:13:57 +00:00
|
|
|
* Depending on the flags this key will either be used to crypt the exported session key
|
|
|
|
* or will be used directly as exported session key.
|
|
|
|
* Exported session key is the key that will be used for sealing and signing communication*/
|
|
|
|
|
2009-10-06 14:20:59 +00:00
|
|
|
static void
|
2009-11-16 17:08:12 +00:00
|
|
|
get_keyexchange_key(unsigned char keyexchangekey[NTLMSSP_KEY_LEN],const unsigned char sessionbasekey[NTLMSSP_KEY_LEN],const unsigned char lm_challenge_response[24],int flags)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 basekey[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 zeros[24];
|
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
memset(keyexchangekey,0,NTLMSSP_KEY_LEN);
|
|
|
|
memset(basekey,0,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
/* sessionbasekey is either derived from lm_password_hash or from nt_password_hash depending on the key type negotiated */
|
|
|
|
memcpy(basekey,sessionbasekey,8);
|
|
|
|
memset(basekey,0xBD,8);
|
|
|
|
if(flags&NTLMSSP_NEGOTIATE_LM_KEY)
|
|
|
|
{
|
|
|
|
/*data,key*/
|
|
|
|
crypt_des_ecb(keyexchangekey,lm_challenge_response,basekey,1);
|
|
|
|
crypt_des_ecb(keyexchangekey+8,lm_challenge_response,basekey+7,1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(flags&NTLMSSP_REQUEST_NON_NT_SESSION)
|
|
|
|
{
|
2009-10-06 14:20:59 +00:00
|
|
|
/*People from samba tends to use the same function in this case than in the previous one but with 0 data
|
|
|
|
* it's not clear that it produce the good result
|
2009-10-06 09:13:57 +00:00
|
|
|
* memcpy(keyexchangekey,lm_hash,8);
|
|
|
|
* Let's trust samba implementation it mights seem weird but they are more often rights than the spec !
|
|
|
|
*/
|
2009-10-06 14:20:59 +00:00
|
|
|
memset(zeros,0,24);
|
2009-10-06 09:13:57 +00:00
|
|
|
crypt_des_ecb(keyexchangekey,zeros,basekey,3);
|
|
|
|
crypt_des_ecb(keyexchangekey+8,zeros,basekey+7,1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-06 14:20:59 +00:00
|
|
|
/* it is stated page 65 of NTLM SSP spec that sessionbasekey should be encrypted with hmac_md5 using the concact of both challenge
|
2009-10-06 09:13:57 +00:00
|
|
|
* when it's NTLM v1 + extended security but it turns out to be wrong !
|
|
|
|
*/
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(keyexchangekey,sessionbasekey,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2009-10-07 21:00:14 +00:00
|
|
|
#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
|
2009-10-06 09:13:57 +00:00
|
|
|
static guint32
|
2009-10-14 07:22:40 +00:00
|
|
|
get_md4pass_list(md4_pass** p_pass_list,const char* nt_password)
|
|
|
|
{
|
2010-05-13 18:28:34 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
guint32 nb_pass = 0;
|
|
|
|
enc_key_t *ek;
|
|
|
|
unsigned char nt_password_hash[NTLMSSP_KEY_LEN];
|
|
|
|
int password_len = 0;
|
|
|
|
char nt_password_unicode[256];
|
|
|
|
md4_pass* pass_list;
|
|
|
|
int i = 0;
|
|
|
|
if(!krb_decrypt){
|
|
|
|
pass_list=NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
read_keytab_file_from_preferences();
|
|
|
|
|
|
|
|
for(ek=enc_key_list;ek;ek=ek->next){
|
|
|
|
if( ek->keylength == NTLMSSP_KEY_LEN ) {
|
|
|
|
nb_pass++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memset(nt_password_hash,0,NTLMSSP_KEY_LEN);
|
|
|
|
if (nt_password[0] != '\0' && ( strlen(nt_password) < 129 )) {
|
|
|
|
nb_pass++;
|
|
|
|
password_len = strlen(nt_password);
|
|
|
|
str_to_unicode(nt_password,nt_password_unicode);
|
|
|
|
crypt_md4(nt_password_hash,nt_password_unicode,password_len*2);
|
|
|
|
}
|
|
|
|
if( nb_pass == 0 ) {
|
|
|
|
/* Unable to calculate the session key without a password or if password is more than 128 char ......*/
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
i = 0;
|
|
|
|
*p_pass_list = ep_alloc(nb_pass*sizeof(md4_pass));
|
|
|
|
pass_list=*p_pass_list;
|
|
|
|
|
|
|
|
if( memcmp(nt_password_hash,gbl_zeros,NTLMSSP_KEY_LEN) != 0 ) {
|
|
|
|
memcpy(pass_list[i].md4,nt_password_hash,NTLMSSP_KEY_LEN);
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
for(ek=enc_key_list;ek;ek=ek->next){
|
|
|
|
if( ek->keylength == NTLMSSP_KEY_LEN ) {
|
|
|
|
memcpy(pass_list[i].md4,ek->keyvalue,NTLMSSP_KEY_LEN);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nb_pass;
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
2009-10-07 21:00:14 +00:00
|
|
|
#endif
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
/* Create an NTLMSSP version 2 key
|
2009-10-06 09:13:57 +00:00
|
|
|
*/
|
|
|
|
static void
|
2009-10-07 21:00:14 +00:00
|
|
|
create_ntlmssp_v2_key(const char *nt_password _U_, const guint8 *serverchallenge , const guint8 *clientchallenge ,
|
2010-10-03 18:51:38 +00:00
|
|
|
guint8 *sessionkey ,const guint8 *encryptedsessionkey , int flags ,
|
2011-03-22 12:12:04 +00:00
|
|
|
const ntlmssp_blob *ntlm_response, const ntlmssp_blob *lm_response _U_, ntlmssp_header_t *ntlmssph )
|
2010-10-03 19:43:14 +00:00
|
|
|
{
|
2009-10-06 09:13:57 +00:00
|
|
|
char domain_name_unicode[256];
|
|
|
|
char user_uppercase[256];
|
|
|
|
char buf[512];
|
2009-11-16 17:08:12 +00:00
|
|
|
/*guint8 md4[NTLMSSP_KEY_LEN];*/
|
|
|
|
unsigned char nt_password_hash[NTLMSSP_KEY_LEN];
|
|
|
|
unsigned char nt_proof[NTLMSSP_KEY_LEN];
|
|
|
|
unsigned char ntowf[NTLMSSP_KEY_LEN];
|
|
|
|
guint8 sessionbasekey[NTLMSSP_KEY_LEN];
|
|
|
|
guint8 keyexchangekey[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 lm_challenge_response[24];
|
|
|
|
guint32 i;
|
|
|
|
guint32 j;
|
|
|
|
rc4_state_struct rc4state;
|
2009-10-07 22:36:33 +00:00
|
|
|
size_t user_len;
|
|
|
|
size_t domain_len;
|
2009-10-07 21:00:14 +00:00
|
|
|
md4_pass *pass_list = NULL;
|
2009-10-06 09:13:57 +00:00
|
|
|
guint32 nb_pass = 0;
|
|
|
|
int found = 0;
|
|
|
|
|
2009-10-06 14:20:59 +00:00
|
|
|
/* We are going to try password encrypted in keytab as well, it's an idean of Stefan Metzmacher <metze@samba.org>
|
2009-10-06 09:13:57 +00:00
|
|
|
* The idea is to be able to test all the key of domain in once and to be able to decode the NTLM dialogs */
|
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
memset(sessionkey, 0, NTLMSSP_KEY_LEN);
|
2009-10-07 21:00:14 +00:00
|
|
|
#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
|
2009-10-06 09:13:57 +00:00
|
|
|
nb_pass = get_md4pass_list(&pass_list,nt_password);
|
2009-10-07 21:00:14 +00:00
|
|
|
#endif
|
2009-10-06 09:13:57 +00:00
|
|
|
i=0;
|
|
|
|
memset(user_uppercase,0,256);
|
|
|
|
user_len = strlen(ntlmssph->acct_name);
|
|
|
|
if( user_len < 129 ) {
|
2010-10-03 18:51:38 +00:00
|
|
|
memset(buf,0,512);
|
|
|
|
str_to_unicode(ntlmssph->acct_name,buf);
|
|
|
|
for (j = 0; j < (2*user_len); j++) {
|
|
|
|
if( buf[j] != '\0' ) {
|
|
|
|
user_uppercase[j] = toupper(buf[j]);
|
|
|
|
}
|
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-10-03 18:51:38 +00:00
|
|
|
/* Unable to calculate the session not enought space in buffer, note this is unlikely to happen but ......*/
|
|
|
|
return;
|
2009-10-06 14:20:59 +00:00
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
domain_len = strlen(ntlmssph->domain_name);
|
|
|
|
if( domain_len < 129 ) {
|
|
|
|
str_to_unicode(ntlmssph->domain_name,domain_name_unicode);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Unable to calculate the session not enought space in buffer, note this is unlikely to happen but ......*/
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
while (i < nb_pass ) {
|
|
|
|
/*fprintf(stderr,"Turn %d, ",i);*/
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(nt_password_hash,pass_list[i].md4,NTLMSSP_KEY_LEN);
|
|
|
|
/*printnbyte(nt_password_hash,NTLMSSP_KEY_LEN,"Current NT password hash: ","\n");*/
|
2009-10-06 09:13:57 +00:00
|
|
|
i++;
|
2009-10-06 14:20:59 +00:00
|
|
|
/* ntowf computation */
|
2009-10-06 09:13:57 +00:00
|
|
|
memset(buf,0,512);
|
|
|
|
memcpy(buf,user_uppercase,user_len*2);
|
|
|
|
memcpy(buf+user_len*2,domain_name_unicode,domain_len*2);
|
2009-11-16 17:08:12 +00:00
|
|
|
md5_hmac(buf,domain_len*2+user_len*2,nt_password_hash,NTLMSSP_KEY_LEN,ntowf);
|
2009-10-06 09:13:57 +00:00
|
|
|
/* LM response */
|
|
|
|
memset(buf,0,512);
|
|
|
|
memcpy(buf,serverchallenge,8);
|
|
|
|
memcpy(buf+8,clientchallenge,8);
|
2009-11-16 17:08:12 +00:00
|
|
|
md5_hmac(buf,NTLMSSP_KEY_LEN,ntowf,NTLMSSP_KEY_LEN,lm_challenge_response);
|
|
|
|
memcpy(lm_challenge_response+NTLMSSP_KEY_LEN,clientchallenge,8);
|
2009-10-06 09:13:57 +00:00
|
|
|
printnbyte(lm_challenge_response,24,"LM Response: ","\n");
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
/* NT proof = First NTLMSSP_KEY_LEN bytes of NT response */
|
2009-10-06 09:13:57 +00:00
|
|
|
memset(buf,0,512);
|
|
|
|
memcpy(buf,serverchallenge,8);
|
2011-03-22 12:12:04 +00:00
|
|
|
memcpy(buf+8,ntlm_response->contents+NTLMSSP_KEY_LEN,ntlm_response->length-NTLMSSP_KEY_LEN);
|
|
|
|
md5_hmac(buf,ntlm_response->length-8,ntowf,NTLMSSP_KEY_LEN,nt_proof);
|
2009-11-16 17:08:12 +00:00
|
|
|
printnbyte(nt_proof,NTLMSSP_KEY_LEN,"NT proof: ","\n");
|
2011-03-22 12:12:04 +00:00
|
|
|
if( !memcmp(nt_proof,ntlm_response->contents,NTLMSSP_KEY_LEN) ) {
|
2009-10-06 09:13:57 +00:00
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if( found == 0 ) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
md5_hmac(nt_proof,NTLMSSP_KEY_LEN,ntowf,NTLMSSP_KEY_LEN,sessionbasekey);
|
2009-10-06 09:13:57 +00:00
|
|
|
get_keyexchange_key(keyexchangekey,sessionbasekey,lm_challenge_response,flags);
|
2009-10-06 14:20:59 +00:00
|
|
|
/* now decrypt session key if needed and setup sessionkey for decrypting further communications */
|
2009-10-06 09:13:57 +00:00
|
|
|
if (flags & NTLMSSP_NEGOTIATE_KEY_EXCH)
|
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(sessionkey,encryptedsessionkey,NTLMSSP_KEY_LEN);
|
|
|
|
crypt_rc4_init(&rc4state,keyexchangekey,NTLMSSP_KEY_LEN);
|
|
|
|
crypt_rc4(&rc4state,sessionkey,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(sessionkey,keyexchangekey,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
/* Create an NTLMSSP version 1 key
|
2009-10-06 09:13:57 +00:00
|
|
|
* That is more complicated logic and methods and user challenge as well.
|
2002-12-31 08:05:29 +00:00
|
|
|
* password points to the ANSI password to encrypt, challenge points to
|
2009-10-06 09:13:57 +00:00
|
|
|
* the 8 octet challenge string
|
2002-12-31 08:05:29 +00:00
|
|
|
*/
|
|
|
|
static void
|
2009-10-06 09:13:57 +00:00
|
|
|
create_ntlmssp_v1_key(const char *nt_password, const guint8 *serverchallenge, const guint8 *clientchallenge,
|
2010-10-03 18:51:38 +00:00
|
|
|
guint8 *sessionkey,const guint8 *encryptedsessionkey, int flags,
|
|
|
|
const guint8 *ref_nt_challenge_response,const guint8 *ref_lm_challenge_response)
|
2002-12-31 08:05:29 +00:00
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
unsigned char lm_password_upper[NTLMSSP_KEY_LEN];
|
|
|
|
unsigned char lm_password_hash[NTLMSSP_KEY_LEN];
|
|
|
|
unsigned char nt_password_hash[NTLMSSP_KEY_LEN];
|
|
|
|
unsigned char challenges_hash[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
unsigned char challenges_hash_first8[8];
|
2009-11-16 17:08:12 +00:00
|
|
|
unsigned char challenges[NTLMSSP_KEY_LEN];
|
|
|
|
guint8 md4[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 nb_pass = 0;
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 sessionbasekey[NTLMSSP_KEY_LEN];
|
|
|
|
guint8 keyexchangekey[NTLMSSP_KEY_LEN];
|
2002-12-31 08:05:29 +00:00
|
|
|
guint8 lm_challenge_response[24];
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 nt_challenge_response[24];
|
|
|
|
rc4_state_struct rc4state;
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_state_t md5state;
|
2009-10-06 09:13:57 +00:00
|
|
|
char nt_password_unicode[256];
|
2002-12-31 08:05:29 +00:00
|
|
|
size_t password_len;
|
|
|
|
unsigned int i;
|
2009-10-06 09:13:57 +00:00
|
|
|
int found = 0;
|
2009-10-07 21:00:14 +00:00
|
|
|
md4_pass *pass_list = NULL;
|
2007-01-09 22:14:07 +00:00
|
|
|
unsigned char lmhash_key[] =
|
2002-12-31 08:05:29 +00:00
|
|
|
{0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
memset(sessionkey, 0, NTLMSSP_KEY_LEN);
|
2002-12-31 08:05:29 +00:00
|
|
|
memset(lm_password_upper, 0, sizeof(lm_password_upper));
|
2009-10-06 09:13:57 +00:00
|
|
|
/* lm auth/lm session == (!NTLM_NEGOTIATE_NT_ONLY && NTLMSSP_NEGOTIATE_LM_KEY) || ! (EXTENDED_SECURITY) || ! NTLMSSP_NEGOTIATE_NTLM*/
|
2002-12-31 08:05:29 +00:00
|
|
|
/* Create a Lan Manager hash of the input password */
|
2003-03-11 22:51:52 +00:00
|
|
|
if (nt_password[0] != '\0') {
|
2002-12-31 08:05:29 +00:00
|
|
|
password_len = strlen(nt_password);
|
2009-10-06 09:13:57 +00:00
|
|
|
/*Do not forget to free nt_password_nt*/
|
|
|
|
str_to_unicode(nt_password,nt_password_unicode);
|
|
|
|
crypt_md4(nt_password_hash,nt_password_unicode,password_len*2);
|
2002-12-31 08:05:29 +00:00
|
|
|
/* Truncate password if too long */
|
2009-11-16 17:08:12 +00:00
|
|
|
if (password_len > NTLMSSP_KEY_LEN)
|
|
|
|
password_len = NTLMSSP_KEY_LEN;
|
2002-12-31 08:05:29 +00:00
|
|
|
for (i = 0; i < password_len; i++) {
|
|
|
|
lm_password_upper[i] = toupper(nt_password[i]);
|
|
|
|
}
|
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Unable to calculate the session key without a password ... and we will not use one for a keytab*/
|
|
|
|
if( !(flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY )) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if((flags & NTLMSSP_NEGOTIATE_LM_KEY && !(flags & NTLMSSP_NEGOTIATE_NT_ONLY)) || !(flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY) || !(flags & NTLMSSP_NEGOTIATE_NTLM)) {
|
|
|
|
crypt_des_ecb(lm_password_hash, lmhash_key, lm_password_upper, 1);
|
|
|
|
crypt_des_ecb(lm_password_hash+8, lmhash_key, lm_password_upper+7, 1);
|
|
|
|
ntlmssp_generate_challenge_response(lm_challenge_response,
|
2010-10-03 18:51:38 +00:00
|
|
|
lm_password_hash, serverchallenge);
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(sessionbasekey,lm_password_hash,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
memset(lm_challenge_response,0,24);
|
|
|
|
if( flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY ) {
|
2009-10-07 21:00:14 +00:00
|
|
|
#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
|
2009-10-06 09:13:57 +00:00
|
|
|
nb_pass = get_md4pass_list(&pass_list,nt_password);
|
2009-10-07 21:00:14 +00:00
|
|
|
#endif
|
2009-10-06 09:13:57 +00:00
|
|
|
i=0;
|
|
|
|
while (i < nb_pass ) {
|
|
|
|
/*fprintf(stderr,"Turn %d, ",i);*/
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(nt_password_hash,pass_list[i].md4,NTLMSSP_KEY_LEN);
|
|
|
|
/*printnbyte(nt_password_hash,NTLMSSP_KEY_LEN,"Current NT password hash: ","\n");*/
|
2009-10-06 09:13:57 +00:00
|
|
|
i++;
|
|
|
|
memcpy(lm_challenge_response,clientchallenge,8);
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_init(&md5state);
|
2009-10-06 09:13:57 +00:00
|
|
|
md5_append(&md5state,serverchallenge,8);
|
|
|
|
md5_append(&md5state,clientchallenge,8);
|
|
|
|
md5_finish(&md5state,challenges_hash);
|
|
|
|
memcpy(challenges_hash_first8,challenges_hash,8);
|
|
|
|
crypt_des_ecb_long(nt_challenge_response,nt_password_hash,challenges_hash_first8);
|
|
|
|
if( !memcmp(ref_nt_challenge_response,nt_challenge_response,24) ) {
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
crypt_des_ecb_long(nt_challenge_response,nt_password_hash,serverchallenge);
|
|
|
|
if( flags & NTLMSSP_NEGOTIATE_NT_ONLY ) {
|
|
|
|
memcpy(lm_challenge_response,nt_challenge_response,24);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
crypt_des_ecb_long(lm_challenge_response,lm_password_hash,serverchallenge);
|
|
|
|
}
|
|
|
|
if( !memcmp(ref_nt_challenge_response,nt_challenge_response,24) && !memcmp(ref_lm_challenge_response,lm_challenge_response,24) ) {
|
|
|
|
found = 1;
|
2009-10-06 14:20:59 +00:00
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
/* So it's clearly not like this that's put into NTLMSSP doc but after some digging into samba code I'm quite confident
|
|
|
|
* that sessionbasekey should be based md4(nt_password_hash) only in the case of some NT auth
|
|
|
|
* Otherwise it should be lm_password_hash ...*/
|
2009-11-16 17:08:12 +00:00
|
|
|
crypt_md4(md4,nt_password_hash,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY) {
|
|
|
|
memcpy(challenges,serverchallenge,8);
|
|
|
|
memcpy(challenges+8,clientchallenge,8);
|
|
|
|
/*md5_hmac(text,text_len,key,key_len,digest);*/
|
2009-11-16 17:08:12 +00:00
|
|
|
md5_hmac(challenges,NTLMSSP_KEY_LEN,md4,NTLMSSP_KEY_LEN,sessionbasekey);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(sessionbasekey,md4,NTLMSSP_KEY_LEN);
|
2009-10-06 14:20:59 +00:00
|
|
|
}
|
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
if( found == 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
get_keyexchange_key(keyexchangekey,sessionbasekey,lm_challenge_response,flags);
|
2009-11-16 17:08:12 +00:00
|
|
|
memset(sessionkey, 0, NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
/*printnbyte(nt_challenge_response,24,"NT challenge response","\n");
|
|
|
|
printnbyte(lm_challenge_response,24,"LM challenge response","\n");*/
|
2009-10-06 14:20:59 +00:00
|
|
|
/* now decrypt session key if needed and setup sessionkey for decrypting further communications */
|
2009-10-06 09:13:57 +00:00
|
|
|
if (flags & NTLMSSP_NEGOTIATE_KEY_EXCH)
|
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(sessionkey,encryptedsessionkey,NTLMSSP_KEY_LEN);
|
|
|
|
crypt_rc4_init(&rc4state,keyexchangekey,NTLMSSP_KEY_LEN);
|
|
|
|
crypt_rc4(&rc4state,sessionkey,NTLMSSP_KEY_LEN);
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
else
|
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(sessionkey,keyexchangekey,NTLMSSP_KEY_LEN);
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
static void
|
2009-11-16 17:08:12 +00:00
|
|
|
get_siging_key(guint8 *sign_key_server,guint8* sign_key_client,const guint8 key[NTLMSSP_KEY_LEN], int keylen)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_state_t md5state;
|
|
|
|
md5_state_t md5state2;
|
2009-11-16 17:08:12 +00:00
|
|
|
memset(sign_key_client,0,NTLMSSP_KEY_LEN);
|
|
|
|
memset(sign_key_server,0,NTLMSSP_KEY_LEN);
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_init(&md5state);
|
2009-10-06 09:13:57 +00:00
|
|
|
md5_append(&md5state,key,keylen);
|
|
|
|
md5_append(&md5state,CLIENT_SIGN_TEXT,strlen(CLIENT_SIGN_TEXT)+1);
|
|
|
|
md5_finish(&md5state,sign_key_client);
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_init(&md5state2);
|
2009-10-06 09:13:57 +00:00
|
|
|
md5_append(&md5state2,key,keylen);
|
|
|
|
md5_append(&md5state2,SERVER_SIGN_TEXT,strlen(SERVER_SIGN_TEXT)+1);
|
|
|
|
md5_finish(&md5state2,sign_key_server);
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* We return either a 128 or 64 bit key
|
|
|
|
*/
|
2009-10-06 14:20:59 +00:00
|
|
|
static void
|
2010-10-03 19:43:14 +00:00
|
|
|
get_sealing_rc4key(const guint8 exportedsessionkey[NTLMSSP_KEY_LEN] ,const int flags ,int *keylen ,
|
|
|
|
guint8 *clientsealkey ,guint8 *serversealkey)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_state_t md5state;
|
|
|
|
md5_state_t md5state2;
|
2009-11-16 17:08:12 +00:00
|
|
|
memset(clientsealkey,0,NTLMSSP_KEY_LEN);
|
|
|
|
memset(serversealkey,0,NTLMSSP_KEY_LEN);
|
|
|
|
memcpy(clientsealkey,exportedsessionkey,NTLMSSP_KEY_LEN);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY)
|
|
|
|
{
|
|
|
|
if (flags & NTLMSSP_NEGOTIATE_128)
|
|
|
|
{
|
|
|
|
/* The exportedsessionkey has already the good length just update the length*/
|
|
|
|
*keylen = 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (flags & NTLMSSP_NEGOTIATE_56)
|
|
|
|
{
|
|
|
|
memset(clientsealkey+7,0,9);
|
|
|
|
*keylen = 7;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memset(clientsealkey+5,0,11);
|
|
|
|
*keylen = 5;
|
|
|
|
}
|
|
|
|
}
|
2009-11-16 17:08:12 +00:00
|
|
|
memcpy(serversealkey,clientsealkey,NTLMSSP_KEY_LEN);
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_init(&md5state);
|
2009-10-06 09:13:57 +00:00
|
|
|
md5_append(&md5state,clientsealkey,*keylen);
|
|
|
|
md5_append(&md5state,CLIENT_SEAL_TEXT,strlen(CLIENT_SEAL_TEXT)+1);
|
|
|
|
md5_finish(&md5state,clientsealkey);
|
2009-10-06 14:20:59 +00:00
|
|
|
md5_init(&md5state2);
|
2009-10-06 09:13:57 +00:00
|
|
|
md5_append(&md5state2,serversealkey,*keylen);
|
|
|
|
md5_append(&md5state2,SERVER_SEAL_TEXT,strlen(SERVER_SEAL_TEXT)+1);
|
|
|
|
md5_finish(&md5state2,serversealkey);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (flags & NTLMSSP_NEGOTIATE_128)
|
|
|
|
{
|
|
|
|
/* The exportedsessionkey has already the good length just update the length*/
|
|
|
|
*keylen = 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*keylen = 8;
|
|
|
|
if (flags & NTLMSSP_NEGOTIATE_56)
|
|
|
|
{
|
|
|
|
memset(clientsealkey+7,0,9);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memset(clientsealkey+5,0,11);
|
|
|
|
clientsealkey[5]=0xe5;
|
|
|
|
clientsealkey[6]=0x38;
|
|
|
|
clientsealkey[7]=0xb0;
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
}
|
2011-05-20 20:41:23 +00:00
|
|
|
memcpy(serversealkey,clientsealkey,*keylen);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Create an NTLMSSP version 1 key.
|
|
|
|
* password points to the ANSI password to encrypt, challenge points to
|
|
|
|
* the 8 octet challenge string, key128 will do a 128 bit key if set to 1,
|
|
|
|
* otherwise it will do a 40 bit key. The result is stored in
|
2009-11-16 17:08:12 +00:00
|
|
|
* sspkey (expected to be NTLMSSP_KEY_LEN octets)
|
2009-10-06 09:13:57 +00:00
|
|
|
*/
|
2002-09-10 23:44:17 +00:00
|
|
|
/* dissect a string - header area contains:
|
|
|
|
two byte len
|
|
|
|
two byte maxlen
|
|
|
|
four byte offset of string in data area
|
|
|
|
The function returns the offset at the end of the string header,
|
|
|
|
but the 'end' parameter returns the offset of the end of the string itself
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
The 'start' parameter returns the offset of the beginning of the string
|
2010-09-30 20:26:13 +00:00
|
|
|
If there's no string, just use the offset of the end of the tvb as start/end.
|
2002-09-10 23:44:17 +00:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
dissect_ntlmssp_string (tvbuff_t *tvb, int offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree *ntlmssp_tree,
|
|
|
|
gboolean unicode_strings,
|
|
|
|
int string_hf, int *start, int *end,
|
|
|
|
const char **stringp)
|
2002-09-10 23:44:17 +00:00
|
|
|
{
|
|
|
|
proto_tree *tree = NULL;
|
|
|
|
proto_item *tf = NULL;
|
|
|
|
gint16 string_length = tvb_get_letohs(tvb, offset);
|
|
|
|
gint16 string_maxlen = tvb_get_letohs(tvb, offset+2);
|
|
|
|
gint32 string_offset = tvb_get_letohl(tvb, offset+4);
|
|
|
|
const char *string_text = NULL;
|
|
|
|
int result_length;
|
|
|
|
guint16 bc;
|
|
|
|
|
2010-09-30 21:14:44 +00:00
|
|
|
*start = (string_offset > offset+8 ? string_offset : (signed)tvb_reported_length(tvb));
|
2002-09-10 23:44:17 +00:00
|
|
|
if (0 == string_length) {
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
*end = *start;
|
2002-09-23 22:55:32 +00:00
|
|
|
if (ntlmssp_tree)
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree_add_string(ntlmssp_tree, string_hf, tvb,
|
|
|
|
offset, 8, "NULL");
|
2005-07-11 22:48:51 +00:00
|
|
|
if (stringp != NULL)
|
|
|
|
*stringp = "";
|
2002-09-10 23:44:17 +00:00
|
|
|
return offset+8;
|
|
|
|
}
|
|
|
|
|
2002-09-11 16:45:07 +00:00
|
|
|
bc = result_length = string_length;
|
2002-09-10 23:44:17 +00:00
|
|
|
string_text = get_unicode_or_ascii_string(tvb, &string_offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
unicode_strings, &result_length,
|
|
|
|
FALSE, TRUE, &bc);
|
2010-08-30 17:05:37 +00:00
|
|
|
|
|
|
|
if (stringp != NULL) {
|
|
|
|
if (!string_text) string_text = ""; /* Make sure we don't blow up later */
|
|
|
|
|
2005-07-11 22:48:51 +00:00
|
|
|
*stringp = string_text;
|
2010-08-30 17:05:37 +00:00
|
|
|
}
|
2002-09-10 23:44:17 +00:00
|
|
|
|
|
|
|
if (ntlmssp_tree) {
|
|
|
|
tf = proto_tree_add_string(ntlmssp_tree, string_hf, tvb,
|
2010-10-03 18:51:38 +00:00
|
|
|
string_offset, result_length, string_text);
|
2002-09-10 23:44:17 +00:00
|
|
|
tree = proto_item_add_subtree(tf, ett_ntlmssp_string);
|
|
|
|
}
|
|
|
|
proto_tree_add_uint(tree, hf_ntlmssp_string_len,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 2, string_length);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_uint(tree, hf_ntlmssp_string_maxlen,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 2, string_maxlen);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_uint(tree, hf_ntlmssp_string_offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 4, string_offset);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
*end = string_offset + string_length;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
/* dissect a generic blob - header area contains:
|
2002-09-10 23:44:17 +00:00
|
|
|
two byte len
|
|
|
|
two byte maxlen
|
|
|
|
four byte offset of blob in data area
|
|
|
|
The function returns the offset at the end of the blob header,
|
|
|
|
but the 'end' parameter returns the offset of the end of the blob itself
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
dissect_ntlmssp_blob (tvbuff_t *tvb, int offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree *ntlmssp_tree,
|
|
|
|
int blob_hf, int *end, ntlmssp_blob *result)
|
2002-09-10 23:44:17 +00:00
|
|
|
{
|
|
|
|
proto_item *tf = NULL;
|
|
|
|
proto_tree *tree = NULL;
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
guint16 blob_length = tvb_get_letohs(tvb, offset);
|
|
|
|
guint16 blob_maxlen = tvb_get_letohs(tvb, offset+2);
|
|
|
|
guint32 blob_offset = tvb_get_letohl(tvb, offset+4);
|
2002-09-10 23:44:17 +00:00
|
|
|
if (0 == blob_length) {
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
*end = (blob_offset > ((guint)offset)+8 ? blob_offset : ((guint)offset)+8);
|
|
|
|
if (ntlmssp_tree)
|
2010-10-03 19:43:14 +00:00
|
|
|
proto_tree_add_text(ntlmssp_tree, tvb, offset, 8, "%s: Empty",
|
|
|
|
proto_registrar_get_name(blob_hf));
|
2002-09-10 23:44:17 +00:00
|
|
|
return offset+8;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ntlmssp_tree) {
|
2007-01-09 22:14:07 +00:00
|
|
|
tf = proto_tree_add_item (ntlmssp_tree, blob_hf, tvb,
|
2011-11-09 17:33:18 +00:00
|
|
|
blob_offset, blob_length, ENC_NA);
|
2002-09-10 23:44:17 +00:00
|
|
|
tree = proto_item_add_subtree(tf, ett_ntlmssp_blob);
|
|
|
|
}
|
|
|
|
proto_tree_add_uint(tree, hf_ntlmssp_blob_len,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 2, blob_length);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_uint(tree, hf_ntlmssp_blob_maxlen,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 2, blob_maxlen);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_uint(tree, hf_ntlmssp_blob_offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 4, blob_offset);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
*end = blob_offset + blob_length;
|
2002-12-31 08:05:29 +00:00
|
|
|
|
|
|
|
if (result != NULL) {
|
|
|
|
result->length = blob_length;
|
|
|
|
memset(result->contents, 0, MAX_BLOB_SIZE);
|
|
|
|
if (blob_length < MAX_BLOB_SIZE)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
2002-12-31 08:05:29 +00:00
|
|
|
tvb_memcpy(tvb, result->contents, blob_offset, blob_length);
|
2011-05-27 01:57:33 +00:00
|
|
|
if (blob_hf == hf_ntlmssp_auth_lmresponse && !(tvb_memeql(tvb, blob_offset+8, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", NTLMSSP_KEY_LEN)))
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
proto_tree_add_item (ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_ntlm_client_challenge,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, blob_offset, 8, ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
|
|
|
|
2003-05-09 01:41:28 +00:00
|
|
|
/* If we are dissecting the NTLM response and it is a NTLMv2
|
|
|
|
response call the appropriate dissector. */
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2003-05-09 01:41:28 +00:00
|
|
|
if (blob_hf == hf_ntlmssp_auth_ntresponse && blob_length > 24)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
proto_tree_add_item (ntlmssp_tree,
|
2010-10-03 19:43:14 +00:00
|
|
|
hf_ntlmssp_ntlm_client_challenge,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, blob_offset+32, 8, ENC_NA);
|
2010-10-03 18:51:38 +00:00
|
|
|
dissect_ntlmv2_response(tvb, tree, blob_offset, blob_length);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
2003-05-07 04:07:45 +00:00
|
|
|
|
2003-05-09 01:41:28 +00:00
|
|
|
return offset;
|
2003-05-07 04:07:45 +00:00
|
|
|
}
|
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
static int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ntlmssp_negotiate_flags (tvbuff_t *tvb, int offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree *ntlmssp_tree,
|
|
|
|
guint32 negotiate_flags)
|
2002-07-09 20:49:27 +00:00
|
|
|
{
|
|
|
|
proto_tree *negotiate_flags_tree = NULL;
|
|
|
|
proto_item *tf = NULL;
|
|
|
|
|
|
|
|
if (ntlmssp_tree) {
|
2002-08-28 21:04:11 +00:00
|
|
|
tf = proto_tree_add_uint (ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-07-09 20:49:27 +00:00
|
|
|
negotiate_flags_tree = proto_item_add_subtree (tf, ett_ntlmssp_negotiate_flags);
|
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_80000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_40000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_20000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_10000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_8000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_4000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_2000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_1000000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_800000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_400000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_200000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_100000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_80000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_40000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_20000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_10000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_8000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_4000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_2000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-07-10 02:59:38 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_1000,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_800,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_400,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_200,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_100,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-07-10 02:59:38 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_80,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_40,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_20,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_10,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_08,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_04,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_02,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_boolean (negotiate_flags_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_flags_01,
|
|
|
|
tvb, offset, 4, negotiate_flags);
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
return (offset + 4);
|
|
|
|
}
|
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
/* Dissect "version" */
|
|
|
|
|
|
|
|
/* From MS-NLMP:
|
2010-10-03 19:43:14 +00:00
|
|
|
0 Major Version Number 1 byte
|
|
|
|
1 Minor Version Number 1 byte
|
|
|
|
2 Build Number short(LE)
|
2010-09-28 14:14:12 +00:00
|
|
|
3 (Reserved) 3 bytes
|
2010-10-03 19:43:14 +00:00
|
|
|
4 NTLM Current Revision 1 byte
|
2010-09-28 14:14:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_ntlmssp_version(tvbuff_t *tvb, int offset,
|
|
|
|
proto_tree *ntlmssp_tree)
|
|
|
|
{
|
|
|
|
if (ntlmssp_tree) {
|
|
|
|
proto_item *tf;
|
|
|
|
proto_tree *version_tree;
|
2010-10-03 18:23:46 +00:00
|
|
|
tf = proto_tree_add_none_format(ntlmssp_tree, hf_ntlmssp_version, tvb, offset, 8,
|
|
|
|
"Version %u.%u (Build %u); NTLM Current Revision %u",
|
|
|
|
tvb_get_guint8(tvb, offset),
|
|
|
|
tvb_get_guint8(tvb, offset+1),
|
|
|
|
tvb_get_letohs(tvb, offset+2),
|
|
|
|
tvb_get_guint8(tvb, offset+7));
|
2010-09-28 14:14:12 +00:00
|
|
|
version_tree = proto_item_add_subtree (tf, ett_ntlmssp_version);
|
|
|
|
proto_tree_add_item(version_tree, hf_ntlmssp_version_major , tvb, offset , 1, ENC_NA);
|
|
|
|
proto_tree_add_item(version_tree, hf_ntlmssp_version_minor , tvb, offset+1, 1, ENC_NA);
|
|
|
|
proto_tree_add_item(version_tree, hf_ntlmssp_version_build_number , tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item(version_tree, hf_ntlmssp_version_ntlm_current_revision, tvb, offset+7, 1, ENC_NA);
|
|
|
|
}
|
|
|
|
return offset+8;
|
|
|
|
}
|
|
|
|
|
2004-08-02 23:14:32 +00:00
|
|
|
/* Dissect a NTLM response. This is documented at
|
2004-08-04 03:13:41 +00:00
|
|
|
http://ubiqx.org/cifs/SMB.html#SMB.8, para 2.8.5.3 */
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
/* Attribute types */
|
2004-08-02 23:14:32 +00:00
|
|
|
/*
|
|
|
|
* XXX - the davenport document says that a type of 5 has been seen,
|
|
|
|
* "apparently containing the 'parent' DNS domain for servers in
|
|
|
|
* subdomains".
|
2010-10-03 18:23:46 +00:00
|
|
|
* XXX: MS-NLMP info is newer than Davenport info;
|
|
|
|
* The attribute type list and the attribute names below are
|
|
|
|
* based upon MS-NLMP.
|
2004-08-02 23:14:32 +00:00
|
|
|
*/
|
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
#define NTLM_TARGET_INFO_END 0x0000
|
|
|
|
#define NTLM_TARGET_INFO_NB_COMPUTER_NAME 0x0001
|
|
|
|
#define NTLM_TARGET_INFO_NB_DOMAIN_NAME 0x0002
|
|
|
|
#define NTLM_TARGET_INFO_DNS_COMPUTER_NAME 0x0003
|
|
|
|
#define NTLM_TARGET_INFO_DNS_DOMAIN_NAME 0x0004
|
|
|
|
#define NTLM_TARGET_INFO_DNS_TREE_NAME 0x0005
|
|
|
|
#define NTLM_TARGET_INFO_FLAGS 0x0006
|
|
|
|
#define NTLM_TARGET_INFO_TIMESTAMP 0x0007
|
|
|
|
#define NTLM_TARGET_INFO_RESTRICTIONS 0x0008
|
|
|
|
#define NTLM_TARGET_INFO_TARGET_NAME 0x0009
|
|
|
|
#define NTLM_TARGET_INFO_CHANNEL_BINDINGS 0x000A
|
2004-08-02 23:14:32 +00:00
|
|
|
|
|
|
|
static const value_string ntlm_name_types[] = {
|
2010-10-03 18:51:38 +00:00
|
|
|
{ NTLM_TARGET_INFO_END, "End of list" },
|
|
|
|
{ NTLM_TARGET_INFO_NB_COMPUTER_NAME, "NetBIOS computer name" },
|
|
|
|
{ NTLM_TARGET_INFO_NB_DOMAIN_NAME, "NetBIOS domain name" },
|
|
|
|
{ NTLM_TARGET_INFO_DNS_COMPUTER_NAME, "DNS computer name" },
|
|
|
|
{ NTLM_TARGET_INFO_DNS_DOMAIN_NAME, "DNS domain name" },
|
|
|
|
{ NTLM_TARGET_INFO_DNS_TREE_NAME, "DNS tree name" },
|
|
|
|
{ NTLM_TARGET_INFO_FLAGS, "Flags" },
|
|
|
|
{ NTLM_TARGET_INFO_TIMESTAMP, "Timestamp" },
|
|
|
|
{ NTLM_TARGET_INFO_RESTRICTIONS, "Restrictions" },
|
|
|
|
{ NTLM_TARGET_INFO_TARGET_NAME, "Target Name"},
|
|
|
|
{ NTLM_TARGET_INFO_CHANNEL_BINDINGS, "Channel Bindings"},
|
|
|
|
{ 0, NULL }
|
2004-08-02 23:14:32 +00:00
|
|
|
};
|
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
/* The following *must* match the order of the list of attribute types */
|
|
|
|
/* Assumption: values in the list are a sequence starting with 0 and */
|
|
|
|
/* with no gaps allowing a direct access of the array by attribute type */
|
|
|
|
static int *ntlmssp_hf_challenge_target_info_hf_ptr_array[] = {
|
|
|
|
&hf_ntlmssp_challenge_target_info_end,
|
|
|
|
&hf_ntlmssp_challenge_target_info_nb_computer_name,
|
|
|
|
&hf_ntlmssp_challenge_target_info_nb_domain_name,
|
|
|
|
&hf_ntlmssp_challenge_target_info_dns_computer_name,
|
|
|
|
&hf_ntlmssp_challenge_target_info_dns_domain_name,
|
|
|
|
&hf_ntlmssp_challenge_target_info_dns_tree_name,
|
|
|
|
&hf_ntlmssp_challenge_target_info_flags,
|
|
|
|
&hf_ntlmssp_challenge_target_info_timestamp,
|
|
|
|
&hf_ntlmssp_challenge_target_info_restrictions,
|
|
|
|
&hf_ntlmssp_challenge_target_info_target_name,
|
|
|
|
&hf_ntlmssp_challenge_target_info_channel_bindings
|
|
|
|
};
|
|
|
|
|
|
|
|
static int *ntlmssp_hf_ntlmv2_response_hf_ptr_array[] = {
|
|
|
|
&hf_ntlmssp_ntlmv2_response_end,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_nb_computer_name,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_nb_domain_name,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_dns_computer_name,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_dns_domain_name,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_dns_tree_name,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_flags,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_timestamp,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_restrictions,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_target_name,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_channel_bindings
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _tif {
|
|
|
|
gint *ett;
|
|
|
|
int *hf_item_type;
|
|
|
|
int *hf_item_length;
|
|
|
|
int **hf_attr_array_p;
|
|
|
|
} tif_t;
|
|
|
|
|
|
|
|
static tif_t ntlmssp_challenge_target_info_tif = {
|
|
|
|
&ett_ntlmssp_challenge_target_info_item,
|
|
|
|
&hf_ntlmssp_challenge_target_info_item_type,
|
|
|
|
&hf_ntlmssp_challenge_target_info_item_len,
|
|
|
|
ntlmssp_hf_challenge_target_info_hf_ptr_array
|
|
|
|
};
|
|
|
|
|
|
|
|
static tif_t ntlmssp_ntlmv2_response_tif = {
|
|
|
|
&ett_ntlmssp_ntlmv2_response_item,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_item_type,
|
|
|
|
&hf_ntlmssp_ntlmv2_response_item_len,
|
|
|
|
ntlmssp_hf_ntlmv2_response_hf_ptr_array
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_ntlmssp_target_info_list(tvbuff_t *tvb, proto_tree *tree,
|
|
|
|
guint32 target_info_offset, guint16 target_info_length,
|
|
|
|
tif_t *tif_p)
|
|
|
|
{
|
|
|
|
guint32 item_offset;
|
|
|
|
guint16 item_type;
|
|
|
|
guint16 item_length;
|
|
|
|
|
|
|
|
|
|
|
|
/* Now enumerate through the individual items in the list */
|
|
|
|
item_offset = target_info_offset;
|
|
|
|
|
|
|
|
while (item_offset < (target_info_offset + target_info_length)) {
|
|
|
|
proto_item *target_info_tf;
|
|
|
|
proto_tree *target_info_tree;
|
|
|
|
guint32 content_offset;
|
|
|
|
guint16 content_length;
|
|
|
|
guint32 type_offset;
|
|
|
|
guint32 len_offset;
|
|
|
|
|
|
|
|
int **hf_array_p = tif_p->hf_attr_array_p;
|
|
|
|
|
|
|
|
/* Content type */
|
|
|
|
type_offset = item_offset;
|
|
|
|
item_type = tvb_get_letohs(tvb, type_offset);
|
|
|
|
|
|
|
|
/* Content length */
|
|
|
|
len_offset = type_offset + 2;
|
|
|
|
content_length = tvb_get_letohs(tvb, len_offset);
|
|
|
|
|
|
|
|
/* Content value */
|
|
|
|
content_offset = len_offset + 2;
|
|
|
|
item_length = content_length + 4;
|
|
|
|
|
|
|
|
target_info_tf = proto_tree_add_text(tree, tvb, item_offset, item_length, "Attribute: %s",
|
|
|
|
val_to_str(item_type, ntlm_name_types, "Unknown (%d)"));
|
|
|
|
|
|
|
|
target_info_tree = proto_item_add_subtree (target_info_tf, *tif_p->ett);
|
|
|
|
proto_tree_add_item (target_info_tree, *tif_p->hf_item_type, tvb, type_offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item (target_info_tree, *tif_p->hf_item_length, tvb, len_offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
switch (item_type) {
|
2010-10-03 18:23:46 +00:00
|
|
|
case NTLM_TARGET_INFO_NB_COMPUTER_NAME:
|
|
|
|
case NTLM_TARGET_INFO_NB_DOMAIN_NAME:
|
|
|
|
case NTLM_TARGET_INFO_DNS_COMPUTER_NAME:
|
|
|
|
case NTLM_TARGET_INFO_DNS_DOMAIN_NAME:
|
|
|
|
case NTLM_TARGET_INFO_DNS_TREE_NAME:
|
|
|
|
case NTLM_TARGET_INFO_TARGET_NAME:
|
|
|
|
if (content_length > 0) {
|
|
|
|
const gchar *text;
|
|
|
|
|
2011-10-23 22:58:45 +00:00
|
|
|
text = tvb_get_ephemeral_unicode_string(tvb, content_offset, content_length / 2, ENC_LITTLE_ENDIAN);
|
2010-10-03 18:23:46 +00:00
|
|
|
proto_tree_add_string(target_info_tree, *hf_array_p[item_type],
|
|
|
|
tvb, content_offset, content_length, text);
|
|
|
|
proto_item_append_text(target_info_tf, ": %s", text);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NTLM_TARGET_INFO_FLAGS:
|
|
|
|
proto_tree_add_item(target_info_tree, *hf_array_p[item_type],
|
|
|
|
tvb, content_offset, content_length, ENC_LITTLE_ENDIAN);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NTLM_TARGET_INFO_TIMESTAMP:
|
|
|
|
dissect_nt_64bit_time(tvb, target_info_tree, content_offset, *hf_array_p[item_type]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NTLM_TARGET_INFO_RESTRICTIONS:
|
|
|
|
case NTLM_TARGET_INFO_CHANNEL_BINDINGS:
|
|
|
|
proto_tree_add_item(target_info_tree, *hf_array_p[item_type],
|
|
|
|
tvb, content_offset, content_length, ENC_NA);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
item_offset += item_length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-02 23:14:32 +00:00
|
|
|
int
|
|
|
|
dissect_ntlmv2_response(tvbuff_t *tvb, proto_tree *tree, int offset, int len)
|
|
|
|
{
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_item *ntlmv2_item = NULL;
|
|
|
|
proto_tree *ntlmv2_tree = NULL;
|
|
|
|
int orig_offset;
|
2010-10-03 18:23:46 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
/* Dissect NTLMv2 bits&pieces */
|
|
|
|
orig_offset = offset;
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
if (tree) {
|
|
|
|
ntlmv2_item = proto_tree_add_item(
|
|
|
|
tree, hf_ntlmssp_ntlmv2_response, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
offset, len, ENC_NA);
|
2010-10-03 18:51:38 +00:00
|
|
|
ntlmv2_tree = proto_item_add_subtree(
|
|
|
|
ntlmv2_item, ett_ntlmssp_ntlmv2_response);
|
|
|
|
}
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree_add_item(
|
|
|
|
ntlmv2_tree, hf_ntlmssp_ntlmv2_response_hmac, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
offset, 16, ENC_NA);
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
offset += 16;
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree_add_item(
|
|
|
|
ntlmv2_tree, hf_ntlmssp_ntlmv2_response_header, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
offset += 4;
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree_add_item(
|
|
|
|
ntlmv2_tree, hf_ntlmssp_ntlmv2_response_reserved, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
offset += 4;
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
offset = dissect_nt_64bit_time(
|
|
|
|
tvb, ntlmv2_tree, offset, hf_ntlmssp_ntlmv2_response_time);
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree_add_item(
|
|
|
|
ntlmv2_tree, hf_ntlmssp_ntlmv2_response_chal, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
offset, 8, ENC_NA);
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
offset += 8;
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree_add_item(
|
|
|
|
ntlmv2_tree, hf_ntlmssp_ntlmv2_response_unknown, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
offset += 4;
|
2004-08-02 23:14:32 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
/* Variable length list of attributes */
|
|
|
|
/*
|
|
|
|
* XXX - Windows puts one or more sets of 4 bytes of additional stuff (all zeros ?)
|
|
|
|
* at the end of the attributes.
|
|
|
|
* Samba's smbclient doesn't.
|
|
|
|
* Both of them appear to be able to connect to W2K SMB
|
|
|
|
* servers.
|
|
|
|
* The additional stuff will be dissected as extra "end" attributes.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
dissect_ntlmssp_target_info_list(tvb, ntlmv2_tree,
|
|
|
|
offset, len - (offset - orig_offset),
|
|
|
|
&ntlmssp_ntlmv2_response_tif);
|
2010-10-03 18:23:46 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
return offset+len;
|
2004-08-02 23:14:32 +00:00
|
|
|
}
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2005-12-07 13:09:42 +00:00
|
|
|
/* tapping into ntlmssph not yet implemented */
|
2002-07-09 20:49:27 +00:00
|
|
|
static int
|
2005-12-07 13:09:42 +00:00
|
|
|
dissect_ntlmssp_negotiate (tvbuff_t *tvb, int offset, proto_tree *ntlmssp_tree, ntlmssp_header_t *ntlmssph _U_)
|
2002-07-09 20:49:27 +00:00
|
|
|
{
|
|
|
|
guint32 negotiate_flags;
|
2010-09-30 20:26:13 +00:00
|
|
|
int data_start;
|
|
|
|
int data_end;
|
|
|
|
int item_start;
|
|
|
|
int item_end;
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
/* NTLMSSP Negotiate Flags */
|
2010-09-28 15:26:58 +00:00
|
|
|
negotiate_flags = tvb_get_letohl (tvb, offset);
|
2002-07-09 20:49:27 +00:00
|
|
|
offset = dissect_ntlmssp_negotiate_flags (tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
negotiate_flags);
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2004-08-02 20:26:16 +00:00
|
|
|
/*
|
|
|
|
* XXX - the davenport document says that these might not be
|
|
|
|
* sent at all, presumably meaning the length of the message
|
|
|
|
* isn't enough to contain them.
|
|
|
|
*/
|
2007-01-09 22:14:07 +00:00
|
|
|
offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree, FALSE,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_domain,
|
|
|
|
&data_start, &data_end, NULL);
|
2010-09-30 20:26:13 +00:00
|
|
|
|
2007-01-09 22:14:07 +00:00
|
|
|
offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree, FALSE,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_negotiate_workstation,
|
|
|
|
&item_start, &item_end, NULL);
|
2010-09-30 20:26:13 +00:00
|
|
|
data_start = MIN(data_start, item_start);
|
|
|
|
data_end = MAX(data_end, item_end);
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2011-05-17 02:29:43 +00:00
|
|
|
/* If there are more bytes before the data block dissect a version field
|
|
|
|
if NTLMSSP_NEGOTIATE_VERSION is set in the flags (see MS-NLMP) */
|
2010-09-30 20:26:13 +00:00
|
|
|
if (offset < data_start) {
|
2011-05-17 02:29:43 +00:00
|
|
|
if (negotiate_flags & NTLMSSP_NEGOTIATE_VERSION)
|
|
|
|
offset = dissect_ntlmssp_version(tvb, offset, ntlmssp_tree);
|
2010-09-28 14:14:12 +00:00
|
|
|
}
|
2010-09-30 20:26:13 +00:00
|
|
|
return data_end;
|
2002-09-10 23:44:17 +00:00
|
|
|
}
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
static int
|
2010-10-03 18:23:46 +00:00
|
|
|
dissect_ntlmssp_challenge_target_info_blob (tvbuff_t *tvb, int offset,
|
|
|
|
proto_tree *ntlmssp_tree,
|
|
|
|
int *end)
|
2002-09-10 23:44:17 +00:00
|
|
|
{
|
2010-10-03 18:23:46 +00:00
|
|
|
guint16 challenge_target_info_length = tvb_get_letohs(tvb, offset);
|
|
|
|
guint16 challenge_target_info_maxlen = tvb_get_letohs(tvb, offset+2);
|
|
|
|
guint32 challenge_target_info_offset = tvb_get_letohl(tvb, offset+4);
|
2002-09-10 23:44:17 +00:00
|
|
|
proto_item *tf = NULL;
|
2010-10-03 18:23:46 +00:00
|
|
|
proto_tree *challenge_target_info_tree = NULL;
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
/* the target info list is just a blob */
|
|
|
|
if (0 == challenge_target_info_length) {
|
|
|
|
*end = (challenge_target_info_offset > ((guint)offset)+8 ? challenge_target_info_offset : ((guint)offset)+8);
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
if (ntlmssp_tree)
|
2010-10-03 19:43:14 +00:00
|
|
|
proto_tree_add_text(ntlmssp_tree, tvb, offset, 8,
|
|
|
|
"Target Info List: Empty");
|
2002-09-10 23:44:17 +00:00
|
|
|
return offset+8;
|
|
|
|
}
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
if (ntlmssp_tree) {
|
2010-10-03 18:23:46 +00:00
|
|
|
tf = proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_challenge_target_info, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
challenge_target_info_offset, challenge_target_info_length, ENC_NA);
|
2010-10-03 18:23:46 +00:00
|
|
|
challenge_target_info_tree = proto_item_add_subtree(tf, ett_ntlmssp_challenge_target_info);
|
2002-09-10 23:44:17 +00:00
|
|
|
}
|
2010-10-03 18:23:46 +00:00
|
|
|
proto_tree_add_uint(challenge_target_info_tree, hf_ntlmssp_challenge_target_info_len,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 2, challenge_target_info_length);
|
2002-07-09 20:49:27 +00:00
|
|
|
offset += 2;
|
2010-10-03 18:23:46 +00:00
|
|
|
proto_tree_add_uint(challenge_target_info_tree, hf_ntlmssp_challenge_target_info_maxlen,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 2, challenge_target_info_maxlen);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset += 2;
|
2010-10-03 18:23:46 +00:00
|
|
|
proto_tree_add_uint(challenge_target_info_tree, hf_ntlmssp_challenge_target_info_offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvb, offset, 4, challenge_target_info_offset);
|
2002-07-09 20:49:27 +00:00
|
|
|
offset += 4;
|
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
dissect_ntlmssp_target_info_list(tvb, challenge_target_info_tree,
|
|
|
|
challenge_target_info_offset, challenge_target_info_length,
|
|
|
|
&ntlmssp_challenge_target_info_tif);
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2010-10-03 18:23:46 +00:00
|
|
|
*end = challenge_target_info_offset + challenge_target_info_length;
|
2002-07-09 20:49:27 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2005-12-07 13:09:42 +00:00
|
|
|
/* tapping into ntlmssph not yet implemented */
|
2002-07-09 20:49:27 +00:00
|
|
|
static int
|
2002-11-08 01:45:37 +00:00
|
|
|
dissect_ntlmssp_challenge (tvbuff_t *tvb, packet_info *pinfo, int offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree *ntlmssp_tree, ntlmssp_header_t *ntlmssph _U_)
|
2002-07-09 20:49:27 +00:00
|
|
|
{
|
|
|
|
guint32 negotiate_flags;
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
int item_start, item_end;
|
2010-09-28 14:14:12 +00:00
|
|
|
int data_start, data_end; /* MIN and MAX seen */
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 clientkey[NTLMSSP_KEY_LEN]; /* NTLMSSP cipher key for client */
|
|
|
|
guint8 serverkey[NTLMSSP_KEY_LEN]; /* NTLMSSP cipher key for server*/
|
2009-10-06 09:13:57 +00:00
|
|
|
ntlmssp_info *conv_ntlmssp_info = NULL;
|
2002-11-08 01:45:37 +00:00
|
|
|
conversation_t *conversation;
|
2002-09-10 23:44:17 +00:00
|
|
|
gboolean unicode_strings = FALSE;
|
2007-01-09 22:14:07 +00:00
|
|
|
guint8 challenge[8];
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 tmp[8];
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 sspkey[NTLMSSP_KEY_LEN]; /* NTLMSSP cipher key */
|
2009-10-06 09:13:57 +00:00
|
|
|
int ssp_key_len; /* Either 8 or 16 (40 bit or 128) */
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
/* need to find unicode flag */
|
|
|
|
negotiate_flags = tvb_get_letohl (tvb, offset+8);
|
2002-09-24 00:40:42 +00:00
|
|
|
if (negotiate_flags & NTLMSSP_NEGOTIATE_UNICODE)
|
2002-09-10 23:44:17 +00:00
|
|
|
unicode_strings = TRUE;
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
/* Target name */
|
2004-08-02 20:26:16 +00:00
|
|
|
/*
|
2010-09-28 14:14:12 +00:00
|
|
|
* XXX - the davenport document (and MS-NLMP) calls this "Target Name",
|
2004-08-02 20:26:16 +00:00
|
|
|
* presumably because non-domain targets are supported.
|
2010-09-28 14:14:12 +00:00
|
|
|
* XXX - Original name "domain" changed to "target_name" to match MS-NLMP
|
2004-08-02 20:26:16 +00:00
|
|
|
*/
|
2007-01-09 22:14:07 +00:00
|
|
|
offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree, unicode_strings,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_challenge_target_name,
|
|
|
|
&item_start, &item_end, NULL);
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
data_start = item_start;
|
2002-09-10 23:44:17 +00:00
|
|
|
data_end = item_end;
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
/* NTLMSSP Negotiate Flags */
|
|
|
|
offset = dissect_ntlmssp_negotiate_flags (tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
negotiate_flags);
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
/* NTLMSSP NT Lan Manager Challenge */
|
|
|
|
proto_tree_add_item (ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_ntlm_server_challenge,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, 8, ENC_NA);
|
2002-12-31 08:05:29 +00:00
|
|
|
|
|
|
|
/*
|
2004-05-04 08:30:36 +00:00
|
|
|
* Store the flags and the RC4 state information with the conversation,
|
|
|
|
* as they're needed in order to dissect subsequent messages.
|
2002-12-31 08:05:29 +00:00
|
|
|
*/
|
2010-05-13 18:28:34 +00:00
|
|
|
conversation = find_or_create_conversation(pinfo);
|
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
tvb_memcpy(tvb, tmp, offset, 8); /* challenge */
|
2009-10-06 09:13:57 +00:00
|
|
|
/* We can face more than one NTLM exchange over the same couple of IP and ports ...*/
|
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation, proto_ntlmssp);
|
2010-09-30 20:26:13 +00:00
|
|
|
/* XXX: The following code is (re)executed every time a particular frame is dissected
|
|
|
|
* (in whatever order). Thus it seems to me that "multiple exchanges" might not be
|
|
|
|
* handled well depending on the order that frames are visited after the initial dissection.
|
|
|
|
*/
|
2009-10-06 09:13:57 +00:00
|
|
|
if (!conv_ntlmssp_info || memcmp(tmp,conv_ntlmssp_info->server_challenge,8) != 0) {
|
2005-08-13 01:29:31 +00:00
|
|
|
conv_ntlmssp_info = se_alloc(sizeof(ntlmssp_info));
|
2002-12-31 08:05:29 +00:00
|
|
|
/* Insert the flags into the conversation */
|
|
|
|
conv_ntlmssp_info->flags = negotiate_flags;
|
2004-05-04 08:30:36 +00:00
|
|
|
/* Insert the RC4 state information into the conversation */
|
|
|
|
tvb_memcpy(tvb, challenge, offset, 8);
|
2009-10-06 09:13:57 +00:00
|
|
|
tvb_memcpy(tvb, conv_ntlmssp_info->server_challenge, offset, 8);
|
|
|
|
conv_ntlmssp_info->is_auth_ntlm_v2=0;
|
2002-12-31 08:05:29 +00:00
|
|
|
/* Between the challenge and the user provided password, we can build the
|
2009-10-06 14:20:59 +00:00
|
|
|
NTLMSSP key and initialize the cipher if we are not in EXTENDED SECURITY
|
2009-10-06 09:13:57 +00:00
|
|
|
in this case we need the client challenge as well*/
|
|
|
|
/* BTW this is true just if we are in LM Authentification if not the logic is a bit different.
|
2009-10-06 14:20:59 +00:00
|
|
|
* Right now it's not very clear what is LM Authentification it __seems__ to be when
|
2009-10-06 09:13:57 +00:00
|
|
|
* NEGOTIATE NT ONLY is not set and NEGOSIATE EXTENDED SECURITY is not set as well*/
|
|
|
|
if (!(conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY))
|
|
|
|
{
|
|
|
|
conv_ntlmssp_info->rc4_state_initialized = 0;
|
2010-01-19 00:37:39 +00:00
|
|
|
create_ntlmssp_v1_key(gbl_nt_password, conv_ntlmssp_info->server_challenge,NULL, sspkey,NULL,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response.contents,conv_ntlmssp_info->lm_response.contents);
|
|
|
|
if( memcmp(sspkey,gbl_zeros,NTLMSSP_KEY_LEN) != 0 ) {
|
2009-10-06 09:13:57 +00:00
|
|
|
get_sealing_rc4key(sspkey,conv_ntlmssp_info->flags,&ssp_key_len,clientkey,serverkey);
|
|
|
|
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_client, sspkey, ssp_key_len);
|
|
|
|
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_server, sspkey, ssp_key_len);
|
|
|
|
conv_ntlmssp_info->server_dest_port = pinfo->destport;
|
|
|
|
conv_ntlmssp_info->rc4_state_initialized = 1;
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
|
|
|
conversation_add_proto_data(conversation, proto_ntlmssp, conv_ntlmssp_info);
|
|
|
|
}
|
2002-07-09 20:49:27 +00:00
|
|
|
offset += 8;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
/* If no more bytes (ie: no "reserved", ...) before start of data block, then return */
|
|
|
|
/* XXX: According to Davenport "This form is seen in older Win9x-based systems" */
|
2010-09-30 20:26:13 +00:00
|
|
|
/* Also: I've seen a capture with an HTTP CONNECT proxy-authentication */
|
|
|
|
/* message wherein the challenge from the proxy has this form. */
|
2010-09-28 14:14:12 +00:00
|
|
|
if (offset >= data_start) {
|
|
|
|
return data_end;
|
|
|
|
}
|
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
/* Reserved (function not completely known) */
|
2004-08-02 20:26:16 +00:00
|
|
|
/*
|
|
|
|
* XXX - SSP key? The davenport document says
|
|
|
|
*
|
2010-10-03 19:43:14 +00:00
|
|
|
* The context field is typically populated when Negotiate Local
|
|
|
|
* Call is set. It contains an SSPI context handle, which allows
|
|
|
|
* the client to "short-circuit" authentication and effectively
|
|
|
|
* circumvent responding to the challenge. Physically, the context
|
|
|
|
* is two long values. This is covered in greater detail later,
|
|
|
|
* in the "Local Authentication" section.
|
2004-08-02 20:26:16 +00:00
|
|
|
*
|
|
|
|
* It also says that that information may be omitted.
|
|
|
|
*/
|
2002-07-09 20:49:27 +00:00
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_reserved,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, 8, ENC_NA);
|
2002-07-09 20:49:27 +00:00
|
|
|
offset += 8;
|
|
|
|
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
/*
|
|
|
|
* The presence or absence of this field is not obviously correlated
|
|
|
|
* with any flags in the previous NEGOTIATE message or in this
|
|
|
|
* message (other than the "Workstation Supplied" and "Domain
|
|
|
|
* Supplied" flags in the NEGOTIATE message, at least in the capture
|
|
|
|
* I've seen - but those also correlate with the presence of workstation
|
|
|
|
* and domain name fields, so it doesn't seem to make sense that they
|
|
|
|
* actually *indicate* whether the subsequent CHALLENGE has an
|
|
|
|
* address list).
|
|
|
|
*/
|
|
|
|
if (offset < data_start) {
|
2010-10-03 18:23:46 +00:00
|
|
|
offset = dissect_ntlmssp_challenge_target_info_blob(tvb, offset, ntlmssp_tree, &item_end);
|
2010-09-28 14:14:12 +00:00
|
|
|
/* XXX: This code assumes that the address list in the data block */
|
|
|
|
/* is always after the target name. Is this OK ? */
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
|
|
|
}
|
2002-09-10 23:44:17 +00:00
|
|
|
|
2011-05-17 02:29:43 +00:00
|
|
|
/* If there are more bytes before the data block dissect a version field
|
|
|
|
if NTLMSSP_NEGOTIATE_VERSION is set in the flags (see MS-NLMP) */
|
2010-09-28 14:14:12 +00:00
|
|
|
if (offset < data_start) {
|
2011-05-17 02:29:43 +00:00
|
|
|
if (negotiate_flags & NTLMSSP_NEGOTIATE_VERSION)
|
|
|
|
offset = dissect_ntlmssp_version(tvb, offset, ntlmssp_tree);
|
2010-09-28 14:14:12 +00:00
|
|
|
}
|
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
return MAX(offset, data_end);
|
2002-07-09 20:49:27 +00:00
|
|
|
}
|
|
|
|
|
2002-08-10 21:15:37 +00:00
|
|
|
static int
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
dissect_ntlmssp_auth (tvbuff_t *tvb, packet_info *pinfo, int offset,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_tree *ntlmssp_tree, ntlmssp_header_t *ntlmssph)
|
2002-08-10 21:15:37 +00:00
|
|
|
{
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
int item_start, item_end;
|
2002-11-08 06:02:18 +00:00
|
|
|
int data_start, data_end = 0;
|
2002-08-10 21:15:37 +00:00
|
|
|
guint32 negotiate_flags;
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 sspkey[NTLMSSP_KEY_LEN]; /* exported session key */
|
|
|
|
guint8 clientkey[NTLMSSP_KEY_LEN]; /* NTLMSSP cipher key for client */
|
|
|
|
guint8 serverkey[NTLMSSP_KEY_LEN]; /* NTLMSSP cipher key for server*/
|
|
|
|
guint8 encryptedsessionkey[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
ntlmssp_blob sessionblob;
|
2002-08-10 21:15:37 +00:00
|
|
|
gboolean unicode_strings = FALSE;
|
2009-10-06 09:13:57 +00:00
|
|
|
ntlmssp_info *conv_ntlmssp_info = NULL;
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
conversation_t *conversation;
|
2009-10-06 09:13:57 +00:00
|
|
|
int ssp_key_len;
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
/*
|
|
|
|
* Get flag info from the original negotiate message, if any.
|
2002-11-08 06:02:18 +00:00
|
|
|
* This is because the flag information is sometimes missing from
|
|
|
|
* the AUTHENTICATE message, so we can't figure out whether
|
|
|
|
* strings are Unicode or not by looking at *our* flags.
|
2009-10-06 09:13:57 +00:00
|
|
|
* XXX it seems it's more from the CHALLENGE message, which is more clever in fact
|
|
|
|
* because the server can change some flags.
|
2009-10-06 14:20:59 +00:00
|
|
|
* But according to MS NTLMSSP doc it's not that simple.
|
2009-10-06 09:13:57 +00:00
|
|
|
* In case of Conection less mode AUTHENTICATE flags should be used because they
|
2009-10-06 14:20:59 +00:00
|
|
|
* reprensent the choice of the client after having been informed of options of the
|
2009-10-06 09:13:57 +00:00
|
|
|
* server in the CHALLENGE message.
|
|
|
|
* In Connection mode then the CHALLENGE flags should (must ?) be used
|
2010-09-30 20:26:13 +00:00
|
|
|
* XXX: MS-NLMP says the flag field in the AUTHENTICATE message "contains the set of bit
|
|
|
|
* flags (section 2.2.2.5) negotiated in the previous messages."
|
|
|
|
* I read that to mean that the flags for in connection-mode AUTHENTICATE also represent
|
|
|
|
* the choice of the client (for the flags which are negotiated).
|
|
|
|
* XXX: In the absence of CHALLENGE flags, as a last resort we'll use the flags
|
|
|
|
* (if available) from this AUTHENTICATE message.
|
|
|
|
* I've seen a capture which does an HTTP CONNECT which:
|
|
|
|
* - has the NEGOTIATE & CHALLENGE messages in one TCP connection;
|
|
|
|
* - has the AUTHENTICATE message in a second TCP connection;
|
|
|
|
* (The authentication aparently succeeded).
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
*/
|
2002-12-31 08:05:29 +00:00
|
|
|
conv_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
|
|
|
|
if (conv_ntlmssp_info == NULL) {
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
/*
|
|
|
|
* There isn't any. Is there any from this conversation? If so,
|
|
|
|
* it means this is the first time we've dissected this frame, so
|
|
|
|
* we should give it flag info.
|
|
|
|
*/
|
2010-10-03 18:23:46 +00:00
|
|
|
/* XXX: Create conv_ntlmssp_info & etc if no previous CHALLENGE seen */
|
|
|
|
/* so we'll have a place to store flags. */
|
|
|
|
/* This is a bit brute-force but looks like it will be OK. */
|
2010-09-30 20:26:13 +00:00
|
|
|
conversation = find_or_create_conversation(pinfo);
|
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation, proto_ntlmssp);
|
|
|
|
if (conv_ntlmssp_info == NULL) {
|
|
|
|
conv_ntlmssp_info = se_alloc0(sizeof(ntlmssp_info));
|
|
|
|
conversation_add_proto_data(conversation, proto_ntlmssp, conv_ntlmssp_info);
|
|
|
|
}
|
|
|
|
/* XXX: The *conv_ntlmssp_info struct attached to the frame is the
|
|
|
|
same as the one attached to the conversation. That is: *both* point to
|
|
|
|
the exact same struct in memory. Is this what is indended ? */
|
|
|
|
p_add_proto_data(pinfo->fd, proto_ntlmssp, conv_ntlmssp_info);
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
}
|
2010-09-30 20:26:13 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
if (conv_ntlmssp_info != NULL) {
|
|
|
|
if (conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_UNICODE)
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
unicode_strings = TRUE;
|
|
|
|
}
|
2002-08-10 21:15:37 +00:00
|
|
|
|
2002-11-08 06:02:18 +00:00
|
|
|
/*
|
|
|
|
* Sometimes the session key and flags are missing.
|
2009-10-06 14:20:59 +00:00
|
|
|
* Sometimes the session key is present but the flags are missing.
|
|
|
|
* XXX Who stay so ? Reading spec I would rather say the opposite: flags are
|
|
|
|
* always present, session information are always there as well but sometime
|
2009-10-06 09:13:57 +00:00
|
|
|
* session information could be null (in case of no session)
|
2002-11-08 06:02:18 +00:00
|
|
|
* Sometimes they're both present.
|
|
|
|
*
|
|
|
|
* This does not correlate with any flags in the previous CHALLENGE
|
|
|
|
* message, and only correlates with "Negotiate Unicode", "Workstation
|
|
|
|
* Supplied", and "Domain Supplied" in the NEGOTIATE message - but
|
|
|
|
* those don't make sense as flags to use to determine this.
|
|
|
|
*
|
|
|
|
* So we check all of the descriptors to figure out where the data
|
|
|
|
* area begins, and if the session key or the flags would be in the
|
|
|
|
* middle of the data area, we assume the field in question is
|
|
|
|
* missing.
|
2010-09-28 14:14:12 +00:00
|
|
|
*
|
|
|
|
* XXX - Reading Davenport and MS-NLMP: as I see it the possibilities are:
|
|
|
|
* a. No session-key; no flags; no version ("Win9x")
|
|
|
|
* b. Session-key & flags.
|
|
|
|
* c. Session-key, flags & version.
|
|
|
|
* In cases b and c the session key may be "null".
|
|
|
|
*
|
2002-11-08 06:02:18 +00:00
|
|
|
*/
|
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
/* Lan Manager response */
|
2002-11-08 06:02:18 +00:00
|
|
|
data_start = tvb_get_letohl(tvb, offset+4);
|
2002-09-10 23:44:17 +00:00
|
|
|
offset = dissect_ntlmssp_blob(tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_auth_lmresponse,
|
|
|
|
&item_end,
|
|
|
|
conv_ntlmssp_info == NULL ? NULL :
|
|
|
|
&conv_ntlmssp_info->lm_response);
|
2002-09-10 23:44:17 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
/* NTLM response */
|
2002-11-08 06:02:18 +00:00
|
|
|
item_start = tvb_get_letohl(tvb, offset+4);
|
2003-05-09 01:41:28 +00:00
|
|
|
offset = dissect_ntlmssp_blob(tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_auth_ntresponse,
|
|
|
|
&item_end,
|
|
|
|
conv_ntlmssp_info == NULL ? NULL :
|
|
|
|
&conv_ntlmssp_info->ntlm_response);
|
2009-10-06 09:13:57 +00:00
|
|
|
if( conv_ntlmssp_info != NULL && conv_ntlmssp_info->ntlm_response.length > 24 ) {
|
|
|
|
memcpy(conv_ntlmssp_info->client_challenge,conv_ntlmssp_info->ntlm_response.contents+32,8);
|
|
|
|
}
|
2002-11-08 06:02:18 +00:00
|
|
|
data_start = MIN(data_start, item_start);
|
2002-09-10 23:44:17 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
2009-10-06 09:13:57 +00:00
|
|
|
if( conv_ntlmssp_info != NULL )
|
|
|
|
{
|
|
|
|
if( conv_ntlmssp_info->ntlm_response.length > 24 )
|
|
|
|
{
|
|
|
|
conv_ntlmssp_info->is_auth_ntlm_v2=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
conv_ntlmssp_info->is_auth_ntlm_v2=0;
|
|
|
|
}
|
|
|
|
}
|
2002-09-10 23:44:17 +00:00
|
|
|
|
|
|
|
/* domain name */
|
2002-11-08 06:02:18 +00:00
|
|
|
item_start = tvb_get_letohl(tvb, offset+4);
|
2007-01-09 22:14:07 +00:00
|
|
|
offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
unicode_strings,
|
|
|
|
hf_ntlmssp_auth_domain,
|
|
|
|
&item_start, &item_end, &(ntlmssph->domain_name));
|
2009-10-06 09:13:57 +00:00
|
|
|
/*ntlmssph->domain_name_len=item_end-item_start;*/
|
2002-11-08 06:02:18 +00:00
|
|
|
data_start = MIN(data_start, item_start);
|
2002-09-10 23:44:17 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
|
|
|
|
|
|
|
/* user name */
|
2002-11-08 06:02:18 +00:00
|
|
|
item_start = tvb_get_letohl(tvb, offset+4);
|
2007-01-09 22:14:07 +00:00
|
|
|
offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
unicode_strings,
|
|
|
|
hf_ntlmssp_auth_username,
|
|
|
|
&item_start, &item_end, &(ntlmssph->acct_name));
|
2009-10-06 09:13:57 +00:00
|
|
|
/*ntlmssph->acct_name_len=item_end-item_start;*/
|
2002-11-08 06:02:18 +00:00
|
|
|
data_start = MIN(data_start, item_start);
|
2002-09-10 23:44:17 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
|
|
|
|
2011-09-30 15:21:16 +00:00
|
|
|
col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ", "User: %s\\%s",
|
2010-10-08 17:48:22 +00:00
|
|
|
ntlmssph->domain_name, ntlmssph->acct_name);
|
2005-07-11 22:48:51 +00:00
|
|
|
|
2002-09-10 23:44:17 +00:00
|
|
|
/* hostname */
|
2002-11-08 06:02:18 +00:00
|
|
|
item_start = tvb_get_letohl(tvb, offset+4);
|
2007-01-09 22:14:07 +00:00
|
|
|
offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
unicode_strings,
|
|
|
|
hf_ntlmssp_auth_hostname,
|
|
|
|
&item_start, &item_end, &(ntlmssph->host_name));
|
2002-11-08 06:02:18 +00:00
|
|
|
data_start = MIN(data_start, item_start);
|
2002-09-10 23:44:17 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
2010-09-28 14:14:12 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
memset(sessionblob.contents, 0, MAX_BLOB_SIZE);
|
|
|
|
sessionblob.length = 0;
|
2002-11-08 06:02:18 +00:00
|
|
|
if (offset < data_start) {
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
/* Session Key */
|
|
|
|
offset = dissect_ntlmssp_blob(tvb, offset, ntlmssp_tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_auth_sesskey,
|
|
|
|
&item_end, &sessionblob);
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
data_end = MAX(data_end, item_end);
|
2002-11-08 06:02:18 +00:00
|
|
|
}
|
2010-09-28 14:14:12 +00:00
|
|
|
|
|
|
|
if (offset < data_start) {
|
|
|
|
/* NTLMSSP Negotiate Flags */
|
|
|
|
negotiate_flags = tvb_get_letohl (tvb, offset);
|
|
|
|
offset = dissect_ntlmssp_negotiate_flags (tvb, offset, ntlmssp_tree,
|
|
|
|
negotiate_flags);
|
2010-09-30 20:26:13 +00:00
|
|
|
/* If no previous flags seen (ie: no previous CHALLENGE) use flags
|
|
|
|
from the AUTHENTICATE message).
|
|
|
|
Assumption: (flags == 0) means flags not previously seen */
|
|
|
|
if ((conv_ntlmssp_info != NULL) && (conv_ntlmssp_info->flags == 0)) {
|
|
|
|
conv_ntlmssp_info->flags = negotiate_flags;
|
|
|
|
}
|
2011-05-17 02:29:43 +00:00
|
|
|
} else
|
|
|
|
negotiate_flags = 0;
|
2010-09-28 14:14:12 +00:00
|
|
|
|
2011-05-17 02:29:43 +00:00
|
|
|
/* If there are more bytes before the data block dissect a version field
|
|
|
|
if NTLMSSP_NEGOTIATE_VERSION is set in the flags (see MS-NLMP) */
|
2010-09-28 14:14:12 +00:00
|
|
|
if (offset < data_start) {
|
2011-05-17 02:29:43 +00:00
|
|
|
if (negotiate_flags & NTLMSSP_NEGOTIATE_VERSION)
|
|
|
|
offset = dissect_ntlmssp_version(tvb, offset, ntlmssp_tree);
|
2010-09-28 14:14:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If there are still more bytes before the data block dissect an MIC (message integrity_code) field */
|
|
|
|
/* (See MS-NLMP) */
|
|
|
|
if (offset < data_start) {
|
|
|
|
proto_tree_add_item(ntlmssp_tree, hf_ntlmssp_message_integrity_code, tvb, offset, 16, ENC_NA);
|
|
|
|
offset += 16;
|
|
|
|
}
|
|
|
|
|
2009-11-16 17:08:12 +00:00
|
|
|
if ( sessionblob.length > NTLMSSP_KEY_LEN ) {
|
|
|
|
expert_add_info_format(pinfo, NULL, PI_WARN, PI_UNDECODED, "Session blob length too long: %u", sessionblob.length);
|
|
|
|
} else if( sessionblob.length != 0 ) {
|
2009-10-06 09:13:57 +00:00
|
|
|
memcpy(encryptedsessionkey,sessionblob.contents,sessionblob.length);
|
|
|
|
/* Try to attach to an existing conversation if not then it's useless to try to do so
|
|
|
|
* because we are missing important information (ie. server challenge)
|
|
|
|
*/
|
|
|
|
if (conv_ntlmssp_info) {
|
|
|
|
/* If we are in EXTENDED SECURITY then we can now initialize cipher */
|
|
|
|
if ((conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY))
|
|
|
|
{
|
|
|
|
conv_ntlmssp_info->rc4_state_initialized = 0;
|
|
|
|
if( conv_ntlmssp_info->is_auth_ntlm_v2 ) {
|
2011-03-22 12:12:04 +00:00
|
|
|
create_ntlmssp_v2_key(gbl_nt_password, conv_ntlmssp_info->server_challenge,conv_ntlmssp_info->client_challenge, sspkey,encryptedsessionkey,conv_ntlmssp_info->flags,&conv_ntlmssp_info->ntlm_response,&conv_ntlmssp_info->lm_response,ntlmssph);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(conv_ntlmssp_info->client_challenge,conv_ntlmssp_info->lm_response.contents,8);
|
2010-01-19 00:37:39 +00:00
|
|
|
create_ntlmssp_v1_key(gbl_nt_password, conv_ntlmssp_info->server_challenge,conv_ntlmssp_info->client_challenge, sspkey,encryptedsessionkey,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response.contents,conv_ntlmssp_info->lm_response.contents);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
/* ssp is the exported session key */
|
2010-01-19 00:37:39 +00:00
|
|
|
if( memcmp(sspkey,gbl_zeros,NTLMSSP_KEY_LEN) != 0) {
|
2009-10-06 09:13:57 +00:00
|
|
|
get_sealing_rc4key(sspkey,conv_ntlmssp_info->flags,&ssp_key_len,clientkey,serverkey);
|
|
|
|
get_siging_key((guint8*)&conv_ntlmssp_info->sign_key_server,(guint8*)&conv_ntlmssp_info->sign_key_client,sspkey,ssp_key_len);
|
|
|
|
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_server, serverkey, ssp_key_len);
|
2009-10-06 14:20:59 +00:00
|
|
|
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_client, clientkey, ssp_key_len);
|
2009-10-06 09:13:57 +00:00
|
|
|
conv_ntlmssp_info->server_dest_port = pinfo->destport;
|
|
|
|
conv_ntlmssp_info->rc4_state_initialized = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
return MAX(offset, data_end);
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
static guint8*
|
|
|
|
get_sign_key(packet_info *pinfo, int cryptpeer)
|
|
|
|
{
|
|
|
|
conversation_t *conversation;
|
|
|
|
ntlmssp_info *conv_ntlmssp_info;
|
2002-08-10 21:15:37 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
2010-10-03 18:51:38 +00:00
|
|
|
pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conversation == NULL) {
|
|
|
|
/* We don't have a conversation. In this case, stop processing
|
|
|
|
because we do not have enough info to decrypt the payload */
|
|
|
|
return NULL;
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
else {
|
|
|
|
/* We have a conversation, check for encryption state */
|
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conv_ntlmssp_info == NULL) {
|
|
|
|
/* No encryption state tied to the conversation. Therefore, we
|
2010-10-03 19:43:14 +00:00
|
|
|
cannot decrypt the payload */
|
2009-10-06 09:13:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* We have the encryption state in the conversation. So return the
|
2010-10-03 19:43:14 +00:00
|
|
|
crypt state tied to the requested peer
|
2009-10-06 09:13:57 +00:00
|
|
|
*/
|
|
|
|
if (cryptpeer == 1) {
|
2010-10-03 19:43:14 +00:00
|
|
|
return (guint8*)&conv_ntlmssp_info->sign_key_client;
|
2009-10-06 09:13:57 +00:00
|
|
|
} else {
|
2010-10-03 19:43:14 +00:00
|
|
|
return (guint8*)&conv_ntlmssp_info->sign_key_server;
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/*
|
|
|
|
* Get the encryption state tied to this conversation. cryptpeer indicates
|
2009-10-06 14:20:59 +00:00
|
|
|
* whether to retrieve the client key (1) or the server key (0)
|
2009-10-06 09:13:57 +00:00
|
|
|
*/
|
|
|
|
static rc4_state_struct *
|
|
|
|
get_encrypted_state(packet_info *pinfo, int cryptpeer)
|
|
|
|
{
|
|
|
|
conversation_t *conversation;
|
|
|
|
ntlmssp_info *conv_ntlmssp_info;
|
2002-08-10 21:15:37 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
2010-10-03 18:51:38 +00:00
|
|
|
pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conversation == NULL) {
|
|
|
|
/* We don't have a conversation. In this case, stop processing
|
|
|
|
because we do not have enough info to decrypt the payload */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* We have a conversation, check for encryption state */
|
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conv_ntlmssp_info == NULL) {
|
|
|
|
/* No encryption state tied to the conversation. Therefore, we
|
2010-10-03 19:43:14 +00:00
|
|
|
cannot decrypt the payload */
|
2009-10-06 09:13:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* We have the encryption state in the conversation. So return the
|
2010-10-03 19:43:14 +00:00
|
|
|
crypt state tied to the requested peer
|
2009-10-06 09:13:57 +00:00
|
|
|
*/
|
|
|
|
if (cryptpeer == 1) {
|
2010-10-03 19:43:14 +00:00
|
|
|
return &conv_ntlmssp_info->rc4_state_client;
|
2009-10-06 09:13:57 +00:00
|
|
|
} else {
|
2010-10-03 19:43:14 +00:00
|
|
|
return &conv_ntlmssp_info->rc4_state_server;
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
|
|
|
static void
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
|
2010-10-03 18:51:38 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree _U_,gpointer key);
|
2009-10-06 09:13:57 +00:00
|
|
|
static void
|
|
|
|
decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
|
2010-10-03 18:51:38 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree,gpointer key);
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
#if 0
|
2010-10-03 19:43:14 +00:00
|
|
|
static tvbuff_t *
|
2009-10-06 09:13:57 +00:00
|
|
|
dissect_ntlmssp_encrypted_payload(tvbuff_t *data_tvb,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvbuff_t *auth_tvb _U_,
|
|
|
|
int offset,
|
|
|
|
packet_info *pinfo,
|
|
|
|
dcerpc_auth_info *auth_info _U_)
|
|
|
|
#endif
|
2009-10-06 09:13:57 +00:00
|
|
|
|
2010-10-03 19:43:14 +00:00
|
|
|
static int
|
2009-10-06 09:13:57 +00:00
|
|
|
dissect_ntlmssp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
|
|
|
|
{
|
|
|
|
volatile int offset = 0;
|
|
|
|
proto_tree *volatile ntlmssp_tree = NULL;
|
|
|
|
proto_item *tf = NULL;
|
|
|
|
guint32 length;
|
|
|
|
guint32 encrypted_block_length;
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 key[NTLMSSP_KEY_LEN];
|
2009-10-06 09:13:57 +00:00
|
|
|
/* the magic ntlm is the identifier of a NTLMSSP packet that's 00 00 00 01
|
|
|
|
*/
|
|
|
|
guint32 ntlm_magic_size = 4;
|
|
|
|
guint32 ntlm_signature_size = 8;
|
|
|
|
guint32 ntlm_seq_size = 4;
|
2010-10-08 17:48:22 +00:00
|
|
|
void *pd_save;
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
length = tvb_length (tvb);
|
|
|
|
/* signature + seq + real payload */
|
|
|
|
encrypted_block_length = length - ntlm_magic_size;
|
|
|
|
|
|
|
|
if (encrypted_block_length < (ntlm_signature_size + ntlm_seq_size)) {
|
|
|
|
/* Don't know why this would happen, but if it does, don't even bother
|
|
|
|
attempting decryption/dissection */
|
|
|
|
return offset + length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup a new tree for the NTLMSSP payload */
|
|
|
|
if (tree) {
|
|
|
|
tf = proto_tree_add_item (tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_verf,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, -1, ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
|
|
|
|
ntlmssp_tree = proto_item_add_subtree (tf,
|
2010-10-03 18:51:38 +00:00
|
|
|
ett_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Catch the ReportedBoundsError exception; the stuff we've been
|
|
|
|
* handed doesn't necessarily run to the end of the packet, it's
|
|
|
|
* an item inside a packet, so if it happens to be malformed (or
|
|
|
|
* we, or a dissector we call, has a bug), so that an exception
|
|
|
|
* is thrown, we want to report the error, but return and let
|
|
|
|
* our caller dissect the rest of the packet.
|
|
|
|
*
|
|
|
|
* If it gets a BoundsError, we can stop, as there's nothing more
|
|
|
|
* in the packet after our blob to see, so we just re-throw the
|
|
|
|
* exception.
|
|
|
|
*/
|
2010-10-08 17:48:22 +00:00
|
|
|
pd_save = pinfo->private_data;
|
2009-10-06 09:13:57 +00:00
|
|
|
TRY {
|
|
|
|
/* Version number */
|
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_vers,
|
2011-10-06 03:35:44 +00:00
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
2009-10-06 09:13:57 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* Encrypted body */
|
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_body,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, ntlm_signature_size + ntlm_seq_size, ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
tvb_memcpy(tvb, key, offset, ntlm_signature_size + ntlm_seq_size);
|
|
|
|
/* Try to decrypt */
|
|
|
|
decrypt_data_payload (tvb, offset+(ntlm_signature_size + ntlm_seq_size), encrypted_block_length-(ntlm_signature_size + ntlm_seq_size), pinfo, ntlmssp_tree,key);
|
|
|
|
decrypt_verifier (tvb, offset, ntlm_signature_size + ntlm_seq_size, pinfo, ntlmssp_tree,key);
|
|
|
|
/* let's try to hook ourselves here */
|
|
|
|
|
|
|
|
offset += 12;
|
|
|
|
} CATCH(BoundsError) {
|
|
|
|
RETHROW;
|
|
|
|
} CATCH(ReportedBoundsError) {
|
2010-10-08 17:48:22 +00:00
|
|
|
/* Restore the private_data structure in case one of the
|
|
|
|
* called dissectors modified it (and, due to the exception,
|
|
|
|
* was unable to restore it).
|
|
|
|
*/
|
|
|
|
pinfo->private_data = pd_save;
|
2009-10-06 09:13:57 +00:00
|
|
|
show_reported_bounds_error(tvb, pinfo, tree);
|
|
|
|
} ENDTRY;
|
|
|
|
|
|
|
|
return offset;
|
2002-08-10 21:15:37 +00:00
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
|
|
|
static void
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
|
2010-10-03 18:51:38 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree _U_,gpointer key)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
|
|
|
tvbuff_t *decr_tvb; /* Used to display decrypted buffer */
|
|
|
|
guint8 *peer_block;
|
|
|
|
conversation_t *conversation;
|
|
|
|
rc4_state_struct *rc4_state;
|
|
|
|
rc4_state_struct *rc4_state_peer;
|
|
|
|
ntlmssp_info *conv_ntlmssp_info = NULL;
|
|
|
|
ntlmssp_packet_info *packet_ntlmssp_info = NULL;
|
|
|
|
ntlmssp_packet_info *stored_packet_ntlmssp_info = NULL;
|
2002-07-09 20:49:27 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Check to see if we already have state for this packet */
|
|
|
|
packet_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
|
|
|
|
if (packet_ntlmssp_info == NULL) {
|
|
|
|
/* We don't have any packet state, so create one */
|
2009-10-25 11:43:30 +00:00
|
|
|
packet_ntlmssp_info = se_alloc0(sizeof(ntlmssp_packet_info));
|
2009-10-06 09:13:57 +00:00
|
|
|
p_add_proto_data(pinfo->fd, proto_ntlmssp, packet_ntlmssp_info);
|
|
|
|
}
|
|
|
|
if (!packet_ntlmssp_info->payload_decrypted) {
|
|
|
|
/* Pull the challenge info from the conversation */
|
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
2010-10-03 18:51:38 +00:00
|
|
|
pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conversation == NULL) {
|
|
|
|
/* There is no conversation, thus no encryption state */
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conv_ntlmssp_info == NULL) {
|
|
|
|
/* There is no NTLMSSP state tied to the conversation */
|
2010-10-03 19:43:14 +00:00
|
|
|
return ;
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
if (conv_ntlmssp_info->rc4_state_initialized != 1 ) {
|
2010-10-03 19:43:14 +00:00
|
|
|
/* The crypto sybsystem is not initialized. This means that either
|
|
|
|
the conversation did not include a challenge, or that we do not have the right password */
|
|
|
|
return;
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
if( key != NULL ){
|
|
|
|
stored_packet_ntlmssp_info = g_hash_table_lookup(hash_packet,key);
|
|
|
|
}
|
|
|
|
if( stored_packet_ntlmssp_info != NULL && stored_packet_ntlmssp_info->payload_decrypted == TRUE)
|
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
/* Mat TBD (stderr,"Found a already decrypted packet\n");*/
|
2009-10-06 09:13:57 +00:00
|
|
|
memcpy(packet_ntlmssp_info,stored_packet_ntlmssp_info,sizeof(ntlmssp_packet_info));
|
|
|
|
/* Mat TBD printnbyte(packet_ntlmssp_info->decrypted_payload,encrypted_block_length,"Data: ","\n");*/
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Get the pair of RC4 state structures. One is used for to decrypt the
|
|
|
|
payload. The other is used to re-encrypt the payload to represent
|
|
|
|
the peer */
|
|
|
|
if (conv_ntlmssp_info->server_dest_port == pinfo->destport) {
|
|
|
|
/* client */
|
|
|
|
rc4_state = get_encrypted_state(pinfo, 1);
|
|
|
|
rc4_state_peer = get_encrypted_state(pinfo, 0);
|
|
|
|
} else {
|
|
|
|
/* server */
|
|
|
|
rc4_state = get_encrypted_state(pinfo, 0);
|
|
|
|
rc4_state_peer = get_encrypted_state(pinfo, 1);
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
if (rc4_state == NULL ) {
|
|
|
|
/* There is no encryption state, so we cannot decrypt */
|
|
|
|
return ;
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Store the decrypted contents in the packet state struct
|
|
|
|
(of course at this point, they aren't decrypted yet) */
|
|
|
|
packet_ntlmssp_info->decrypted_payload = tvb_memdup(tvb, offset,
|
|
|
|
encrypted_block_length);
|
|
|
|
packet_ntlmssp_info->payload_len = encrypted_block_length;
|
|
|
|
decrypted_payloads = g_slist_prepend(decrypted_payloads,
|
|
|
|
packet_ntlmssp_info->decrypted_payload);
|
|
|
|
if( key != NULL ) {
|
|
|
|
g_hash_table_insert(hash_packet,key,packet_ntlmssp_info);
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Do the decryption of the payload */
|
|
|
|
crypt_rc4(rc4_state, packet_ntlmssp_info->decrypted_payload,
|
2010-10-03 19:43:14 +00:00
|
|
|
encrypted_block_length);
|
2009-10-06 09:13:57 +00:00
|
|
|
/* decrypt the verifier */
|
|
|
|
/*printnchar(packet_ntlmssp_info->decrypted_payload,encrypted_block_length,"data: ","\n");*/
|
|
|
|
/* We setup a temporary buffer so we can re-encrypt the payload after
|
2009-10-06 14:20:59 +00:00
|
|
|
decryption. This is to update the opposite peer's RC4 state
|
2009-10-06 09:13:57 +00:00
|
|
|
it's usefull when we have only one key for both conversation
|
|
|
|
in case of KEY_EXCH we have independant key so this is not needed*/
|
|
|
|
if( !(NTLMSSP_NEGOTIATE_KEY_EXCH & conv_ntlmssp_info->flags)) {
|
2009-10-25 11:43:30 +00:00
|
|
|
peer_block = ep_memdup(packet_ntlmssp_info->decrypted_payload, encrypted_block_length);
|
2009-10-06 09:13:57 +00:00
|
|
|
crypt_rc4(rc4_state_peer, peer_block, encrypted_block_length);
|
2009-10-06 14:20:59 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
packet_ntlmssp_info->payload_decrypted = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Show the decrypted buffer in a new window */
|
2011-12-13 04:01:33 +00:00
|
|
|
decr_tvb = tvb_new_child_real_data(tvb, packet_ntlmssp_info->decrypted_payload,
|
|
|
|
encrypted_block_length,
|
|
|
|
encrypted_block_length);
|
2009-10-06 09:13:57 +00:00
|
|
|
|
|
|
|
pinfo->gssapi_decrypted_tvb = decr_tvb;
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
static void
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2002-07-09 20:49:27 +00:00
|
|
|
{
|
2002-08-31 20:25:43 +00:00
|
|
|
volatile int offset = 0;
|
|
|
|
proto_tree *volatile ntlmssp_tree = NULL;
|
2002-07-09 20:49:27 +00:00
|
|
|
proto_item *tf = NULL;
|
2009-10-06 14:20:59 +00:00
|
|
|
ntlmssp_header_t *ntlmssph;
|
2010-10-08 17:48:22 +00:00
|
|
|
void *pd_save;
|
2005-12-07 13:09:42 +00:00
|
|
|
|
|
|
|
ntlmssph=ep_alloc(sizeof(ntlmssp_header_t));
|
|
|
|
ntlmssph->type=0;
|
|
|
|
ntlmssph->domain_name=NULL;
|
|
|
|
ntlmssph->acct_name=NULL;
|
|
|
|
ntlmssph->host_name=NULL;
|
2002-07-09 20:49:27 +00:00
|
|
|
|
|
|
|
/* Setup a new tree for the NTLMSSP payload */
|
|
|
|
if (tree) {
|
2002-08-28 21:04:11 +00:00
|
|
|
tf = proto_tree_add_item (tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_ntlmssp,
|
2011-10-21 02:10:19 +00:00
|
|
|
tvb, offset, -1, ENC_NA);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
|
|
|
ntlmssp_tree = proto_item_add_subtree (tf,
|
2010-10-03 18:51:38 +00:00
|
|
|
ett_ntlmssp);
|
2002-07-09 20:49:27 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-08-31 20:25:43 +00:00
|
|
|
/*
|
|
|
|
* Catch the ReportedBoundsError exception; the stuff we've been
|
|
|
|
* handed doesn't necessarily run to the end of the packet, it's
|
|
|
|
* an item inside a packet, so if it happens to be malformed (or
|
|
|
|
* we, or a dissector we call, has a bug), so that an exception
|
|
|
|
* is thrown, we want to report the error, but return and let
|
|
|
|
* our caller dissect the rest of the packet.
|
|
|
|
*
|
|
|
|
* If it gets a BoundsError, we can stop, as there's nothing more
|
|
|
|
* in the packet after our blob to see, so we just re-throw the
|
|
|
|
* exception.
|
|
|
|
*/
|
2010-10-08 17:48:22 +00:00
|
|
|
pd_save = pinfo->private_data;
|
2002-08-31 20:25:43 +00:00
|
|
|
TRY {
|
|
|
|
/* NTLMSSP constant */
|
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_auth,
|
2011-10-15 18:46:26 +00:00
|
|
|
tvb, offset, 8, ENC_ASCII|ENC_NA);
|
2002-08-31 20:25:43 +00:00
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
/* NTLMSSP Message Type */
|
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_message_type,
|
2011-10-06 03:35:44 +00:00
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
2005-12-07 13:09:42 +00:00
|
|
|
ntlmssph->type = tvb_get_letohl (tvb, offset);
|
2007-01-09 22:14:07 +00:00
|
|
|
offset += 4;
|
2002-08-31 20:25:43 +00:00
|
|
|
|
2011-09-30 15:21:16 +00:00
|
|
|
col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ","%s",
|
2010-10-08 17:48:22 +00:00
|
|
|
val_to_str(ntlmssph->type,
|
|
|
|
ntlmssp_message_types,
|
|
|
|
"Unknown message type"));
|
2002-09-24 00:14:46 +00:00
|
|
|
|
2002-08-31 20:25:43 +00:00
|
|
|
/* Call the appropriate dissector based on the Message Type */
|
2005-12-07 13:09:42 +00:00
|
|
|
switch (ntlmssph->type) {
|
2002-08-31 20:25:43 +00:00
|
|
|
|
|
|
|
case NTLMSSP_NEGOTIATE:
|
2005-12-07 13:09:42 +00:00
|
|
|
offset = dissect_ntlmssp_negotiate (tvb, offset, ntlmssp_tree, ntlmssph);
|
2002-08-31 20:25:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NTLMSSP_CHALLENGE:
|
2005-12-07 13:09:42 +00:00
|
|
|
offset = dissect_ntlmssp_challenge (tvb, pinfo, offset, ntlmssp_tree, ntlmssph);
|
2002-08-31 20:25:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NTLMSSP_AUTH:
|
2005-12-07 13:09:42 +00:00
|
|
|
offset = dissect_ntlmssp_auth (tvb, pinfo, offset, ntlmssp_tree, ntlmssph);
|
2002-08-31 20:25:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* Unrecognized message type */
|
|
|
|
proto_tree_add_text (ntlmssp_tree, tvb, offset, -1,
|
2010-10-03 18:51:38 +00:00
|
|
|
"Unrecognized NTLMSSP Message");
|
2002-08-31 20:25:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} CATCH(BoundsError) {
|
|
|
|
RETHROW;
|
|
|
|
} CATCH(ReportedBoundsError) {
|
2010-10-08 17:48:22 +00:00
|
|
|
/* Restore the private_data structure in case one of the
|
|
|
|
* called dissectors modified it (and, due to the exception,
|
|
|
|
* was unable to restore it).
|
|
|
|
*/
|
|
|
|
pinfo->private_data = pd_save;
|
2002-08-31 20:25:43 +00:00
|
|
|
show_reported_bounds_error(tvb, pinfo, tree);
|
|
|
|
} ENDTRY;
|
2005-12-07 13:09:42 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/*tap_queue_packet(ntlmssp_tap, pinfo, ntlmssph);*/
|
2002-07-09 20:49:27 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 15:21:16 +00:00
|
|
|
static gboolean
|
|
|
|
dissect_ntlmssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(tvb_memeql(tvb, 0, "NTLMSSP", 8) == 0) {
|
|
|
|
|
|
|
|
dissect_ntlmssp(tvb, pinfo, parent_tree);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2011-09-30 15:21:16 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
|
|
|
|
|
2002-11-10 09:38:22 +00:00
|
|
|
/*
|
|
|
|
* See page 45 of "DCE/RPC over SMB" by Luke Kenneth Casson Leighton.
|
|
|
|
*/
|
2002-12-31 08:05:29 +00:00
|
|
|
static void
|
|
|
|
decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
|
2010-10-03 18:51:38 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree,gpointer key)
|
2002-12-31 08:05:29 +00:00
|
|
|
{
|
|
|
|
proto_tree *decr_tree = NULL;
|
|
|
|
proto_item *tf = NULL;
|
|
|
|
conversation_t *conversation;
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8* sign_key;
|
2002-12-31 08:05:29 +00:00
|
|
|
rc4_state_struct *rc4_state;
|
|
|
|
rc4_state_struct *rc4_state_peer;
|
|
|
|
tvbuff_t *decr_tvb; /* Used to display decrypted buffer */
|
|
|
|
guint8 *peer_block;
|
2009-10-06 09:13:57 +00:00
|
|
|
guint8 *check_buf;
|
2009-11-16 17:08:12 +00:00
|
|
|
guint8 calculated_md5[NTLMSSP_KEY_LEN];
|
2002-12-31 08:05:29 +00:00
|
|
|
ntlmssp_info *conv_ntlmssp_info = NULL;
|
|
|
|
ntlmssp_packet_info *packet_ntlmssp_info = NULL;
|
|
|
|
int decrypted_offset = 0;
|
2009-10-06 09:13:57 +00:00
|
|
|
int sequence = 0;
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
ntlmssp_packet_info *stored_packet_ntlmssp_info = NULL;
|
2002-12-31 08:05:29 +00:00
|
|
|
packet_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
|
|
|
|
if (packet_ntlmssp_info == NULL) {
|
|
|
|
/* We don't have data for this packet */
|
|
|
|
return;
|
|
|
|
}
|
2009-10-06 09:13:57 +00:00
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
2010-10-03 18:51:38 +00:00
|
|
|
pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conversation == NULL) {
|
|
|
|
/* There is no conversation, thus no encryption state */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conv_ntlmssp_info == NULL) {
|
|
|
|
/* There is no NTLMSSP state tied to the conversation */
|
|
|
|
return;
|
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
if( key != NULL ){
|
|
|
|
stored_packet_ntlmssp_info = g_hash_table_lookup(hash_packet,key);
|
|
|
|
}
|
|
|
|
if( stored_packet_ntlmssp_info != NULL && stored_packet_ntlmssp_info->verifier_decrypted == TRUE) {
|
|
|
|
/* Mat TBD fprintf(stderr,"Found a already decrypted packet\n");*/
|
|
|
|
/* In Theory it's aleady the case, and we should be more clever ... like just copying buffers ...*/
|
|
|
|
packet_ntlmssp_info = stored_packet_ntlmssp_info;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!packet_ntlmssp_info->verifier_decrypted) {
|
|
|
|
if (conv_ntlmssp_info->rc4_state_initialized != 1 ) {
|
|
|
|
/* The crypto sybsystem is not initialized. This means that either
|
2010-10-03 19:43:14 +00:00
|
|
|
the conversation did not include a challenge, or we are doing
|
|
|
|
something other than NTLMSSP v1 */
|
2009-10-06 09:13:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (conv_ntlmssp_info->server_dest_port == pinfo->destport) {
|
|
|
|
/* client talk to server */
|
|
|
|
rc4_state = get_encrypted_state(pinfo, 1);
|
|
|
|
sign_key = get_sign_key(pinfo,1);
|
|
|
|
rc4_state_peer = get_encrypted_state(pinfo, 0);
|
|
|
|
} else {
|
|
|
|
rc4_state = get_encrypted_state(pinfo, 0);
|
|
|
|
sign_key = get_sign_key(pinfo,0);
|
|
|
|
rc4_state_peer = get_encrypted_state(pinfo, 1);
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
if (rc4_state == NULL || rc4_state_peer == NULL) {
|
|
|
|
/* There is no encryption state, so we cannot decrypt */
|
|
|
|
return;
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Setup the buffer to decrypt to */
|
|
|
|
tvb_memcpy(tvb, packet_ntlmssp_info->verifier,
|
2010-10-03 19:43:14 +00:00
|
|
|
offset, encrypted_block_length);
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/*if( !(NTLMSSP_NEGOTIATE_KEY_EXCH & packet_ntlmssp_info->flags)) {*/
|
|
|
|
if( conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY ) {
|
|
|
|
if( (NTLMSSP_NEGOTIATE_KEY_EXCH & conv_ntlmssp_info->flags)) {
|
2009-10-06 14:20:59 +00:00
|
|
|
/* The spec says that if we have have a key exchange then we have a the signature that is crypted
|
2009-10-06 09:13:57 +00:00
|
|
|
* otherwise it's just a hmac_md5(keysign,concat(message,sequence))[0..7]
|
|
|
|
*/
|
2010-10-03 19:43:14 +00:00
|
|
|
crypt_rc4(rc4_state, packet_ntlmssp_info->verifier, 8);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Try to check the HMAC MD5 of the message against those calculated works great with LDAP payload but
|
|
|
|
* don't with DCE/RPC calls.
|
2009-10-06 14:20:59 +00:00
|
|
|
* Some analysis need to be done ...
|
2009-10-06 09:13:57 +00:00
|
|
|
*/
|
|
|
|
if( sign_key != NULL ) {
|
2009-10-06 14:20:59 +00:00
|
|
|
check_buf = ep_alloc(packet_ntlmssp_info->payload_len+4);
|
2009-10-06 09:13:57 +00:00
|
|
|
tvb_memcpy(tvb, &sequence,offset+8,4);
|
|
|
|
memcpy(check_buf,&sequence,4);
|
|
|
|
memcpy(check_buf+4,packet_ntlmssp_info->decrypted_payload,packet_ntlmssp_info->payload_len);
|
2009-11-16 17:08:12 +00:00
|
|
|
md5_hmac(check_buf,(int)(packet_ntlmssp_info->payload_len+4),sign_key,NTLMSSP_KEY_LEN,calculated_md5);
|
2009-10-06 09:13:57 +00:00
|
|
|
/*
|
|
|
|
printnbyte(packet_ntlmssp_info->verifier,8,"HMAC from packet: ","\n");
|
|
|
|
printnbyte(calculated_md5,8,"HMAC : ","\n");
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* The packet has a PAD then a checksum then a sequence and they are encoded in this order so we can decrypt all at once */
|
|
|
|
/* Do the actual decryption of the verifier */
|
|
|
|
crypt_rc4(rc4_state, packet_ntlmssp_info->verifier,
|
2010-10-03 19:43:14 +00:00
|
|
|
encrypted_block_length);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* We setup a temporary buffer so we can re-encrypt the payload after
|
2009-10-06 14:20:59 +00:00
|
|
|
decryption. This is to update the opposite peer's RC4 state
|
2009-10-06 09:13:57 +00:00
|
|
|
This is not needed when we just have EXTENDED SECURITY because the signature is not crypted
|
|
|
|
and it's also not needed when we have key exchange because server and client have independant keys */
|
|
|
|
if( !(NTLMSSP_NEGOTIATE_KEY_EXCH & conv_ntlmssp_info->flags) && !(NTLMSSP_NEGOTIATE_EXTENDED_SECURITY & conv_ntlmssp_info->flags)) {
|
2009-10-25 11:43:30 +00:00
|
|
|
peer_block = ep_memdup(packet_ntlmssp_info->verifier, encrypted_block_length);
|
2009-10-06 09:13:57 +00:00
|
|
|
crypt_rc4(rc4_state_peer, peer_block, encrypted_block_length);
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Mark the packet as decrypted so that subsequent attempts to dissect
|
|
|
|
the packet use the already decrypted payload instead of attempting
|
|
|
|
to decrypt again */
|
|
|
|
packet_ntlmssp_info->verifier_decrypted = TRUE;
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Show the decrypted buffer in a new window */
|
2009-05-13 19:46:11 +00:00
|
|
|
decr_tvb = tvb_new_child_real_data(tvb, packet_ntlmssp_info->verifier,
|
2010-10-03 18:51:38 +00:00
|
|
|
encrypted_block_length,
|
|
|
|
encrypted_block_length);
|
2002-12-31 08:05:29 +00:00
|
|
|
add_new_data_source(pinfo, decr_tvb,
|
2010-10-03 18:51:38 +00:00
|
|
|
"Decrypted NTLMSSP Verifier");
|
2002-12-31 08:05:29 +00:00
|
|
|
|
|
|
|
/* Show the decrypted payload in the tree */
|
|
|
|
tf = proto_tree_add_text(tree, decr_tvb, 0, -1,
|
2010-10-03 18:51:38 +00:00
|
|
|
"Decrypted Verifier (%d byte%s)",
|
|
|
|
encrypted_block_length,
|
|
|
|
plurality(encrypted_block_length, "", "s"));
|
2002-12-31 08:05:29 +00:00
|
|
|
decr_tree = proto_item_add_subtree (tf, ett_ntlmssp);
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
if(( conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY )) {
|
|
|
|
proto_tree_add_item (decr_tree, hf_ntlmssp_verf_hmacmd5,
|
2011-10-04 22:44:31 +00:00
|
|
|
decr_tvb, decrypted_offset, 8,ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypted_offset += 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Incrementing sequence number of DCE conversation */
|
|
|
|
proto_tree_add_item (decr_tree, hf_ntlmssp_verf_sequence,
|
2011-10-04 22:44:31 +00:00
|
|
|
decr_tvb, decrypted_offset, 4, ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypted_offset += 4;
|
|
|
|
}
|
|
|
|
else {
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* RANDOM PAD usually it's 0 */
|
|
|
|
proto_tree_add_item (decr_tree, hf_ntlmssp_verf_randompad,
|
2011-10-06 03:35:44 +00:00
|
|
|
decr_tvb, decrypted_offset, 4, ENC_LITTLE_ENDIAN);
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypted_offset += 4;
|
|
|
|
|
|
|
|
/* CRC32 of the DCE fragment data */
|
|
|
|
proto_tree_add_item (decr_tree, hf_ntlmssp_verf_crc32,
|
2011-10-06 03:35:44 +00:00
|
|
|
decr_tvb, decrypted_offset, 4, ENC_LITTLE_ENDIAN);
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypted_offset += 4;
|
|
|
|
|
|
|
|
/* Incrementing sequence number of DCE conversation */
|
|
|
|
proto_tree_add_item (decr_tree, hf_ntlmssp_verf_sequence,
|
2011-10-04 22:44:31 +00:00
|
|
|
decr_tvb, decrypted_offset, 4, ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypted_offset += 4;
|
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Used when NTLMSSP is done over DCE/RPC because in this case verifier and real payload are not contigious*/
|
2009-10-06 14:20:59 +00:00
|
|
|
static int
|
2009-10-06 09:13:57 +00:00
|
|
|
dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree *tree)
|
|
|
|
{
|
|
|
|
volatile int offset = 0;
|
|
|
|
proto_tree *volatile ntlmssp_tree = NULL;
|
|
|
|
guint32 encrypted_block_length;
|
2010-10-08 17:48:22 +00:00
|
|
|
void *pd_save;
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* the magic ntlm is the identifier of a NTLMSSP packet that's 00 00 00 01
|
|
|
|
*/
|
|
|
|
encrypted_block_length = tvb_length (tvb);
|
|
|
|
/* signature + seq + real payload */
|
|
|
|
|
|
|
|
/* Setup a new tree for the NTLMSSP payload */
|
2010-10-03 18:51:38 +00:00
|
|
|
#if 0
|
2009-10-06 09:13:57 +00:00
|
|
|
if (tree) {
|
|
|
|
tf = proto_tree_add_item (tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_verf,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, -1, ENC_NA);
|
2009-10-06 09:13:57 +00:00
|
|
|
|
|
|
|
ntlmssp_tree = proto_item_add_subtree (tf,
|
2010-10-03 18:51:38 +00:00
|
|
|
ett_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
2010-10-03 18:51:38 +00:00
|
|
|
#endif
|
2009-10-06 09:13:57 +00:00
|
|
|
/*
|
|
|
|
* Catch the ReportedBoundsError exception; the stuff we've been
|
|
|
|
* handed doesn't necessarily run to the end of the packet, it's
|
|
|
|
* an item inside a packet, so if it happens to be malformed (or
|
|
|
|
* we, or a dissector we call, has a bug), so that an exception
|
|
|
|
* is thrown, we want to report the error, but return and let
|
|
|
|
* our caller dissect the rest of the packet.
|
|
|
|
*
|
|
|
|
* If it gets a BoundsError, we can stop, as there's nothing more
|
|
|
|
* in the packet after our blob to see, so we just re-throw the
|
|
|
|
* exception.
|
|
|
|
*/
|
2010-10-08 17:48:22 +00:00
|
|
|
pd_save = pinfo->private_data;
|
2009-10-06 09:13:57 +00:00
|
|
|
TRY {
|
|
|
|
/* Version number */
|
|
|
|
|
|
|
|
/* Try to decrypt */
|
|
|
|
decrypt_data_payload (tvb, offset, encrypted_block_length, pinfo, ntlmssp_tree,NULL);
|
|
|
|
/* let's try to hook ourselves here */
|
|
|
|
|
|
|
|
} CATCH(BoundsError) {
|
|
|
|
RETHROW;
|
|
|
|
} CATCH(ReportedBoundsError) {
|
2010-10-08 17:48:22 +00:00
|
|
|
/* Restore the private_data structure in case one of the
|
|
|
|
* called dissectors modified it (and, due to the exception,
|
|
|
|
* was unable to restore it).
|
|
|
|
*/
|
|
|
|
pinfo->private_data = pd_save;
|
2009-10-06 09:13:57 +00:00
|
|
|
show_reported_bounds_error(tvb, pinfo, tree);
|
|
|
|
} ENDTRY;
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2010-10-03 19:43:14 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Used when NTLMSSP is done over DCE/RPC because in this case verifier and real payload are not contigious
|
|
|
|
* But in fact this function could be merged with wrap_dissect_ntlmssp_verf because it's only used there
|
|
|
|
*/
|
2002-11-28 06:48:42 +00:00
|
|
|
static int
|
2002-11-10 09:38:22 +00:00
|
|
|
dissect_ntlmssp_verf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
volatile int offset = 0;
|
|
|
|
proto_tree *volatile ntlmssp_tree = NULL;
|
|
|
|
proto_item *tf = NULL;
|
2002-12-31 08:05:29 +00:00
|
|
|
guint32 verifier_length;
|
|
|
|
guint32 encrypted_block_length;
|
2010-10-08 17:48:22 +00:00
|
|
|
void *pd_save;
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2007-10-23 05:50:00 +00:00
|
|
|
verifier_length = tvb_length (tvb);
|
2002-12-31 08:05:29 +00:00
|
|
|
encrypted_block_length = verifier_length - 4;
|
|
|
|
|
|
|
|
if (encrypted_block_length < 12) {
|
|
|
|
/* Don't know why this would happen, but if it does, don't even bother
|
|
|
|
attempting decryption/dissection */
|
|
|
|
return offset + verifier_length;
|
|
|
|
}
|
2002-11-10 09:38:22 +00:00
|
|
|
|
|
|
|
/* Setup a new tree for the NTLMSSP payload */
|
|
|
|
if (tree) {
|
|
|
|
tf = proto_tree_add_item (tree,
|
2010-10-03 18:51:38 +00:00
|
|
|
hf_ntlmssp_verf,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, -1, ENC_NA);
|
2002-11-10 09:38:22 +00:00
|
|
|
|
|
|
|
ntlmssp_tree = proto_item_add_subtree (tf,
|
2010-10-03 18:51:38 +00:00
|
|
|
ett_ntlmssp);
|
2002-11-10 09:38:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Catch the ReportedBoundsError exception; the stuff we've been
|
|
|
|
* handed doesn't necessarily run to the end of the packet, it's
|
|
|
|
* an item inside a packet, so if it happens to be malformed (or
|
|
|
|
* we, or a dissector we call, has a bug), so that an exception
|
|
|
|
* is thrown, we want to report the error, but return and let
|
|
|
|
* our caller dissect the rest of the packet.
|
|
|
|
*
|
|
|
|
* If it gets a BoundsError, we can stop, as there's nothing more
|
|
|
|
* in the packet after our blob to see, so we just re-throw the
|
|
|
|
* exception.
|
|
|
|
*/
|
2010-10-08 17:48:22 +00:00
|
|
|
pd_save = pinfo->private_data;
|
2002-11-10 09:38:22 +00:00
|
|
|
TRY {
|
|
|
|
/* Version number */
|
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_vers,
|
2011-10-06 03:35:44 +00:00
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
2002-11-10 09:38:22 +00:00
|
|
|
offset += 4;
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-11-10 09:38:22 +00:00
|
|
|
/* Encrypted body */
|
|
|
|
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_body,
|
2011-10-04 22:44:31 +00:00
|
|
|
tvb, offset, encrypted_block_length, ENC_NA);
|
2002-12-31 08:05:29 +00:00
|
|
|
|
|
|
|
/* Try to decrypt */
|
2009-10-06 09:13:57 +00:00
|
|
|
decrypt_verifier (tvb, offset, encrypted_block_length, pinfo, ntlmssp_tree,NULL);
|
|
|
|
/* let's try to hook ourselves here */
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
offset += 12;
|
2002-12-31 08:05:29 +00:00
|
|
|
offset += encrypted_block_length;
|
2002-11-10 09:38:22 +00:00
|
|
|
} CATCH(BoundsError) {
|
|
|
|
RETHROW;
|
|
|
|
} CATCH(ReportedBoundsError) {
|
2010-10-08 17:48:22 +00:00
|
|
|
/* Restore the private_data structure in case one of the
|
|
|
|
* called dissectors modified it (and, due to the exception,
|
|
|
|
* was unable to restore it).
|
|
|
|
*/
|
|
|
|
pinfo->private_data = pd_save;
|
2002-11-10 09:38:22 +00:00
|
|
|
show_reported_bounds_error(tvb, pinfo, tree);
|
|
|
|
} ENDTRY;
|
2002-11-28 06:48:42 +00:00
|
|
|
|
|
|
|
return offset;
|
2002-11-10 09:38:22 +00:00
|
|
|
}
|
|
|
|
|
2003-09-26 06:30:13 +00:00
|
|
|
static tvbuff_t *
|
2009-10-06 09:13:57 +00:00
|
|
|
wrap_dissect_ntlmssp_payload_only(tvbuff_t *tvb,tvbuff_t *auth_tvb _U_,
|
2010-10-03 18:51:38 +00:00
|
|
|
int offset, packet_info *pinfo,dcerpc_auth_info *auth_info _U_)
|
2009-10-06 09:13:57 +00:00
|
|
|
{
|
2010-10-03 18:51:38 +00:00
|
|
|
tvbuff_t *data_tvb;
|
2009-10-06 09:13:57 +00:00
|
|
|
|
2010-10-03 18:51:38 +00:00
|
|
|
data_tvb = tvb_new_subset(
|
|
|
|
tvb, offset, tvb_length_remaining(tvb, offset),
|
|
|
|
tvb_length_remaining(tvb, offset));
|
|
|
|
dissect_ntlmssp_payload_only(data_tvb, pinfo, NULL);
|
2009-10-06 09:13:57 +00:00
|
|
|
return pinfo->gssapi_decrypted_tvb;
|
|
|
|
}
|
2010-09-30 20:26:13 +00:00
|
|
|
|
|
|
|
#if 0
|
2010-10-03 19:43:14 +00:00
|
|
|
static tvbuff_t *
|
2007-01-09 22:14:07 +00:00
|
|
|
dissect_ntlmssp_encrypted_payload(tvbuff_t *data_tvb,
|
2010-10-03 18:51:38 +00:00
|
|
|
tvbuff_t *auth_tvb _U_,
|
|
|
|
int offset,
|
|
|
|
packet_info *pinfo,
|
|
|
|
dcerpc_auth_info *auth_info _U_)
|
2002-12-31 08:05:29 +00:00
|
|
|
{
|
2010-09-30 21:32:42 +00:00
|
|
|
/* gssapi_decrypted_tvb=NULL */
|
|
|
|
tvbuff_t *decr_tvb; /* Used to display decrypted buffer */
|
2002-12-31 08:05:29 +00:00
|
|
|
guint8 *peer_block;
|
|
|
|
conversation_t *conversation;
|
|
|
|
guint32 encrypted_block_length;
|
|
|
|
rc4_state_struct *rc4_state;
|
|
|
|
rc4_state_struct *rc4_state_peer;
|
|
|
|
ntlmssp_info *conv_ntlmssp_info = NULL;
|
|
|
|
ntlmssp_packet_info *packet_ntlmssp_info = NULL;
|
2005-03-10 08:50:18 +00:00
|
|
|
encrypted_block_length = tvb_length_remaining (data_tvb, offset);
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
fprintf(stderr,"Called dissect_ntlmssp_encrypted_payload\n");
|
2010-09-30 21:32:42 +00:00
|
|
|
/* Check to see if we already have state for this packet */
|
2002-12-31 08:05:29 +00:00
|
|
|
packet_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
|
|
|
|
if (packet_ntlmssp_info == NULL) {
|
2010-09-30 21:32:42 +00:00
|
|
|
/* We don't have any packet state, so create one */
|
2009-10-25 11:43:30 +00:00
|
|
|
packet_ntlmssp_info = se_alloc0(sizeof(ntlmssp_packet_info));
|
2002-12-31 08:05:29 +00:00
|
|
|
p_add_proto_data(pinfo->fd, proto_ntlmssp, packet_ntlmssp_info);
|
|
|
|
}
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
if (!packet_ntlmssp_info->payload_decrypted) {
|
2010-09-30 21:32:42 +00:00
|
|
|
/* Pull the challenge info from the conversation */
|
2005-02-02 20:07:03 +00:00
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
2010-10-03 18:51:38 +00:00
|
|
|
pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2002-12-31 08:05:29 +00:00
|
|
|
if (conversation == NULL) {
|
2010-09-30 21:32:42 +00:00
|
|
|
/* There is no conversation, thus no encryption state */
|
2003-09-26 06:30:13 +00:00
|
|
|
return NULL;
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
conv_ntlmssp_info = conversation_get_proto_data(conversation,
|
2010-10-03 18:51:38 +00:00
|
|
|
proto_ntlmssp);
|
2002-12-31 08:05:29 +00:00
|
|
|
if (conv_ntlmssp_info == NULL) {
|
2010-09-30 21:32:42 +00:00
|
|
|
/* There is no NTLMSSP state tied to the conversation */
|
2009-10-06 09:13:57 +00:00
|
|
|
return NULL;
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
2010-09-30 21:32:42 +00:00
|
|
|
/* Get the pair of RC4 state structures. One is used for to decrypt the
|
2002-12-31 08:05:29 +00:00
|
|
|
payload. The other is used to re-encrypt the payload to represent
|
2010-09-30 21:32:42 +00:00
|
|
|
the peer */
|
2009-10-06 09:13:57 +00:00
|
|
|
if (conv_ntlmssp_info->server_dest_port == pinfo->destport) {
|
2002-12-31 08:05:29 +00:00
|
|
|
rc4_state = get_encrypted_state(pinfo, 1);
|
|
|
|
rc4_state_peer = get_encrypted_state(pinfo, 0);
|
|
|
|
} else {
|
|
|
|
rc4_state = get_encrypted_state(pinfo, 0);
|
|
|
|
rc4_state_peer = get_encrypted_state(pinfo, 1);
|
|
|
|
}
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
if (rc4_state == NULL || rc4_state_peer == NULL) {
|
2010-09-30 21:32:42 +00:00
|
|
|
/* There is no encryption state, so we cannot decrypt */
|
2003-09-26 06:30:13 +00:00
|
|
|
return NULL;
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
|
|
|
|
2010-09-30 21:32:42 +00:00
|
|
|
/* Store the decrypted contents in the packet state struct
|
|
|
|
(of course at this point, they aren't decrypted yet) */
|
2005-03-10 08:50:18 +00:00
|
|
|
packet_ntlmssp_info->decrypted_payload = tvb_memdup(data_tvb, offset,
|
2004-02-25 09:31:07 +00:00
|
|
|
encrypted_block_length);
|
2003-03-04 20:52:33 +00:00
|
|
|
decrypted_payloads = g_slist_prepend(decrypted_payloads,
|
|
|
|
packet_ntlmssp_info->decrypted_payload);
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2010-09-30 21:32:42 +00:00
|
|
|
/* Do the decryption of the payload */
|
2007-01-09 22:14:07 +00:00
|
|
|
crypt_rc4(rc4_state, packet_ntlmssp_info->decrypted_payload,
|
2010-10-03 19:43:14 +00:00
|
|
|
encrypted_block_length);
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2010-09-30 21:32:42 +00:00
|
|
|
/* We setup a temporary buffer so we can re-encrypt the payload after
|
|
|
|
decryption. This is to update the opposite peer's RC4 state */
|
2009-10-25 11:43:30 +00:00
|
|
|
peer_block = ep_memdup(packet_ntlmssp_info->decrypted_payload, encrypted_block_length);
|
2002-12-31 08:05:29 +00:00
|
|
|
crypt_rc4(rc4_state_peer, peer_block, encrypted_block_length);
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
packet_ntlmssp_info->payload_decrypted = TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-30 21:32:42 +00:00
|
|
|
/* Show the decrypted buffer in a new window */
|
2009-05-13 19:46:11 +00:00
|
|
|
decr_tvb = tvb_new_child_real_data(data_tvb, packet_ntlmssp_info->decrypted_payload,
|
2010-10-03 18:51:38 +00:00
|
|
|
encrypted_block_length,
|
|
|
|
encrypted_block_length);
|
2003-09-26 06:30:13 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
offset += encrypted_block_length;
|
2003-09-26 06:30:13 +00:00
|
|
|
|
|
|
|
return decr_tvb;
|
2002-12-31 08:05:29 +00:00
|
|
|
}
|
2010-09-30 20:26:13 +00:00
|
|
|
#endif
|
|
|
|
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
static void
|
2003-03-04 20:52:33 +00:00
|
|
|
free_payload(gpointer decrypted_payload, gpointer user_data _U_)
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
{
|
2010-10-03 19:43:14 +00:00
|
|
|
g_free(decrypted_payload);
|
2003-03-04 20:52:33 +00:00
|
|
|
}
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2010-10-03 19:43:14 +00:00
|
|
|
static guint
|
|
|
|
header_hash(gconstpointer pointer)
|
|
|
|
{
|
2009-11-16 17:08:12 +00:00
|
|
|
guint32 crc = ~crc32c_calculate(pointer,NTLMSSP_KEY_LEN,CRC32C_PRELOAD);
|
2009-10-06 09:13:57 +00:00
|
|
|
/* Mat TBD fprintf(stderr,"Val: %u\n",crc);*/
|
|
|
|
return crc;
|
|
|
|
}
|
|
|
|
|
2010-10-03 19:43:14 +00:00
|
|
|
static gboolean
|
|
|
|
header_equal(gconstpointer pointer1, gconstpointer pointer2)
|
|
|
|
{
|
2009-10-06 09:13:57 +00:00
|
|
|
if(!memcmp(pointer1,pointer2,16)) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2009-10-06 14:20:59 +00:00
|
|
|
|
2003-03-04 20:52:33 +00:00
|
|
|
static void
|
|
|
|
ntlmssp_init_protocol(void)
|
|
|
|
{
|
2010-10-03 18:51:38 +00:00
|
|
|
/*
|
|
|
|
* Free the decrypted payloads, and then free the list of decrypted
|
|
|
|
* payloads.
|
|
|
|
*/
|
|
|
|
if (decrypted_payloads != NULL) {
|
|
|
|
g_slist_foreach(decrypted_payloads, free_payload, NULL);
|
|
|
|
g_slist_free(decrypted_payloads);
|
|
|
|
decrypted_payloads = NULL;
|
|
|
|
}
|
2003-03-04 20:52:33 +00:00
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
if(hash_packet == NULL) {
|
2010-10-03 19:43:14 +00:00
|
|
|
hash_packet = g_hash_table_new(header_hash, header_equal);
|
2009-10-06 09:13:57 +00:00
|
|
|
}
|
|
|
|
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 09:13:57 +00:00
|
|
|
|
|
|
|
|
2010-10-03 19:43:14 +00:00
|
|
|
static int
|
|
|
|
wrap_dissect_ntlmssp(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|
|
|
proto_tree *tree, guint8 *drep _U_)
|
|
|
|
{
|
|
|
|
tvbuff_t *auth_tvb;
|
|
|
|
|
|
|
|
auth_tvb = tvb_new_subset(
|
|
|
|
tvb, offset, tvb_length_remaining(tvb, offset),
|
|
|
|
tvb_length_remaining(tvb, offset));
|
|
|
|
|
|
|
|
dissect_ntlmssp(auth_tvb, pinfo, tree);
|
|
|
|
|
|
|
|
return tvb_length_remaining(tvb, offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
wrap_dissect_ntlmssp_verf(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|
|
|
proto_tree *tree, guint8 *drep _U_)
|
|
|
|
{
|
|
|
|
tvbuff_t *auth_tvb;
|
|
|
|
|
|
|
|
auth_tvb = tvb_new_subset(
|
|
|
|
tvb, offset, tvb_length_remaining(tvb, offset),
|
|
|
|
tvb_length_remaining(tvb, offset));
|
|
|
|
return dissect_ntlmssp_verf(auth_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
static dcerpc_auth_subdissector_fns ntlmssp_sign_fns = {
|
|
|
|
wrap_dissect_ntlmssp, /* Bind */
|
|
|
|
wrap_dissect_ntlmssp, /* Bind ACK */
|
|
|
|
wrap_dissect_ntlmssp, /* AUTH3 */
|
|
|
|
wrap_dissect_ntlmssp_verf, /* Request verifier */
|
|
|
|
wrap_dissect_ntlmssp_verf, /* Response verifier */
|
|
|
|
NULL, /* Request data */
|
|
|
|
NULL /* Response data */
|
|
|
|
};
|
|
|
|
|
|
|
|
static dcerpc_auth_subdissector_fns ntlmssp_seal_fns = {
|
|
|
|
wrap_dissect_ntlmssp, /* Bind */
|
|
|
|
wrap_dissect_ntlmssp, /* Bind ACK */
|
|
|
|
wrap_dissect_ntlmssp, /* AUTH3 */
|
|
|
|
wrap_dissect_ntlmssp_verf, /* Request verifier */
|
|
|
|
wrap_dissect_ntlmssp_verf, /* Response verifier */
|
|
|
|
wrap_dissect_ntlmssp_payload_only, /* Request data */
|
|
|
|
wrap_dissect_ntlmssp_payload_only /* Response data */
|
|
|
|
};
|
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
void
|
|
|
|
proto_register_ntlmssp(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntlmssp_auth,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "NTLMSSP identifier", "ntlmssp.identifier", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_message_type,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "NTLM Message Type", "ntlmssp.messagetype", FT_UINT32, BASE_HEX, VALS(ntlmssp_message_types), 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Flags", "ntlmssp.negotiateflags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_01,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate UNICODE", "ntlmssp.negotiateunicode", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_UNICODE, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_02,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate OEM", "ntlmssp.negotiateoem", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_OEM, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_04,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Request Target", "ntlmssp.requesttarget", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_REQUEST_TARGET, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_08,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Request 0x00000008", "ntlmssp.negotiate00000008", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_00000008, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_10,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Sign", "ntlmssp.negotiatesign", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_SIGN, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_20,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Seal", "ntlmssp.negotiateseal", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_SEAL, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_40,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Datagram", "ntlmssp.negotiatedatagram", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_DATAGRAM, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_80,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Lan Manager Key", "ntlmssp.negotiatelmkey", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_LM_KEY, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_100,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x00000100", "ntlmssp.negotiate00000100", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_00000100, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_200,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate NTLM key", "ntlmssp.negotiatentlm", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_NTLM, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_400,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate NT Only", "ntlmssp.negotiatentonly", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_NT_ONLY, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_800,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x00000800", "ntlmssp.negotiate00000800", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_00000800, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_1000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate OEM Domain Supplied", "ntlmssp.negotiateoemdomainsupplied", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_2000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate OEM Workstation Supplied", "ntlmssp.negotiateoemworkstationsupplied", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_4000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x00004000", "ntlmssp.negotiate00004000", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_00004000, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_8000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Always Sign", "ntlmssp.negotiatealwayssign", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_ALWAYS_SIGN, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_10000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Target Type Domain", "ntlmssp.targettypedomain", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_TARGET_TYPE_DOMAIN, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_20000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Target Type Server", "ntlmssp.targettypeserver", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_TARGET_TYPE_SERVER, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_40000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Target Type Share", "ntlmssp.targettypeshare", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_TARGET_TYPE_SHARE, NULL, HFILL }},
|
2010-10-03 18:23:46 +00:00
|
|
|
|
|
|
|
/* Negotiate Flags */
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_80000,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "Negotiate Extended Security", "ntlmssp.negotiatentlm2", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_EXTENDED_SECURITY, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_100000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Identify", "ntlmssp.negotiateidentify", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_IDENTIFY, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_200000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x00200000", "ntlmssp.negotiatent00200000", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_00200000, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_400000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Request Non-NT Session", "ntlmssp.requestnonntsession", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_REQUEST_NON_NT_SESSION, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_800000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Target Info", "ntlmssp.negotiatetargetinfo", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_TARGET_INFO, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_1000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x01000000", "ntlmssp.negotiatent01000000", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_01000000, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_2000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Version", "ntlmssp.negotiateversion", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_VERSION, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_4000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x04000000", "ntlmssp.negotiatent04000000", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_04000000, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_8000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x08000000", "ntlmssp.negotiatent08000000", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_08000000, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_10000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 0x10000000", "ntlmssp.negotiatent10000000", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_10000000, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_20000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 128", "ntlmssp.negotiate128", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_128, "128-bit encryption is supported", HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_40000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate Key Exchange", "ntlmssp.negotiatekeyexch", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_KEY_EXCH, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_flags_80000000,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Negotiate 56", "ntlmssp.negotiate56", FT_BOOLEAN, 32, TFS (&tfs_set_notset), NTLMSSP_NEGOTIATE_56, "56-bit encryption is supported", HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_workstation_strlen,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation name length", "ntlmssp.negotiate.callingworkstation.strlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_workstation_maxlen,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation name max length", "ntlmssp.negotiate.callingworkstation.maxlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_workstation_buffer,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation name buffer", "ntlmssp.negotiate.callingworkstation.buffer", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_workstation,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation name", "ntlmssp.negotiate.callingworkstation", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_domain_strlen,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation domain length", "ntlmssp.negotiate.domain.strlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_domain_maxlen,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation domain max length", "ntlmssp.negotiate.domain.maxlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_domain_buffer,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation domain buffer", "ntlmssp.negotiate.domain.buffer", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_negotiate_domain,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Calling workstation domain", "ntlmssp.negotiate.domain", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2009-10-06 09:13:57 +00:00
|
|
|
{ &hf_ntlmssp_ntlm_client_challenge,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "NTLM Client Challenge", "ntlmssp.ntlmclientchallenge", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2009-10-06 09:13:57 +00:00
|
|
|
{ &hf_ntlmssp_ntlm_server_challenge,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "NTLM Server Challenge", "ntlmssp.ntlmserverchallenge", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-07-09 20:49:27 +00:00
|
|
|
{ &hf_ntlmssp_reserved,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Reserved", "ntlmssp.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2010-10-03 18:23:46 +00:00
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
{ &hf_ntlmssp_challenge_target_name,
|
|
|
|
{ "Target Name", "ntlmssp.challenge.target_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-08-10 21:15:37 +00:00
|
|
|
{ &hf_ntlmssp_auth_domain,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Domain name", "ntlmssp.auth.domain", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-08-10 21:15:37 +00:00
|
|
|
{ &hf_ntlmssp_auth_username,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "User name", "ntlmssp.auth.username", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-08-10 21:15:37 +00:00
|
|
|
{ &hf_ntlmssp_auth_hostname,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Host name", "ntlmssp.auth.hostname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-08-10 21:15:37 +00:00
|
|
|
{ &hf_ntlmssp_auth_lmresponse,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Lan Manager Response", "ntlmssp.auth.lmresponse", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-08-10 21:15:37 +00:00
|
|
|
{ &hf_ntlmssp_auth_ntresponse,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "NTLM Response", "ntlmssp.auth.ntresponse", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_auth_sesskey,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Session Key", "ntlmssp.auth.sesskey", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_string_len,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Length", "ntlmssp.string.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_string_maxlen,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Maxlen", "ntlmssp.string.maxlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_string_offset,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Offset", "ntlmssp.string.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_blob_len,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Length", "ntlmssp.blob.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_blob_maxlen,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Maxlen", "ntlmssp.blob.maxlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-09-10 23:44:17 +00:00
|
|
|
{ &hf_ntlmssp_blob_offset,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Offset", "ntlmssp.blob.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2010-10-03 18:23:46 +00:00
|
|
|
{ &hf_ntlmssp_version,
|
|
|
|
{ "Version", "ntlmssp.version", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2010-09-28 14:14:12 +00:00
|
|
|
{ &hf_ntlmssp_version_major,
|
|
|
|
{ "Major Version", "ntlmssp.version.major", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_ntlmssp_version_minor,
|
|
|
|
{ "Minor Version", "ntlmssp.version.minor", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_ntlmssp_version_build_number,
|
2011-05-17 01:38:28 +00:00
|
|
|
{ "Build Number", "ntlmssp.version.build_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2010-09-28 14:14:12 +00:00
|
|
|
{ &hf_ntlmssp_version_ntlm_current_revision,
|
|
|
|
{ "NTLM Current Revision", "ntlmssp.version.ntlm_current_revision", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2010-10-03 18:23:46 +00:00
|
|
|
|
|
|
|
/* Target Info */
|
|
|
|
{ &hf_ntlmssp_challenge_target_info,
|
|
|
|
{ "Target Info", "ntlmssp.challenge.target_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_len,
|
|
|
|
{ "Length", "ntlmssp.challenge.target_info.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_maxlen,
|
|
|
|
{ "Maxlen", "ntlmssp.challenge.target_info.maxlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_offset,
|
|
|
|
{ "Offset", "ntlmssp.challenge.target_info.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_item_type,
|
|
|
|
{ "Target Info Item Type", "ntlmssp.challenge.target_info.item.type", FT_UINT16, BASE_HEX, VALS(ntlm_name_types), 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_item_len,
|
|
|
|
{ "Target Info Item Length", "ntlmssp.challenge.target_info.item.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_end,
|
|
|
|
{ "List End", "ntlmssp.challenge.target_info.end", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_nb_computer_name,
|
|
|
|
{ "NetBIOS Computer Name", "ntlmssp.challenge.target_info.nb_computer_name", FT_STRING, BASE_NONE, NULL, 0x0, "Server NetBIOS Computer Name", HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_nb_domain_name,
|
|
|
|
{ "NetBIOS Domain Name", "ntlmssp.challenge.target_info.nb_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, "Server NetBIOS Domain Name", HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_dns_computer_name,
|
|
|
|
{ "DNS Computer Name", "ntlmssp.challenge.target_info.dns_computer_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_dns_domain_name,
|
|
|
|
{ "DNS Domain Name", "ntlmssp.challenge.target_info.dns_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_dns_tree_name,
|
|
|
|
{ "DNS Tree Name", "ntlmssp.challenge.target_info.dns_tree_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_flags,
|
|
|
|
{ "Flags", "ntlmssp.challenge.target_info.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_timestamp,
|
|
|
|
{ "Timestamp", "ntlmssp.challenge.target_info.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_restrictions,
|
|
|
|
{ "Restrictions", "ntlmssp.challenge.target_info.restrictions", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_target_name,
|
|
|
|
{ "Target Name", "ntlmssp.challenge.target_info.target_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_challenge_target_info_channel_bindings,
|
|
|
|
{ "Channel Bindings", "ntlmssp.challenge.target_info.channel_bindings", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_item_type,
|
|
|
|
{ "NTLMV2 Response Item Type", "ntlmssp.ntlmv2_response.item.type", FT_UINT16, BASE_HEX, VALS(ntlm_name_types), 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_item_len,
|
|
|
|
{ "NTLMV2 Response Item Length", "ntlmssp.ntlmv2_response.item.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_end,
|
|
|
|
{ "List End", "ntlmssp.ntlmv2_response.end", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_nb_computer_name,
|
|
|
|
{ "NetBIOS Computer Name", "ntlmssp.ntlmv2_response.nb_computer_name", FT_STRING, BASE_NONE, NULL, 0x0, "Server NetBIOS Computer Name", HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_nb_domain_name,
|
|
|
|
{ "NetBIOS Domain Name", "ntlmssp.ntlmv2_response.nb_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, "Server NetBIOS Domain Name", HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_dns_computer_name,
|
|
|
|
{ "DNS Computer Name", "ntlmssp.ntlmv2_response.dns_computer_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_dns_domain_name,
|
|
|
|
{ "DNS Domain Name", "ntlmssp.ntlmv2_response.dns_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_dns_tree_name,
|
|
|
|
{ "DNS Tree Name", "ntlmssp.ntlmv2_response.dns_tree_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_flags,
|
|
|
|
{ "Flags", "ntlmssp.ntlmv2_response.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_timestamp,
|
|
|
|
{ "Timestamp", "ntlmssp.ntlmv2_response.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_restrictions,
|
|
|
|
{ "Restrictions", "ntlmssp.ntlmv2_response.restrictions", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_target_name,
|
|
|
|
{ "Target Name", "ntlmssp.ntlmv2_response.target_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_ntlmssp_ntlmv2_response_channel_bindings,
|
|
|
|
{ "Channel Bindings", "ntlmssp.ntlmv2_response.channel_bindings", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
2010-09-28 14:14:12 +00:00
|
|
|
{ &hf_ntlmssp_message_integrity_code,
|
2010-09-30 20:26:13 +00:00
|
|
|
{ "MIC", "ntlmssp.authenticate.mic", FT_BYTES, BASE_NONE, NULL, 0x0, "Message Integrity Code", HFILL}},
|
2002-12-31 08:05:29 +00:00
|
|
|
{ &hf_ntlmssp_verf,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "NTLMSSP Verifier", "ntlmssp.verf", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-11-10 09:38:22 +00:00
|
|
|
{ &hf_ntlmssp_verf_vers,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Version Number", "ntlmssp.verf.vers", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2002-11-10 09:38:22 +00:00
|
|
|
{ &hf_ntlmssp_verf_body,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Verifier Body", "ntlmssp.verf.body", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-12-31 08:05:29 +00:00
|
|
|
{ &hf_ntlmssp_decrypted_payload,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "NTLM Decrypted Payload", "ntlmssp.decrypted_payload", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2009-10-06 09:13:57 +00:00
|
|
|
{ &hf_ntlmssp_verf_randompad,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "Random Pad", "ntlmssp.verf.randompad", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2002-12-31 08:05:29 +00:00
|
|
|
{ &hf_ntlmssp_verf_crc32,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Verifier CRC32", "ntlmssp.verf.crc32", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2009-10-06 09:13:57 +00:00
|
|
|
{ &hf_ntlmssp_verf_hmacmd5,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "HMAC MD5", "ntlmssp.verf.hmacmd5", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2002-12-31 08:05:29 +00:00
|
|
|
{ &hf_ntlmssp_verf_sequence,
|
2009-10-07 23:08:22 +00:00
|
|
|
{ "Sequence", "ntlmssp.verf.sequence", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2010-10-03 18:23:46 +00:00
|
|
|
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "NTLMv2 Response", "ntlmssp.ntlmv2_response", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response_hmac,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "HMAC", "ntlmssp.ntlmv2_response.hmac", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response_header,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "Header", "ntlmssp.ntlmv2_response.header", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response_reserved,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "Reserved", "ntlmssp.ntlmv2_response.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response_time,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "Time", "ntlmssp.ntlmv2_response.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response_chal,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "Client challenge", "ntlmssp.ntlmv2_response.chal", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2004-08-02 23:14:32 +00:00
|
|
|
{ &hf_ntlmssp_ntlmv2_response_unknown,
|
2010-10-03 18:23:46 +00:00
|
|
|
{ "Unknown", "ntlmssp.ntlmv2_response.unknown", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}
|
2002-07-09 20:49:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ntlmssp,
|
|
|
|
&ett_ntlmssp_negotiate_flags,
|
2002-09-10 23:44:17 +00:00
|
|
|
&ett_ntlmssp_string,
|
|
|
|
&ett_ntlmssp_blob,
|
2010-09-28 14:14:12 +00:00
|
|
|
&ett_ntlmssp_version,
|
2010-10-03 18:23:46 +00:00
|
|
|
&ett_ntlmssp_challenge_target_info,
|
|
|
|
&ett_ntlmssp_challenge_target_info_item,
|
2004-08-02 23:14:32 +00:00
|
|
|
&ett_ntlmssp_ntlmv2_response,
|
2010-10-03 18:23:46 +00:00
|
|
|
&ett_ntlmssp_ntlmv2_response_item,
|
2002-07-09 20:49:27 +00:00
|
|
|
};
|
2002-12-31 08:05:29 +00:00
|
|
|
module_t *ntlmssp_module;
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
proto_ntlmssp = proto_register_protocol (
|
2010-10-03 18:51:38 +00:00
|
|
|
"NTLM Secure Service Provider", /* name */
|
2010-10-03 19:43:14 +00:00
|
|
|
"NTLMSSP", /* short name */
|
|
|
|
"ntlmssp" /* abbrev */
|
2010-10-03 18:51:38 +00:00
|
|
|
);
|
2002-07-09 20:49:27 +00:00
|
|
|
proto_register_field_array (proto_ntlmssp, hf, array_length (hf));
|
|
|
|
proto_register_subtree_array (ett, array_length (ett));
|
NTLMSSP_NEGOTIATE messages sometimes appear to have two other blobs at
the end, although they're empty in all messages I've seen; put in a
comment noting that.
NTLMSSP_CHALLENGE messages sometimes don't appear to have the address
list; it doesn't seem to be indicated by:
any flags in the previous NEGOTIATE message other than the
Negotiation Workstation Supplied, Negotiate Domain Supplied, or
Negotiate UNICODE, but it doesn't make sense for those to affect
it, as they affect unrelated things;
any flags in the CHALLENGE message other than Negotiate OEM or
Negotiate UNICODE, but those don't make sense.
So we just check whether the address list descriptor would be in the
middle of the domain name string and, if so, assume it's absent.
NTLMSSP_AUTH messages sometimes lack both the session key and the
negotiate flags; that appears to be controlled by th Negotiate Key
Exchange flag in the initial NEGOTIATE message - if not set, those
fields are missing. We therefore remember the NEGOTIATE flags in a
conversation, and attach them to frames containing AUTH messages; we
also need those flags to determine whether the strings in the AUTH
message are Unicode or not.
Make lengths, maximum lengths, and offsets unsigned.
Display entries for empty blobs and address lists.
svn path=/trunk/; revision=6575
2002-11-07 08:01:19 +00:00
|
|
|
register_init_routine(&ntlmssp_init_protocol);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
ntlmssp_module = prefs_register_protocol(proto_ntlmssp, NULL);
|
2007-01-09 22:14:07 +00:00
|
|
|
|
2002-12-31 08:05:29 +00:00
|
|
|
prefs_register_string_preference(ntlmssp_module, "nt_password",
|
2010-10-03 18:51:38 +00:00
|
|
|
"NT Password",
|
|
|
|
"NT Password (used to decrypt payloads)",
|
|
|
|
&gbl_nt_password);
|
2002-12-31 08:05:29 +00:00
|
|
|
|
2002-07-09 20:49:27 +00:00
|
|
|
register_dissector("ntlmssp", dissect_ntlmssp, proto_ntlmssp);
|
2009-10-06 09:13:57 +00:00
|
|
|
new_register_dissector("ntlmssp_payload", dissect_ntlmssp_payload, proto_ntlmssp);
|
|
|
|
new_register_dissector("ntlmssp_data_only", dissect_ntlmssp_payload_only, proto_ntlmssp);
|
2002-11-28 06:48:42 +00:00
|
|
|
new_register_dissector("ntlmssp_verf", dissect_ntlmssp_verf, proto_ntlmssp);
|
2002-07-09 20:49:27 +00:00
|
|
|
}
|
2002-08-30 00:32:11 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ntlmssp(void)
|
2007-01-09 22:14:07 +00:00
|
|
|
{
|
2002-11-28 06:48:42 +00:00
|
|
|
dissector_handle_t ntlmssp_handle, ntlmssp_wrap_handle;
|
2002-08-30 00:32:11 +00:00
|
|
|
|
2002-08-31 22:22:29 +00:00
|
|
|
/* Register protocol with the GSS-API module */
|
|
|
|
|
|
|
|
ntlmssp_handle = find_dissector("ntlmssp");
|
2002-11-28 06:48:42 +00:00
|
|
|
ntlmssp_wrap_handle = find_dissector("ntlmssp_verf");
|
2007-01-09 22:14:07 +00:00
|
|
|
gssapi_init_oid("1.3.6.1.4.1.311.2.2.10", proto_ntlmssp, ett_ntlmssp,
|
2010-10-03 18:51:38 +00:00
|
|
|
ntlmssp_handle, ntlmssp_wrap_handle,
|
|
|
|
"NTLMSSP - Microsoft NTLM Security Support Provider");
|
2003-07-16 04:20:33 +00:00
|
|
|
|
|
|
|
/* Register authenticated pipe dissector */
|
|
|
|
|
2003-07-18 05:51:21 +00:00
|
|
|
/*
|
|
|
|
* XXX - the verifiers here seem to have a version of 1 and a body of all
|
|
|
|
* zeroes.
|
|
|
|
*
|
|
|
|
* XXX - DCE_C_AUTHN_LEVEL_CONNECT is, according to the DCE RPC 1.1
|
|
|
|
* spec, upgraded to DCE_C_AUTHN_LEVEL_PKT. Should we register
|
|
|
|
* any other levels here?
|
|
|
|
*/
|
|
|
|
register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_CONNECT,
|
2010-10-03 18:51:38 +00:00
|
|
|
DCE_C_RPC_AUTHN_PROTOCOL_NTLMSSP,
|
|
|
|
&ntlmssp_sign_fns);
|
2003-07-18 05:51:21 +00:00
|
|
|
|
2008-04-23 20:28:30 +00:00
|
|
|
register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_PKT,
|
2010-10-03 18:51:38 +00:00
|
|
|
DCE_C_RPC_AUTHN_PROTOCOL_NTLMSSP,
|
|
|
|
&ntlmssp_sign_fns);
|
2008-04-23 20:28:30 +00:00
|
|
|
|
2003-07-16 04:20:33 +00:00
|
|
|
register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_PKT_INTEGRITY,
|
2010-10-03 18:51:38 +00:00
|
|
|
DCE_C_RPC_AUTHN_PROTOCOL_NTLMSSP,
|
|
|
|
&ntlmssp_sign_fns);
|
2003-07-16 04:20:33 +00:00
|
|
|
|
|
|
|
register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_PKT_PRIVACY,
|
2010-10-03 18:51:38 +00:00
|
|
|
DCE_C_RPC_AUTHN_PROTOCOL_NTLMSSP,
|
|
|
|
&ntlmssp_seal_fns);
|
2005-12-07 13:09:42 +00:00
|
|
|
ntlmssp_tap = register_tap("ntlmssp");
|
2011-09-30 15:21:16 +00:00
|
|
|
|
|
|
|
heur_dissector_add("credssp", dissect_ntlmssp_heur, proto_ntlmssp);
|
|
|
|
|
2002-08-30 00:32:11 +00:00
|
|
|
}
|
2009-11-16 17:08:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
2011-09-21 16:28:53 +00:00
|
|
|
* vi: set shiftwidth=2 tabstop=8 expandtab:
|
2009-11-16 17:08:12 +00:00
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|