Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion impacket/ntlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,12 @@ def computeResponseNTLMv2(flags, serverChallenge, clientChallenge, serverName, d
# This is set at Local Security Policy -> Local Policies -> Security Options -> Server SPN target name validation
# level
if TEST_CASE is False:
av_pairs[NTLMSSP_AV_TARGET_NAME] = f"{service}/".encode('utf-16le') + av_pairs[NTLMSSP_AV_DNS_HOSTNAME][1]
# The DNS computer name AV pair is optional (e.g. servers reached by IP
# may omit it); fall back to the NetBIOS computer name, then to no host,
# instead of crashing on a missing pair.
hostAv = av_pairs[NTLMSSP_AV_DNS_HOSTNAME] or av_pairs[NTLMSSP_AV_HOSTNAME]
hostName = hostAv[1] if hostAv is not None else b''
av_pairs[NTLMSSP_AV_TARGET_NAME] = f"{service}/".encode('utf-16le') + hostName
if av_pairs[NTLMSSP_AV_TIME] is not None:
aTime = av_pairs[NTLMSSP_AV_TIME][1]
else:
Expand Down