Expand description
Minimal NTLMSSP ([MS-NLMP]) message construction/parsing plus the SPNEGO DER wrapping used during extended-security session setup.
Both SMB1 (SESSION_SETUP_ANDX with CAP_EXTENDED_SECURITY) and SMB2
session setup speak this exact dialect of tokens, so the module is
shared between protocol implementations.
Structs§
- Type3
- Parsed AUTHENTICATE (type 3) message.
Constants§
- MSG_
TYPE1 - NEGOTIATE message identifier.
- MSG_
TYPE2 - CHALLENGE message identifier.
- MSG_
TYPE3 - AUTHENTICATE message identifier.
- NEGOTIATE_
128 - 128-bit crypto strength requested.
- NEGOTIATE_
ALWAYS_ SIGN - Always sign messages.
- NEGOTIATE_
ANONYMOUS - Client requests anonymous authentication.
- NEGOTIATE_
DOMAIN_ SUPPLIED - Domain name supplied by the client.
- NEGOTIATE_
EXTENDED_ SESSIONSECURITY - Extended session security (NTLM2).
- NEGOTIATE_
KEY_ EXCH - Key exchange negotiated ([MS-NLMP] §2.2.2.5): the AUTHENTICATE message carries an RC4-encrypted RandomSessionKey.
- NEGOTIATE_
NTLM - NTLM authentication (as opposed to LM-only).
- NEGOTIATE_
SEAL - Sealing (encryption) is supported.
- NEGOTIATE_
SIGN - Message signing is supported.
- NEGOTIATE_
TARGET_ INFO - Target info AV pairs are present.
- NEGOTIATE_
UNICODE - Request/response Unicode strings.
- NEGOTIATE_
VERSION - Version structure present.
- NTLMSSP_
SIG - Wire signature every NTLMSSP message begins with.
- REQUEST_
TARGET - Server must include a target name in the CHALLENGE.
- TARGET_
TYPE_ DOMAIN - Target type is a domain.
Functions§
- build_
type2 - Build an NTLMSSP CHALLENGE (type 2) message carrying our
challenge, targetdomain/hostnameand a complete TargetInfo AV list. - is_
spnego - True when the blob looks like DER/SPNEGO (starts with ASN.1 tags) rather than a raw NTLMSSP message.
- msg_
type - Identify an NTLMSSP message type (1/2/3), if the buffer is one.
- parse_
type3 - Parse an NTLMSSP AUTHENTICATE (type 3) message per [MS-NLMP] §2.2.1.3. Parse an NTLMSSP AUTHENTICATE (Type 3) message ([MS-NLMP] §2.2.1.3 fixed layout).
- parse_
type3_ session_ key - Session key field ([MS-NLMP] §2.2.1.3): len @52, max @54, offset @56.
- unwrap_
blob - Extract the inner NTLMSSP message from a possibly-SPNEGO-wrapped blob:
returns the slice starting at the
"NTLMSSP\0"marker, when present. - wrap_
accept_ complete - SPNEGO NegTokenTarg carrying only
negResult = accept-completed. - wrap_
accept_ complete_ with_ mic - SPNEGO NegTokenResp with
accept-completedplus a mechListMIC ([RFC 4178] §4.2.2): the client validates it against the exported session key whenever it sent a MIC in its AUTHENTICATE message. - wrap_
negtoken_ targ - Wrap an NTLMSSP token in a SPNEGO NegTokenTarg declaring
negResult = accept-incompleteandsupportedMech = NTLMSSP.