diff --git a/nselib/smbauth.lua b/nselib/smbauth.lua index de1612008..2e8f77b5b 100644 --- a/nselib/smbauth.lua +++ b/nselib/smbauth.lua @@ -843,9 +843,7 @@ end -- @return A host_info table containing the data in the blob. -- @see host_info function get_host_info_from_security_blob(security_blob) - local ntlm_challenge = {} - --local pos, identifier, message_type, domain_length, domain_max, domain_offset, server_flags, challenge, reserved, target_info_length, target_info_max, target_info_offset = bin.unpack(" 0 ) then local length = domain_length @@ -866,6 +866,26 @@ function get_host_info_from_security_blob(security_blob) ntlm_challenge[ "target_realm" ] = unicode.utf16to8( target_realm ) end + if hpos + domain_length > #security_blob then + -- Context, Target Information, and OS Version structure are all omitted + -- Probably Win9x + return ntlm_challenge + end + + local hpos, context, target_info_length, target_info_max, target_info_offset = bin.unpack("= hpos + 7 and domain_offset >= hpos + 7 then + local hpos, major, minor, build, reserved = bin.unpack(" 0 ) then