2 * Routines for SMB net logon packet dissection
3 * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * Copied from packet-pop.c
11 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <epan/packet.h>
18 #include <wsutil/array.h>
19 #include "packet-windows-common.h"
20 #include "packet-smb-common.h"
22 void proto_register_smb_logon(void);
24 static int proto_smb_logon
;
25 static int hf_command
;
26 static int hf_computer_name
;
27 static int hf_unicode_computer_name
;
28 static int hf_server_name
;
29 static int hf_user_name
;
30 static int hf_domain_name
;
31 static int hf_server_dns_name
;
32 static int hf_forest_dns_name
;
33 static int hf_domain_dns_name
;
34 static int hf_mailslot_name
;
35 static int hf_pdc_name
;
36 static int hf_unicode_pdc_name
;
37 static int hf_script_name
;
38 static int hf_nt_version
;
39 static int hf_lmnt_token
;
40 static int hf_lm_token
;
41 static int hf_major_version
;
42 static int hf_minor_version
;
43 static int hf_os_version
;
44 static int hf_signature
;
45 static int hf_date_time
;
46 static int hf_update_type
;
47 static int hf_request_count
;
48 static int hf_account_control
;
49 static int hf_flags_autolock
;
50 static int hf_flags_expire
;
51 static int hf_flags_server_trust
;
52 static int hf_flags_workstation_trust
;
53 static int hf_flags_interdomain_trust
;
54 static int hf_flags_mns_user
;
55 static int hf_flags_normal_user
;
56 static int hf_flags_temp_dup_user
;
57 static int hf_flags_password_required
;
58 static int hf_flags_homedir_required
;
59 static int hf_flags_enabled
;
60 static int hf_domain_sid_size
;
61 static int hf_low_serial
;
64 static int hf_db_count
;
65 static int hf_db_index
;
66 static int hf_large_serial
;
67 static int hf_nt_date_time
;
69 static int hf_unknown8
;
70 static int hf_unknown32
;
72 static int hf_domain_guid
;
73 static int hf_server_ip
;
75 static int hf_server_site_name
;
76 static int hf_client_site_name
;
79 static int ett_smb_logon
;
80 static int ett_smb_account_flags
;
81 static int ett_smb_db_info
;
83 #define ACC_FLAG_AUTO_LOCKED 0x00000400
84 #define ACC_FLAG_EXPIRE 0x00000200
85 #define ACC_FLAG_SERVER_TRUST 0x00000100
86 #define ACC_FLAG_WORKSTATION_TRUST 0x00000080
87 #define ACC_FLAG_INTERDOMAIN_TRUST 0x00000040
88 #define ACC_FLAG_MNS_USER 0x00000020
89 #define ACC_FLAG_NORMAL_USER 0x00000010
90 #define ACC_FLAG_TEMP_DUP_USER 0x00000008
91 #define ACC_FLAG_PASSWORD_REQUIRED 0x00000004
92 #define ACC_FLAG_HOMEDIR_REQUIRED 0x00000002
93 #define ACC_FLAG_ENABLED 0x00000001
95 static const true_false_string tfs_flags_autolock
= {
96 "User account auto-locked",
97 "User account NOT auto-locked"
99 static const true_false_string tfs_flags_expire
= {
100 "User password will NOT expire",
101 "User password will expire"
103 static const true_false_string tfs_flags_server_trust
= {
104 "Server Trust user account",
105 "NOT a Server Trust user account"
107 static const true_false_string tfs_flags_workstation_trust
= {
108 "Workstation Trust user account",
109 "NOT a Workstation Trust user account"
111 static const true_false_string tfs_flags_interdomain_trust
= {
112 "Inter-domain Trust user account",
113 "NOT a Inter-domain Trust user account"
115 static const true_false_string tfs_flags_mns_user
= {
116 "MNS Logon user account",
117 "NOT a MNS Logon user account"
119 static const true_false_string tfs_flags_normal_user
= {
120 "Normal user account",
121 "NOT a normal user account"
123 static const true_false_string tfs_flags_temp_dup_user
= {
124 "Temp duplicate user account",
125 "NOT a temp duplicate user account"
127 static const true_false_string tfs_flags_password_required
= {
128 "NO password required",
131 static const true_false_string tfs_flags_homedir_required
= {
132 "NO homedir required",
135 static const true_false_string tfs_flags_enabled
= {
136 "User account enabled",
137 "User account disabled"
143 dissect_account_control(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
)
145 /* display the Allowable Account control bits */
146 static int * const flags
[] = {
149 &hf_flags_server_trust
,
150 &hf_flags_workstation_trust
,
151 &hf_flags_interdomain_trust
,
153 &hf_flags_normal_user
,
154 &hf_flags_temp_dup_user
,
155 &hf_flags_password_required
,
156 &hf_flags_homedir_required
,
161 proto_tree_add_bitmask(tree
, tvb
, offset
, hf_account_control
, ett_smb_account_flags
, flags
, ENC_LITTLE_ENDIAN
);
168 display_LM_token(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
172 Token
= tvb_get_letohs(tvb
, offset
);
175 proto_tree_add_uint_format(tree
, hf_lm_token
, tvb
, offset
, 2,
177 "LM20 Token: 0x%04x (LanMan 2.0 or higher)", Token
);
180 * XXX - are all values with the lower bit set LM 2.0,
181 * and all values with it not set LM 1.0?
182 * What do the other bits mean, if anything?
184 proto_tree_add_uint_format(tree
, hf_lm_token
, tvb
, offset
, 2,
186 "LM10 Token: 0x%04x (WFW Networking)", Token
);
195 display_LMNT_token(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
199 Token
= tvb_get_letohs(tvb
, offset
);
201 if (Token
== 0xffff) {
202 proto_tree_add_uint_format_value(tree
, hf_lmnt_token
, tvb
, offset
, 2,
204 "0x%04x (Windows NT Networking)", Token
);
207 * XXX - what is it if it's not 0xffff?
209 proto_tree_add_uint_format(tree
, hf_lm_token
, tvb
, offset
, 2,
211 "LMNT Token: 0x%04x (Unknown)", Token
);
220 dissect_smb_logon_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
222 /*** 0x00 (LM1.0/LM2.0 LOGON Request) ***/
225 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_computer_name
, NULL
);
228 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_user_name
, NULL
);
231 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_mailslot_name
, NULL
);
233 /*$$$$$ here add the Mailslot to the response list (if needed) */
236 proto_tree_add_item(tree
, hf_request_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
240 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
244 offset
= display_LM_token(tvb
, offset
, tree
);
252 dissect_smb_logon_LM10_resp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
254 /*** 0x01 LanMan 1.0 Logon response ***/
257 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_user_name
, NULL
);
260 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_script_name
, NULL
);
267 dissect_smb_logon_2(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
269 /*** 0x02 LM1.0 Query - Centralized Initialization ***/
270 /*** 0x03 LM1.0 Query - Distributed Initialization ***/
271 /*** 0x04 LM1.0 Query - Centralized Query Response ***/
272 /*** 0x04 LM1.0 Query - Distributed Query Response ***/
275 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_computer_name
, NULL
);
278 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_mailslot_name
, NULL
);
281 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
285 offset
= display_LM_token(tvb
, offset
, tree
);
293 dissect_smb_logon_LM20_resp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
295 /*** 0x06 (LM2.0 LOGON Response) ***/
298 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_server_name
, NULL
);
301 offset
= display_LM_token(tvb
, offset
, tree
);
309 dissect_smb_pdc_query(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
313 /*** 0x07 Query for Primary PDC ***/
316 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_computer_name
, &name
);
318 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " from %s", name
);
321 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_mailslot_name
, NULL
);
323 if (tvb_reported_length_remaining(tvb
, offset
) > 2) {
325 * NT-style Query for PDC?
326 * If only 2 bytes remain, it's probably a Windows 95-style
327 * query, which has only an LM token after the mailslot
330 * XXX - base this on flags in the SMB header, e.g.
331 * the ASCII/Unicode strings flag?
333 if (offset
% 2) offset
++; /* word align ... */
335 /* Unicode computer name */
336 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_unicode_computer_name
, NULL
);
339 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
343 offset
= display_LMNT_token(tvb
, offset
, tree
);
347 offset
= display_LM_token(tvb
, offset
, tree
);
355 dissect_smb_pdc_startup(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
357 /*** 0x08 Announce startup of PDC ***/
360 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_pdc_name
, NULL
);
362 /* A short Announce will not have the rest */
364 if (tvb_reported_length_remaining(tvb
, offset
) != 0) {
367 if (offset
% 2) offset
++; /* word align ... */
370 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_unicode_pdc_name
, &name
);
373 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ": host %s", name
);
377 if (offset
% 2) offset
++;
380 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_domain_name
, &name
);
383 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", domain %s", name
);
388 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
392 offset
= display_LMNT_token(tvb
, offset
, tree
);
395 offset
= display_LM_token(tvb
, offset
, tree
);
404 dissect_smb_pdc_failure(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
406 /*** 0x09 Announce failure of the PDC ***/
407 /*** 0x0F LM2.0 Resp. during LOGON pause ***/
408 /*** 0x10 (LM 2.0 Unknown user response) ***/
411 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
415 offset
= display_LM_token(tvb
, offset
, tree
);
422 dissect_announce_change(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
424 /*** 0x0A ( Announce change to UAS or SAM ) ***/
426 proto_tree
*info_tree
;
428 uint32_t domain_sid_size
;
430 /* low serial number */
431 proto_tree_add_item(tree
, hf_low_serial
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
435 /* XXX - what format is this? Neither SMB_Date/SMB_Time nor
436 "time_t but in the local time zone" appear to be correct. */
437 proto_tree_add_item(tree
, hf_date_time
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
441 proto_tree_add_item(tree
, hf_pulse
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
445 proto_tree_add_item(tree
, hf_random
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
449 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_pdc_name
, NULL
);
452 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_domain_name
, NULL
);
454 if (offset
% 2) offset
++; /* word align ... */
456 if (tvb_reported_length_remaining(tvb
, offset
) > 2) {
458 * XXX - older protocol versions don't have this stuff?
461 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_unicode_pdc_name
, NULL
);
464 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_domain_name
, NULL
);
467 info_count
= tvb_get_letohl(tvb
, offset
);
468 proto_tree_add_uint(tree
, hf_db_count
, tvb
, offset
, 4, info_count
);
471 while (info_count
!= 0) {
472 db_index
= tvb_get_letohl(tvb
, offset
);
473 info_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
, 20,
474 ett_smb_db_info
, NULL
, "DBChange Info Structure: index %u", db_index
);
476 proto_tree_add_uint(info_tree
, hf_db_index
, tvb
, offset
, 4,
480 proto_tree_add_item(info_tree
, hf_large_serial
, tvb
, offset
, 8,
484 dissect_nttime(tvb
, info_tree
, offset
,
485 hf_nt_date_time
, ENC_LITTLE_ENDIAN
);
491 /* Domain SID Size */
492 domain_sid_size
= tvb_get_letohl(tvb
, offset
);
493 proto_tree_add_uint(tree
, hf_domain_sid_size
, tvb
, offset
, 4,
497 if (domain_sid_size
!= 0) {
498 /* Align to four-byte boundary */
499 offset
= ((offset
+ 3)/4)*4;
502 offset
= dissect_nt_sid(
503 tvb
, offset
, tree
, "Domain", NULL
, -1);
507 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
511 offset
= display_LMNT_token(tvb
, offset
, tree
);
515 offset
= display_LM_token(tvb
, offset
, tree
);
522 dissect_smb_sam_logon_req(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
524 /* Netlogon command 0x12 - decode the SAM logon request from client */
526 uint32_t domain_sid_size
;
529 proto_tree_add_item(tree
, hf_request_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
533 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_unicode_computer_name
, NULL
);
536 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_user_name
, NULL
);
539 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_mailslot_name
, NULL
);
541 /* account control */
542 offset
= dissect_account_control(tvb
, tree
, offset
);
544 /* Domain SID Size */
545 domain_sid_size
= tvb_get_letohl(tvb
, offset
);
546 proto_tree_add_uint(tree
, hf_domain_sid_size
, tvb
, offset
, 4,
550 if (domain_sid_size
!= 0) {
551 /* Align to four-byte boundary */
552 offset
= ((offset
+ 3)/4)*4;
555 offset
= dissect_nt_sid(tvb
, offset
, tree
, "Domain", NULL
, -1);
559 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
563 offset
= display_LMNT_token(tvb
, offset
, tree
);
566 offset
= display_LM_token(tvb
, offset
, tree
);
574 dissect_smb_no_user(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
576 /* 0x0B (Announce no user on machine) */
579 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_computer_name
, NULL
);
587 dissect_smb_relogon_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
589 /*** 0x0d LanMan Response to relogon request ***/
592 proto_tree_add_item(tree
, hf_major_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
596 proto_tree_add_item(tree
, hf_minor_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
600 proto_tree_add_item(tree
, hf_os_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
604 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
608 offset
= display_LM_token(tvb
, offset
, tree
);
616 dissect_smb_acc_update(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
618 /*** 0x11 LM2.1 Announce Acc updates ***/
621 proto_tree_add_item(tree
, hf_signature
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
625 /* XXX - what format is this? Neither SMB_Date/SMB_Time nor
626 "time_t but in the local time zone" appear to be correct. */
627 proto_tree_add_item(tree
, hf_date_time
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
631 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_computer_name
, NULL
);
634 offset
= display_ms_string(tvb
, pinfo
, tree
, offset
, hf_user_name
, NULL
);
637 proto_tree_add_item(tree
, hf_update_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
641 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
645 offset
= display_LM_token(tvb
, offset
, tree
);
653 dissect_smb_inter_resp(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
655 /* 0x0e LanMan Response to interrogate request */
658 proto_tree_add_item(tree
, hf_major_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
662 proto_tree_add_item(tree
, hf_minor_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
666 proto_tree_add_item(tree
, hf_os_version
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
670 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
674 offset
= display_LMNT_token(tvb
, offset
, tree
);
676 /* XXX - no LM token? Every other packet has one after the LMNT
684 dissect_smb_sam_logon_resp(tvbuff_t
*tvb
, packet_info
*pinfo
,
685 proto_tree
*tree
, int offset
)
687 /* Netlogon command 0x13 - decode the SAM logon response from server */
688 /* Netlogon command 0x15 - decode the SAM logon response from server unknown user */
691 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_server_name
, NULL
);
694 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_user_name
, NULL
);
697 offset
= display_unicode_string(tvb
, pinfo
, tree
, offset
, hf_domain_name
, NULL
);
700 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
704 offset
= display_LMNT_token(tvb
, offset
, tree
);
707 offset
= display_LM_token(tvb
, offset
, tree
);
713 dissect_smb_pdc_response_ads(tvbuff_t
*tvb
, packet_info
*pinfo
,
714 proto_tree
*tree
, int offset
)
716 /* Netlogon command 0x17 - decode the response from PDC ADS */
717 /* Netlogon command 0x19 - decode the response from PDC ADS USER ?*/
719 /* Align to four-byte boundary */
720 offset
= ((offset
+ 3)/4)*4;
722 /* unknown uint32 type */
723 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
727 proto_tree_add_item(tree
, hf_domain_guid
, tvb
, offset
, 16, ENC_NA
);
730 /* forest dns name */
731 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_forest_dns_name
, NULL
);
733 /* domain dns name */
734 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_domain_dns_name
, NULL
);
736 /* server dns name */
737 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_server_dns_name
, NULL
);
740 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_domain_name
, NULL
);
743 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_server_name
, NULL
);
746 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_user_name
, NULL
);
748 /* server_site name */
749 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_server_site_name
, NULL
);
751 /* client_site name */
752 offset
=dissect_ms_compressed_string(tvb
, pinfo
, tree
, offset
, hf_client_site_name
, NULL
);
754 /* unknown uint8 type */
755 proto_tree_add_item(tree
, hf_unknown8
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
758 /* unknown uint32 type */
759 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
763 proto_tree_add_item(tree
, hf_server_ip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
766 /* unknown uint32 type */
767 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
770 /* unknown uint32 type */
771 proto_tree_add_item(tree
, hf_unknown32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
775 proto_tree_add_item(tree
, hf_nt_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
779 offset
= display_LMNT_token(tvb
, offset
, tree
);
782 offset
= display_LM_token(tvb
, offset
, tree
);
788 dissect_smb_unknown(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
)
790 /* display data as unknown */
792 proto_tree_add_item(tree
, hf_data
, tvb
, offset
, -1, ENC_NA
);
794 return offset
+tvb_reported_length_remaining(tvb
, offset
);
797 #define LOGON_LM10_LOGON_REQUEST 0x00
798 #define LOGON_LM10_LOGON_RESPONSE 0x01
799 #define LOGON_LM10_QUERY_CI 0x02
800 #define LOGON_LM10_QUERY_DI 0x03
801 #define LOGON_LM10_RESPONSE_CI 0x04
802 #define LOGON_LM10_RESPONSE_DI 0x05
803 #define LOGON_LM20_LOGON_RESPONSE 0x06
804 #define LOGON_PDC_QUERY 0x07
805 #define LOGON_PDC_STARTUP 0x08
806 #define LOGON_PDC_FAILED 0x09
807 #define LOGON_UAS_SAM 0x0a
808 #define LOGON_NO_USER 0x0b
809 #define LOGON_PDC_RESPONSE 0x0c
810 #define LOGON_RELOGON_RESPONSE 0x0d
811 #define LOGON_INTERROGATE_RESPONSE 0x0e
812 #define LOGON_LM20_RESPONSE_DURING_LOGON 0x0f
813 #define LOGON_LM20_USER_UNKNOWN 0x10
814 #define LOGON_LM20_ACCOUNT_UPDATE 0x11
815 #define LOGON_SAM_LOGON_REQUEST 0x12
816 #define LOGON_SAM_LOGON_RESPONSE 0x13
817 #define LOGON_SAM_RESPONSE_DURING_LOGON 0x14
818 #define LOGON_SAM_USER_UNKNOWN 0x15
819 #define LOGON_SAM_INTERROGATE_RESPONSE 0x16
820 #define LOGON_SAM_AD_USER_UNKNOWN 0x17
821 #define LOGON_SAM_UNKNOWN_18 0x18
822 #define LOGON_SAM_AD_LOGON_RESPONSE 0x19
823 #define LOGON_LAST_CMD 0x19
825 static const value_string commands
[] = {
826 {LOGON_LM10_LOGON_REQUEST
, "LM1.0/LM2.0 LOGON Request"},
827 {LOGON_LM10_LOGON_RESPONSE
, "LM1.0 LOGON Response"},
828 {LOGON_LM10_QUERY_CI
, "LM1.0 Query - Centralized Initialization"},
829 {LOGON_LM10_QUERY_DI
, "LM1.0 Query - Distributed Initialization"},
830 {LOGON_LM10_RESPONSE_CI
, "LM1.0 Response - Centralized Query"},
831 {LOGON_LM10_RESPONSE_DI
, "LM1.0 Response - Distributed Initialization"},
832 {LOGON_LM20_LOGON_RESPONSE
, "LM2.0 Response to LOGON Request"},
833 {LOGON_PDC_QUERY
, "Query for PDC"},
834 {LOGON_PDC_STARTUP
, "Announce Startup of PDC"},
835 {LOGON_PDC_FAILED
, "Announce Failed PDC"},
836 {LOGON_UAS_SAM
, "Announce Change to UAS or SAM"},
837 {LOGON_NO_USER
, "Announce no user on machine"},
838 {LOGON_PDC_RESPONSE
, "Response from PDC"},
839 {LOGON_RELOGON_RESPONSE
, "LM1.0/LM2.0 Response to re-LOGON Request"},
840 {LOGON_INTERROGATE_RESPONSE
, "LM1.0/LM2.0 Response to Interrogate Request"},
841 {LOGON_LM20_RESPONSE_DURING_LOGON
, "LM2.0 Response during LOGON pause"},
842 {LOGON_LM20_USER_UNKNOWN
, "LM2.0 Response - user unknown"},
843 {LOGON_LM20_ACCOUNT_UPDATE
, "LM2.0 Announce account updates"},
844 {LOGON_SAM_LOGON_REQUEST
, "SAM LOGON request from client"},
845 {LOGON_SAM_LOGON_RESPONSE
, "Response to SAM LOGON request"},
846 {LOGON_SAM_RESPONSE_DURING_LOGON
, "SAM Response during LOGON pause"},
847 {LOGON_SAM_USER_UNKNOWN
, "SAM Response - user unknown"},
848 {LOGON_SAM_INTERROGATE_RESPONSE
, "SAM Response to Interrogate Request"},
849 {LOGON_SAM_AD_USER_UNKNOWN
, "SAM Active Directory Response - user unknown"},
850 {LOGON_SAM_UNKNOWN_18
, "SAM unknown command 0x18"},
851 {LOGON_SAM_AD_LOGON_RESPONSE
, "Active Directory Response to SAM LOGON request"},
855 static int (*dissect_smb_logon_cmds
[])(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
) = {
856 dissect_smb_logon_request
, /* 0x00 (LM1.0/LM2.0 LOGON Request) */
857 dissect_smb_logon_LM10_resp
, /* 0x01 (LM1.0 LOGON Response) */
858 dissect_smb_logon_2
, /* 0x02 (LM1.0 Query Centralized Init.)*/
859 dissect_smb_logon_2
, /* 0x03 (LM1.0 Query Distributed Init.)*/
860 dissect_smb_logon_2
, /* 0x04 (LM1.0 Centralized Query Resp.)*/
861 dissect_smb_logon_2
, /* 0x05 (LM1.0 Distributed Query Resp.) */
862 dissect_smb_logon_LM20_resp
, /* 0x06 (LM2.0 LOGON Response) */
863 dissect_smb_pdc_query
, /* 0x07 (Query for PDC) */
864 dissect_smb_pdc_startup
, /* 0x08 (Announce PDC startup) */
865 dissect_smb_pdc_failure
, /* 0x09 (Announce Failed PDC) */
866 dissect_announce_change
, /* 0x0A (Announce Change to UAS or SAM)*/
867 dissect_smb_no_user
, /* 0x0B (Announce no user on machine)*/
868 dissect_smb_pdc_startup
, /* 0x0C (Response from PDC) */
869 dissect_smb_relogon_resp
, /* 0x0D (Relogon response) */
870 dissect_smb_inter_resp
, /* 0x0E (Interrogate response) */
871 dissect_smb_pdc_failure
, /* 0x0F (LM2.0 Resp. during LOGON pause*/
872 dissect_smb_pdc_failure
, /* 0x10 (LM 2.0 Unknown user response)*/
873 dissect_smb_acc_update
, /* 0x11 (LM2.1 Announce Acc updates)*/
874 dissect_smb_sam_logon_req
, /* 0x12 (SAM LOGON request ) */
875 dissect_smb_sam_logon_resp
, /* 0x13 (SAM LOGON response) */
876 dissect_smb_unknown
, /* 0x14 (SAM Response during LOGON Pause) */
877 dissect_smb_sam_logon_resp
, /* 0x15 (SAM Response User Unknown) */
878 dissect_smb_unknown
, /* 0x16 (SAM Response to Interrogate)*/
879 dissect_smb_pdc_response_ads
, /* 0x17 (SAM AD response User Unknown*/
880 dissect_smb_unknown
, /* 0x18 (Unknown command) */
881 dissect_smb_pdc_response_ads
/* 0x19 (SAM LOGON AD response) */
886 dissect_smb_logon(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
890 proto_tree
*smb_logon_tree
= NULL
;
891 proto_item
*item
= NULL
;
893 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "SMB_NETLOGON");
894 col_clear(pinfo
->cinfo
, COL_INFO
);
896 /* get the Command field */
897 cmd
= tvb_get_uint8(tvb
, offset
);
899 col_add_str(pinfo
->cinfo
, COL_INFO
, val_to_str(cmd
, commands
, "Unknown Command:%02x") );
902 item
= proto_tree_add_item(tree
, proto_smb_logon
, tvb
,
905 smb_logon_tree
= proto_item_add_subtree(item
, ett_smb_logon
);
909 proto_tree_add_uint(smb_logon_tree
, hf_command
, tvb
, offset
, 1, cmd
);
915 if (cmd
<LOGON_LAST_CMD
) {
916 (dissect_smb_logon_cmds
[cmd
])(tvb
, pinfo
,
917 smb_logon_tree
, offset
);
919 /* unknown command */
920 dissect_smb_unknown(tvb
, pinfo
, smb_logon_tree
,
923 return tvb_captured_length(tvb
);
927 proto_register_smb_logon( void)
929 static hf_register_info hf
[] = {
931 { "Command", "smb_netlogon.command", FT_UINT8
, BASE_HEX
,
932 VALS(commands
), 0, "SMB NETLOGON Command", HFILL
}},
935 { "Computer Name", "smb_netlogon.computer_name", FT_STRING
, BASE_NONE
,
936 NULL
, 0, "SMB NETLOGON Computer Name", HFILL
}},
938 { &hf_unicode_computer_name
,
939 { "Unicode Computer Name", "smb_netlogon.unicode_computer_name", FT_STRING
, BASE_NONE
,
940 NULL
, 0, "SMB NETLOGON Unicode Computer Name", HFILL
}},
943 { "Server Name", "smb_netlogon.server_name", FT_STRING
, BASE_NONE
,
944 NULL
, 0, "SMB NETLOGON Server Name", HFILL
}},
946 { &hf_server_dns_name
,
947 { "Server DNS Name", "smb_netlogon.server_dns_name", FT_STRING
, BASE_NONE
,
948 NULL
, 0, "SMB NETLOGON Server DNS Name", HFILL
}},
951 { "User Name", "smb_netlogon.user_name", FT_STRING
, BASE_NONE
,
952 NULL
, 0, "SMB NETLOGON User Name", HFILL
}},
955 { "Domain Name", "smb_netlogon.domain_name", FT_STRING
, BASE_NONE
,
956 NULL
, 0, "SMB NETLOGON Domain Name", HFILL
}},
958 { &hf_domain_dns_name
,
959 { "Domain DNS Name", "smb_netlogon.domain_dns_name", FT_STRING
, BASE_NONE
,
960 NULL
, 0, "SMB NETLOGON Domain DNS Name", HFILL
}},
962 { &hf_forest_dns_name
,
963 { "Forest DNS Name", "smb_netlogon.forest_dns_name", FT_STRING
, BASE_NONE
,
964 NULL
, 0, "SMB NETLOGON Forest DNS Name", HFILL
}},
967 { "Mailslot Name", "smb_netlogon.mailslot_name", FT_STRING
, BASE_NONE
,
968 NULL
, 0, "SMB NETLOGON Mailslot Name", HFILL
}},
971 { "PDC Name", "smb_netlogon.pdc_name", FT_STRING
, BASE_NONE
,
972 NULL
, 0, "SMB NETLOGON PDC Name", HFILL
}},
974 { &hf_unicode_pdc_name
,
975 { "Unicode PDC Name", "smb_netlogon.unicode_pdc_name", FT_STRING
, BASE_NONE
,
976 NULL
, 0, "SMB NETLOGON Unicode PDC Name", HFILL
}},
979 { "Script Name", "smb_netlogon.script_name", FT_STRING
, BASE_NONE
,
980 NULL
, 0, "SMB NETLOGON Script Name", HFILL
}},
983 { "NT Version", "smb_netlogon.nt_version", FT_UINT32
, BASE_DEC
,
984 NULL
, 0, "SMB NETLOGON NT Version", HFILL
}},
986 /* An LMNT Token, if 0xffff, is "WindowsNT Networking";
987 what is it otherwise? */
989 { "LMNT Token", "smb_netlogon.lmnt_token", FT_UINT16
, BASE_HEX
,
990 NULL
, 0, "SMB NETLOGON LMNT Token", HFILL
}},
993 { "LM Token", "smb_netlogon.lm_token", FT_UINT16
, BASE_HEX
,
994 NULL
, 0, "SMB NETLOGON LM Token", HFILL
}},
997 { "Workstation Major Version", "smb_netlogon.major_version", FT_UINT8
, BASE_DEC
,
998 NULL
, 0, "SMB NETLOGON Workstation Major Version", HFILL
}},
1000 { &hf_minor_version
,
1001 { "Workstation Minor Version", "smb_netlogon.minor_version", FT_UINT8
, BASE_DEC
,
1002 NULL
, 0, "SMB NETLOGON Workstation Minor Version", HFILL
}},
1005 { "Workstation OS Version", "smb_netlogon.os_version", FT_UINT8
, BASE_DEC
,
1006 NULL
, 0, "SMB NETLOGON Workstation OS Version", HFILL
}},
1009 { "Signature", "smb_netlogon.signature", FT_UINT64
, BASE_HEX
,
1010 NULL
, 0, NULL
, HFILL
}},
1013 { "Date/Time", "smb_netlogon.date_time", FT_UINT32
, BASE_DEC
,
1014 NULL
, 0, "SMB NETLOGON Date/Time", HFILL
}},
1017 { "Update Type", "smb_netlogon.update", FT_UINT16
, BASE_DEC
,
1018 NULL
, 0, "SMB NETLOGON Update Type", HFILL
}},
1020 { &hf_request_count
,
1021 { "Request Count", "smb_netlogon.request_count", FT_UINT16
, BASE_DEC
,
1022 NULL
, 0, "SMB NETLOGON Request Count", HFILL
}},
1024 { &hf_account_control
,
1025 { "Account control", "smb_netlogon.flags", FT_UINT32
, BASE_HEX
,
1026 NULL
, 0, NULL
, HFILL
}},
1028 { &hf_flags_autolock
,
1029 { "Autolock", "smb_netlogon.flags.autolock", FT_BOOLEAN
, 32,
1030 TFS(&tfs_flags_autolock
), ACC_FLAG_AUTO_LOCKED
, "SMB NETLOGON Account Autolock", HFILL
}},
1033 { "Expire", "smb_netlogon.flags.expire", FT_BOOLEAN
, 32,
1034 TFS(&tfs_flags_expire
), ACC_FLAG_EXPIRE
, "SMB NETLOGON Will Account Expire", HFILL
}},
1036 { &hf_flags_server_trust
,
1037 { "Server Trust", "smb_netlogon.flags.server", FT_BOOLEAN
, 32,
1038 TFS(&tfs_flags_server_trust
), ACC_FLAG_SERVER_TRUST
, "SMB NETLOGON Server Trust Account", HFILL
}},
1040 { &hf_flags_workstation_trust
,
1041 { "Workstation Trust", "smb_netlogon.flags.workstation", FT_BOOLEAN
, 32,
1042 TFS(&tfs_flags_workstation_trust
), ACC_FLAG_WORKSTATION_TRUST
, "SMB NETLOGON Workstation Trust Account", HFILL
}},
1044 { &hf_flags_interdomain_trust
,
1045 { "Interdomain Trust", "smb_netlogon.flags.interdomain", FT_BOOLEAN
, 32,
1046 TFS(&tfs_flags_interdomain_trust
), ACC_FLAG_INTERDOMAIN_TRUST
, "SMB NETLOGON Inter-domain Trust Account", HFILL
}},
1048 { &hf_flags_mns_user
,
1049 { "MNS User", "smb_netlogon.flags.mns", FT_BOOLEAN
, 32,
1050 TFS(&tfs_flags_mns_user
), ACC_FLAG_MNS_USER
, "SMB NETLOGON MNS User Account", HFILL
}},
1052 { &hf_flags_normal_user
,
1053 { "Normal User", "smb_netlogon.flags.normal", FT_BOOLEAN
, 32,
1054 TFS(&tfs_flags_normal_user
), ACC_FLAG_NORMAL_USER
, "SMB NETLOGON Normal User Account", HFILL
}},
1056 { &hf_flags_temp_dup_user
,
1057 { "Temp Duplicate User", "smb_netlogon.flags.temp_dup", FT_BOOLEAN
, 32,
1058 TFS(&tfs_flags_temp_dup_user
), ACC_FLAG_TEMP_DUP_USER
, "SMB NETLOGON Temp Duplicate User Account", HFILL
}},
1060 { &hf_flags_password_required
,
1061 { "Password", "smb_netlogon.flags.password", FT_BOOLEAN
, 32,
1062 TFS(&tfs_flags_password_required
), ACC_FLAG_PASSWORD_REQUIRED
, "SMB NETLOGON Password Required", HFILL
}},
1064 { &hf_flags_homedir_required
,
1065 { "Homedir", "smb_netlogon.flags.homedir", FT_BOOLEAN
, 32,
1066 TFS(&tfs_flags_homedir_required
), ACC_FLAG_HOMEDIR_REQUIRED
, "SMB NETLOGON Homedir Required", HFILL
}},
1068 { &hf_flags_enabled
,
1069 { "Enabled", "smb_netlogon.flags.enabled", FT_BOOLEAN
, 32,
1070 TFS(&tfs_flags_enabled
), ACC_FLAG_ENABLED
, "SMB NETLOGON Is This Account Enabled", HFILL
}},
1072 { &hf_domain_sid_size
,
1073 { "Domain SID Size", "smb_netlogon.domain_sid_size", FT_UINT32
, BASE_DEC
,
1074 NULL
, 0, "SMB NETLOGON Domain SID Size", HFILL
}},
1077 { "Low Serial Number", "smb_netlogon.low_serial", FT_UINT32
, BASE_DEC
,
1078 NULL
, 0, "SMB NETLOGON Low Serial Number", HFILL
}},
1081 { "Pulse", "smb_netlogon.pulse", FT_UINT32
, BASE_DEC
,
1082 NULL
, 0, "SMB NETLOGON Pulse", HFILL
}},
1085 { "Random", "smb_netlogon.random", FT_UINT32
, BASE_DEC
,
1086 NULL
, 0, "SMB NETLOGON Random", HFILL
}},
1089 { "DB Count", "smb_netlogon.db_count", FT_UINT32
, BASE_DEC
,
1090 NULL
, 0, "SMB NETLOGON DB Count", HFILL
}},
1093 { "Database Index", "smb_netlogon.db_index", FT_UINT32
, BASE_DEC
,
1094 NULL
, 0, "SMB NETLOGON Database Index", HFILL
}},
1097 { "Large Serial Number", "smb_netlogon.large_serial", FT_UINT64
, BASE_DEC
,
1098 NULL
, 0, "SMB NETLOGON Large Serial Number", HFILL
}},
1101 { "NT Date/Time", "smb_netlogon.nt_date_time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
1102 NULL
, 0, "SMB NETLOGON NT Date/Time", HFILL
}},
1105 { "Unknown", "smb_netlogon.unknown", FT_UINT8
, BASE_HEX
,
1106 NULL
, 0, NULL
, HFILL
}},
1109 { "Unknown", "smb_netlogon.unknown", FT_UINT32
, BASE_HEX
,
1110 NULL
, 0, NULL
, HFILL
}},
1113 { "Domain GUID", "smb_netlogon.domain.guid", FT_BYTES
, BASE_NONE
,
1114 NULL
, 0x0, NULL
, HFILL
}},
1117 "Server IP", "smb_netlogon.server_ip", FT_IPv4
, BASE_NONE
,
1118 NULL
, 0x0, "Server IP Address", HFILL
}},
1120 { &hf_server_site_name
,
1121 { "Server Site Name", "smb_netlogon.server_site_name", FT_STRING
, BASE_NONE
,
1122 NULL
, 0, "SMB NETLOGON Server Site Name", HFILL
}},
1124 { &hf_client_site_name
,
1125 { "Client Site Name", "smb_netlogon.client_site_name", FT_STRING
, BASE_NONE
,
1126 NULL
, 0, "SMB NETLOGON Client Site Name", HFILL
}},
1129 { "Data", "smb_netlogon.data", FT_BYTES
, BASE_NONE
,
1130 NULL
, 0, NULL
, HFILL
}},
1133 static int *ett
[] = {
1135 &ett_smb_account_flags
,
1139 proto_smb_logon
= proto_register_protocol("Microsoft Windows Logon Protocol (Old)", "SMB_NETLOGON", "smb_netlogon");
1141 proto_register_field_array(proto_smb_logon
, hf
, array_length(hf
));
1142 proto_register_subtree_array(ett
, array_length(ett
));
1144 register_dissector("smb_netlogon", dissect_smb_logon
, proto_smb_logon
);
1148 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1153 * indent-tabs-mode: t
1156 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1157 * :indentSize=8:tabSize=8:noTabs=false: