{"record":{"id":"db35b51471840c68","repo":"shadow1ng/fscan","slug":"smbv2-session-read-failed-w","errorCode":null,"errorMessage":"smbv2_session_read_failed: %w","messagePattern":"smbv2_session_read_failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/smb_protocol.go","lineNumber":330,"sourceCode":"\t// 构建NTLM数据包\n\tvar ntlmData []byte\n\tif len(r2) > 70 && hex.EncodeToString(r2[70:71]) == \"03\" {\n\t\tflags := []byte{0x15, 0x82, 0x08, 0xa0}\n\t\tntlmData = buildNTLMSSPData(flags)\n\t} else {\n\t\tflags := []byte{0x05, 0x80, 0x08, 0xa0}\n\t\tntlmData = buildNTLMSSPData(flags)\n\t}\n\n\t// 发送Session Setup\n\t_, err = conn2.Write(smbv2SessionSetupPacket)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"smbv2_session_send_failed\"), err)\n\t}\n\n\t_, err = readSMBMessage(conn2)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"smbv2_session_read_failed\"), err)\n\t}\n\n\t// 发送NTLM协商包\n\t_, err = conn2.Write(ntlmData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"smbv2_ntlm_send_failed\"), err)\n\t}\n\n\tret, err := readSMBMessage(conn2)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"smbv2_ntlm_read_failed\"), err)\n\t}\n\n\tntlmOff := bytes.Index(ret, []byte(\"NTLMSSP\"))\n\tif ntlmOff == -1 {\n\t\treturn &SMBTarget{Protocol: SMBProtocol2}, nil\n\t}\n","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/smb_protocol.go#L312-L348","documentation":"Guard in probeSMBv2: reading the Session Setup response failed, so the NTLM challenge the server would embed in that reply is never obtained and SMBv2 fingerprinting stops before the NTLM exchange.","triggerScenarios":"Thrown at plugins/services/smb_protocol.go:330 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry with a longer deadline","Confirm the server issues an NTLM challenge on session setup","Check for IPS dropping mid-handshake SMB traffic"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}