{"record":{"id":"dca9c2f5d51cc4bc","repo":"shadow1ng/fscan","slug":"ipv4-address-invalid","errorCode":null,"errorMessage":"ipv4_address_invalid","messagePattern":"ipv4_address_invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/socks5proxy.go","lineNumber":217,"sourceCode":"\n\tcmd := header[1]\n\tif cmd != 0x01 { // 只支持CONNECT命令\n\t\t// 发送不支持的命令响应\n\t\tresponse := []byte{0x05, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n\t\t_, _ = clientConn.Write(response)\n\t\treturn nil, 0, fmt.Errorf(i18n.GetText(\"socks5_unsupported_command\")+\": %d\", cmd)\n\t}\n\n\t// 解析目标地址\n\taddrType := header[3]\n\tvar targetHost string\n\tvar targetPort int\n\n\tswitch addrType {\n\tcase 0x01: // IPv4\n\t\taddr := make([]byte, 6)\n\t\tif _, err := io.ReadFull(clientConn, addr); err != nil {\n\t\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"ipv4_address_invalid\"))\n\t\t}\n\t\ttargetHost = fmt.Sprintf(\"%d.%d.%d.%d\", addr[0], addr[1], addr[2], addr[3])\n\t\ttargetPort = int(addr[4])<<8 + int(addr[5])\n\tcase 0x03: // 域名\n\t\tlenBuf := make([]byte, 1)\n\t\tif _, err := io.ReadFull(clientConn, lenBuf); err != nil {\n\t\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"domain_format_invalid\"))\n\t\t}\n\t\tdomainLen := int(lenBuf[0])\n\t\tif domainLen == 0 {\n\t\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"domain_length_invalid\"))\n\t\t}\n\t\taddr := make([]byte, domainLen+2)\n\t\tif _, err := io.ReadFull(clientConn, addr); err != nil {\n\t\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"domain_length_invalid\"))\n\t\t}\n\t\ttargetHost = string(addr[:domainLen])\n\t\ttargetPort = int(addr[domainLen])<<8 + int(addr[domainLen+1])","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/socks5proxy.go#L199-L235","documentation":"Generic guard in the IPv4 branch of the SOCKS5 address parser: io.ReadFull failed while reading the 6-byte IPv4 address+port payload, so the address section of the request is incomplete. Despite the name, it signals a truncated/unreadable IPv4 address block, not a malformed dotted-quad.","triggerScenarios":"Thrown at plugins/local/socks5proxy.go:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check client-side network health; the connection may have dropped mid-request","Ensure the SOCKS5 client sends the full 6-byte IPv4 address and port after the 4-byte header","Wrap the read with a deadline to fail fast on stalled clients"],"exampleFix":null,"handlingStrategy":"validation","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"}