{"record":{"id":"5a64225c41a5d67a","repo":"shadow1ng/fscan","slug":"smbv1-negotiate-send-failed-w","errorCode":null,"errorMessage":"smbv1_negotiate_send_failed: %w","messagePattern":"smbv1_negotiate_send_failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/smb_protocol.go","lineNumber":219,"sourceCode":"\t\t\"\\x00\\x00\\x00\\x00\"\n)\n\n// probeTarget 探测目标SMB信息（协议版本、系统信息）\nfunc probeTarget(ctx context.Context, host string, port int, timeout time.Duration, session *common.ScanSession) (*SMBTarget, error) {\n\ttarget := net.JoinHostPort(host, strconv.Itoa(port))\n\n\tconn, err := session.DialTCP(ctx, \"tcp\", target, timeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(i18n.Tr(\"service_connection_failed\", \"%w\"), err)\n\t}\n\tdefer func() { _ = conn.Close() }()\n\n\t_ = conn.SetDeadline(time.Now().Add(timeout))\n\n\t// 首先尝试SMBv1协商\n\t_, err = conn.Write(smbv1NegotiatePacket)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"smbv1_negotiate_send_failed\"), err)\n\t}\n\n\t// 读取SMBv1协商响应\n\tr1, err := readSMBMessage(conn)\n\tif err != nil {\n\t\tsession.LogDebug(i18n.Tr(\"smbv1_negotiate_read_failed\", err))\n\t}\n\n\t// 检查是否支持SMBv1\n\tif len(r1) > 0 {\n\t\treturn probeSMBv1(conn, target, timeout)\n\t}\n\n\t// SMBv2路径\n\treturn probeSMBv2(ctx, target, timeout, session)\n}\n\n// probeSMBv1 处理SMBv1协议信息收集","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/smb_protocol.go#L201-L237","documentation":"Guard in probeTarget: writing the SMBv1 negotiate packet to the freshly opened TCP connection failed. The connection was established but the write errored (reset, deadline, or broken socket), so SMB protocol probing cannot begin.","triggerScenarios":"Thrown at plugins/services/smb_protocol.go:219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the probe on a new connection","Increase the deadline; overloaded hosts drop writes","Check for IPS resetting SMB connections"],"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-14T05:17:10.506Z"}