Commit Graph

45 Commits

Author SHA1 Message Date
Tim Potter 2d33b62811 This commit refactors the dcerpc authentication subdissectors for
handling encrypted request/response PDUs.  Instead of having
dissection function pointers which perform both decryption and
dissection, the function pointers now only decrypt the DCERPC fragment
payload.  Dissection is handled by the dcerpc_try_handoff() function
(with DCERPC fragment reassembly if necessary).

Details:

 - Move the dcerpc_auth_info struct into dcerpc.h as it is now used in
   the function prototype for the decryption function handlers.

 - decode_encrypted_data() was refactored to take a boolean request
   parameter instead of passing the DCERPC PDU packet type.

 - A tvbuff_t * data field was added to dcerpc_auth to hold the
   verifier.  This is passed as an argument to the decryption function
   handlers.

 - Dissection of verifiers in request and response PDUs was moved to
   before the payload.

 - The dissect_dcerpc_cn_stub() function was refactored to perform
   the decryption process and hand decrypted data to the reassembly
   code instead of performing the decryption after reassembly.

 - Removed references to decrypted_info_t as it's not necessary
   anymore.

Code was tested using encrypted and unencrypted fragmented PDUs.
Before this commit ethereal could not dissect unencrypted (!)
fragmented PDUs correctly.

svn path=/trunk/; revision=8546
2003-09-26 06:30:13 +00:00
Guy Harris 9f62e50a7d From Devin Heitmueller: make offsets into tvbuffs 32-bit.
svn path=/trunk/; revision=8326
2003-09-01 00:01:39 +00:00
Ronnie Sahlberg 7b06f1814f From Devin H, update to NTLMSSP to better handle address lists
svn path=/trunk/; revision=8228
2003-08-24 01:29:50 +00:00
Guy Harris a9a326cec8 I've seen NTLMSSP DCE RPC packets with a protection level of
DCE_C_AUTHN_LEVEL_CONNECT.

svn path=/trunk/; revision=8042
2003-07-18 05:51:21 +00:00
Tim Potter 8b89bd76ee Move all DCERPC authentication/encryption dissection code from packet-dcerpc.c
to the dissector that handles the particular authentication flavour.  This
gets rid of a couple of ugly switch statements and allows other authentication
modules to be written easily.

svn path=/trunk/; revision=8026
2003-07-16 04:20:33 +00:00
Tim Potter 2b39831b5b Move the ntlmv2 response dissection out of packet-ntlmssp.c and in to
packet-smb-common.c so it can be used elsewhere.

Dissect a ntlmv2 response in a session setup SMB if detected.

svn path=/trunk/; revision=7655
2003-05-09 01:41:28 +00:00
Tim Potter 04c95838a0 Whoops - had that test reversed.
svn path=/trunk/; revision=7648
2003-05-07 07:12:50 +00:00
Tim Potter f7c07ddbae Don't try and dissect a zero length NTLM response as a NTLMv2 response.
svn path=/trunk/; revision=7647
2003-05-07 04:32:59 +00:00
Tim Potter c7cf9a4207 Parse a NTLMv2 response blob as documented in
http://ubiqx.org/cifs/SMB.html#8, para 2.8.5.3

Convert some magic numbers to constants in dissect_ntlmssp_address_list()

svn path=/trunk/; revision=7646
2003-05-07 04:07:45 +00:00
Guy Harris 569e74a1f3 When registering a string preference, if the value of the preference is
NULL, convert it to a copy of a null string, otherwise replace it with a
copy of the string, so that we know that the variable for the preference
always points to a string that can be freed.

That also obviates the need to worry about a null-pointer value for a
preference variable when checking to see whether a preference has changed.

When checking for a string preference not being set, check for an empty
string, not a null pointer - the above code turns null pointers into
pointers to empty strings, *and* the GUI code does (and always did!) the
same.

svn path=/trunk/; revision=7342
2003-03-11 22:51:52 +00:00
Guy Harris 53f465a984 From Todd Sabin: allocate the buffer for the decrypted payload, rather
than using a fixed-size 1500-byte buffer.

Use memory chunks for ntlmssp_info and ntlmssp_packet_info structures,
and free up the chunks when we re-initialize the dissector.

svn path=/trunk/; revision=7277
2003-03-04 20:52:33 +00:00
Ronnie Sahlberg a80ddab6fd Update DCERPC so that for (NTLMSSP) PDUs that have been decrypted
we also call the proper DCERPC subdissector.

With this change ethereal will call the SAMR dissector and dissect the
decrypted SAMR packets in devins capture.

svn path=/trunk/; revision=6855
2003-01-06 11:27:03 +00:00
Guy Harris 3a92530a52 From Devin Heitmueller: support for decrypting DCERPC conversations
using NTLMSSP version 1.

Show stub data as such for all requests and replies where we can't
dissect the stub data as a request or reply for some DCERPC-based
protocol.

svn path=/trunk/; revision=6825
2002-12-31 08:05:29 +00:00
Guy Harris 35eefef60a Handle GSS_Wrap header information as well as context-level tokens. A
call to "gssapi_init_oid()" supplies both dissectors for context-level
tokens and GSS_Wrap header information; the latter dissector should
return the number of bytes of header information, so that if the header
information and the message for the protocol that's using GSSAPI are
treated as a single blob of data (as is the case with LDAP, but not with
DCE RPC, for example), the dissector for the protocol using GSSAPI knows
where to start dissecting.

We associate a pointer to the entire data structure for the OID, not the
handle for context-level token dissector for the OID, with conversations
and frames.

Make the dissector for NTLMSSP verifiers be the handler for GSS_Wrap
stuff for NTLMSSP, and add support for GSS_Wrap stuff for Kerberos.

Support SASL GSS-SPNEGO wrapping of LDAP messages.  (XXX - this should
really check for GSS-SPNEGO.)

svn path=/trunk/; revision=6692
2002-11-28 06:48:42 +00:00
Guy Harris 262744d2b2 Dissect NTLMSSP authentication verifiers, as per lkcl's "DCE/RPC over
SMB" book.

svn path=/trunk/; revision=6598
2002-11-10 09:38:22 +00:00
Guy Harris 9f9e93fe79 It doesn't appear as if any flag in the preceding NEGOTIATE or CHALLENGE
message indicates whether the session key or flags are missing in an
AUTH message - and it appears that the session key can be present
without the flags.

For both fields, check whether the offset is after the offset of the
first data chunk and, if so, assume the field is missing.

This means we no longer need to remember the flags for a NEGOTIATE
message, so just remember them for a CHALLENGE message.

svn path=/trunk/; revision=6585
2002-11-08 06:02:18 +00:00
Guy Harris 3adaa6fc1e Get rid of an unused variable.
Fix the name of a field to begin with "ntlmssp".

svn path=/trunk/; revision=6582
2002-11-08 04:25:00 +00:00
Guy Harris 643ea3debf If NTLMSSP_NEGOTIATE_UNICODE is different in the negotiate and challenge
messages, the value in the challenge message is what should be used to
determine how to dissect the auth message.

svn path=/trunk/; revision=6581
2002-11-08 01:45:37 +00:00
Guy Harris 3f8f3c6119 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
Guy Harris 9b2845f8ea Fix the offset for the flags in an NTLMSSP_AUTH message.
svn path=/trunk/; revision=6504
2002-10-25 03:40:13 +00:00
Tim Potter 6a789856ad Fixed a bitwise vs logical AND bug when checking the ntlmssp flags for
the unicode bit.

Also, it seems that the strings in the address list of a
NTLMSSP_CHALLENGE message are always in unicode, regardless of the
negotiated string type.  I have a capture of win98 doing NTLM over
HTTP where the domain name is in ASCII but the address list is
unicode.

There is still a bug in the dissection of the NTLMSSP_AUTH message
where the flags value does not specify unicode but the
domain/user/host name is unicode.  Perhaps the flags value for this
message aren't NTLMSSP flags?

Guy/Richard/jmayer, if you have any captures that show different
behaviour can you send them my way?

svn path=/trunk/; revision=6329
2002-09-24 00:40:42 +00:00
Tim Potter 081a11b3d6 Add NTLMSSP message type to COL_INFO. This looks nice for NTLM over
HTTP, but NTLMSSP_CHALLENGE appears twice in a session setup response
SPNEGO negTokenTarg, as the NTLMSSP message appears both in the
responseToken and mechListMIC fields.

svn path=/trunk/; revision=6328
2002-09-24 00:14:46 +00:00
Tim Potter abf520e1cc Add an entry to the protocol tree for NULL strings in
dissect_ntlmssp_strings().  It seems that most versions of IE don't
set the workstation name and domain name in the NTLMSSP_NEGOTIATE
message when doing NTLM over HTTP.

svn path=/trunk/; revision=6327
2002-09-23 22:55:32 +00:00
Tim Potter d0a0a41eaf Got rid of some nested parenthesis in the gssapi oid registrations.
svn path=/trunk/; revision=6302
2002-09-18 08:36:25 +00:00
Richard Sharpe 2ee9444112 Small fix from Jim McDonough to fix the order of domain and workstation name
in a negotiate.

svn path=/trunk/; revision=6276
2002-09-11 17:47:32 +00:00
Richard Sharpe 356cc5009e Small patch from Jim McDonough from IBM for problems with the Negotiate NTLMSSP frame.
svn path=/trunk/; revision=6275
2002-09-11 16:45:07 +00:00
Richard Sharpe 48a5798890 A small fix to avoid a crash. Needs more work, though ...
svn path=/trunk/; revision=6266
2002-09-11 02:23:14 +00:00
Guy Harris 2c4b766dc1 From Jim McDonough: update NTLMSSP decoding to do:
- strings are now in a subtree of a command, printing only the
	  text unless you go into the subtree (to see length, offset)

	- generic blobs are the same as strings, only displayed in hex

	- NTLMSSP challenge address lists are decoded

	- a couple of unknown fields are now known

svn path=/trunk/; revision=6263
2002-09-10 23:44:17 +00:00
Guy Harris 849e1c6866 Add a "gssapi_lookup_oid()" that takes a binary OID (pointer and length)
as an argument, and looks up that OID in the GSSAPI OID hash table.

Always use that routine to look up OIDs, so that we never use the result
of "format_oid()" as the key (as that doesn't necessarily work).

Make "gssapi_oids" static, as one should only look up GSSAPI
authentication mechanism OIDs with "gssapi_lookup_oid()".

In the SPNEGO dissector, free up the OID strings when we're done with
them, and don't advance the offset past the OID until after we put the
OID into the protocol tree.

svn path=/trunk/; revision=6228
2002-09-08 01:43:44 +00:00
Richard Sharpe 428c514ba6 Fix a spelling mistake.
svn path=/trunk/; revision=6219
2002-09-07 15:45:28 +00:00
Richard Sharpe 174fb49854 Add some level of OID naming etc ...
svn path=/trunk/; revision=6180
2002-09-04 21:34:38 +00:00
Richard Sharpe a842eb9d8e Who was that fscking idiot who put a \n into the mechListMIC format specifier!
svn path=/trunk/; revision=6172
2002-09-03 16:45:31 +00:00
Guy Harris 4e4000a12d Make "gssapi_init_oid()" take a dissector handle rather than a
registered dissector name; that means you don't have to register a
dissector by name to associate it with a GSS-API security mechanism OID.

svn path=/trunk/; revision=6163
2002-08-31 22:22:29 +00:00
Guy Harris 8fbf4e59af Catch exceptions thrown while dissecting the NTLMSSP stuff, so that we
don't abort dissection of the entire packet if we get a
ReportedBoundsError while dissecting an authentication blob - the
authentication blob might be in the middle of a packet, and if it's too
short, that doesn't mean that the stuff *after* it shouldn't be
dissected.

A length of "-1" when adding items that have variable-length data
(FT_NONE, FT_PROTOCOL, FT_BYTES, and FT_STRING; this includes stuff
added with "proto_tree_add_text()") means "to the end of the tvbuff"; we
don't need to fetch the length of the tvbuff and use that.

svn path=/trunk/; revision=6161
2002-08-31 20:25:43 +00:00
Guy Harris d2143a880e Include "packet-gssapi.h" to declare routines we call.
svn path=/trunk/; revision=6142
2002-08-30 10:05:26 +00:00
Richard Sharpe 1a46e38d20 More SPNEGO, now can get down to NTLMSSP if that is what the negTokenTarg
contains.

svn path=/trunk/; revision=6133
2002-08-30 00:32:11 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Tim Potter 60e4ca9c4f Moved the generic true_false_string saying "Set", "Not set" into
epan/packet.c

It was cut and pasted into seven other dissectors!

svn path=/trunk/; revision=6052
2002-08-21 21:25:23 +00:00
Guy Harris 868c88686f If the length of a string is zero, don't put it into the protocol tree.
Handle the case where "get_unicode_or_ascii_string()" returns a null
pointer (which can be the case if the length supplied is zero, which we
check for as per the above, but can also be the case for a Unicode
string if the length supplied is 1 byte).

Fix a call to "proto_tree_add_uint()" that was presumably supposed to be
a call to "proto_tree_add_item()".

svn path=/trunk/; revision=6015
2002-08-18 20:33:47 +00:00
Guy Harris 5c4e8e546d Add a terminator to the ntlmssp_message_types list.
svn path=/trunk/; revision=5977
2002-08-10 23:16:37 +00:00
Guy Harris 2cfb231081 From Devin Heitmueller: dissect NTLMSSP authentication messages, and handle
the flags field in NTLMSSP messages as a 32-bit field.

Make "get_unicode_or_ascii_string()" take a "Unicode or not" flag rather
than a "packet_info *" as an argument, make it not static, and move it
to "packet-smb-common.c", so that it can be used by the SMB dissector
and the NTLMSSP dissector.  Also get rid of some _U_'s that are applied
to arguments that are, in fact, used.

svn path=/trunk/; revision=5976
2002-08-10 21:15:37 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris 4d1afddfab Show lengths as decimal, not hex.
Show an authentication message's contents as "Unknown contents", not as
an "Unrecognized NTLMSSP Message".

svn path=/trunk/; revision=5854
2002-07-10 06:17:55 +00:00
Tim Potter 7ad8ddcc46 Reordered some boolean fields to be consistent with the rest of ethereal.
svn path=/trunk/; revision=5850
2002-07-10 02:59:38 +00:00
Tim Potter 8d4650823d Dissector for DCERPC auth type == 10 (NTLMSSP) from
dheitmueller@netilla.com.

svn path=/trunk/; revision=5848
2002-07-09 20:49:27 +00:00