{"record":{"id":"2f556e631943ccb4","repo":"shadow1ng/fscan","slug":"ms17010-session-failed","errorCode":null,"errorMessage":"ms17010_session_failed","messagePattern":"ms17010_session_failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/ms17010.go","lineNumber":327,"sourceCode":"\treply := make([]byte, 1024)\n\tn, readErr := conn.Read(reply)\n\tif readErr != nil || n < 36 {\n\t\t// 连接被关闭或响应不完整，通常表示目标不支持SMBv1\n\t\treturn false, \"\", false, fmt.Errorf(\"%s\", i18n.GetText(\"ms17010_smbv1_unsupported\"))\n\t}\n\n\tif binary.LittleEndian.Uint32(reply[9:13]) != 0 {\n\t\treturn false, \"\", false, fmt.Errorf(\"%s\", i18n.GetText(\"ms17010_smbv1_rejected\"))\n\t}\n\n\t// 建立会话\n\tif _, err = conn.Write(sessionSetupRequest); err != nil {\n\t\treturn false, \"\", false, fmt.Errorf(\"%s: %w\", i18n.GetText(\"ms17010_send_session_error\"), err)\n\t}\n\n\tn, readErr = conn.Read(reply)\n\tif readErr != nil || n < 36 {\n\t\treturn false, \"\", false, fmt.Errorf(\"%s\", i18n.GetText(\"ms17010_session_failed\"))\n\t}\n\n\tif binary.LittleEndian.Uint32(reply[9:13]) != 0 {\n\t\treturn false, \"\", false, fmt.Errorf(\"%s\", i18n.GetText(\"ms17010_session_rejected\"))\n\t}\n\n\t// 提取系统信息\n\tvar osVersion string\n\tsessionSetupResponse := reply[36:n]\n\tif len(sessionSetupResponse) > 0 && sessionSetupResponse[0] != 0 && len(sessionSetupResponse) >= 10 {\n\t\tbyteCount := binary.LittleEndian.Uint16(sessionSetupResponse[7:9])\n\t\tif n == int(byteCount)+45 {\n\t\t\tfor i := 10; i < len(sessionSetupResponse)-1; i++ {\n\t\t\t\tif sessionSetupResponse[i] == 0 && sessionSetupResponse[i+1] == 0 {\n\t\t\t\t\tosVersion = string(sessionSetupResponse[10:i])\n\t\t\t\t\tosVersion = strings.ReplaceAll(osVersion, string([]byte{0x00}), \"\")\n\t\t\t\t\tbreak\n\t\t\t\t}","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/ms17010.go#L309-L345","documentation":"The checker sent the Session Setup request and then reads the response; this error fires when the read fails or returns fewer than the 36-byte SMB header minimum. It means no complete session-setup reply arrived, so the anonymous session could not be established.","triggerScenarios":"checkMS17010VulnerabilityAt returns this when conn.Read(reply) after writing sessionSetupRequest errors out or yields n < 36 bytes.","commonSituations":"Server closes the socket on receiving the session setup (strict anonymous-access policy); the read times out on a slow/wide-area link; a TCP middlebox truncates the flow; the target's SMB stack accepted negotiate but rejects the anonymous session silently by dropping.","solutions":["Retry the probe with a longer socket deadline — the first read after write is the most timeout-sensitive step.","Treat repeated truncation as an indication the host blocks anonymous SMB sessions; MS17-10 probing requires session setup, so mark the result inconclusive.","Verify no IDS/IPS is resetting or truncating SMB flows to port 445.","Check the target service is alive and responding (previous negotiate step succeeded, so a sudden drop points at session-policy or network reset, not host death)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"conn.SetReadDeadline(time.Now().Add(readTimeout)) // generous deadline before the session-setup read\nif n, err := conn.Read(buf); err != nil || n < 36 { /* handle short/failed read before proceeding */ }","typeGuard":null,"tryCatchPattern":"n, readErr := conn.Read(reply)\nif readErr != nil || n < 36 {\n    return fmt.Errorf(\"ms17010 session setup response incomplete: %w\", readErr) // retry whole probe once\n}","preventionTips":["Use read deadlines larger than worst-case RTT to the scanned network.","Retry the entire probe once before reporting failure.","Detect IDS/IPS truncating SMB sessions if failures are systematic.","Treat hosts that drop anonymous sessions as inconclusive, not vulnerable."],"tags":["smb","network","timeout","ms17-10"],"backgroundTag":"empty-response-body","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"}