shadow1ng/fscan · error
ipv4_address_invalid
Error message
ipv4_address_invalid
What it means
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.
Source
Thrown at plugins/local/socks5proxy.go:217
cmd := header[1]
if cmd != 0x01 { // 只支持CONNECT命令
// 发送不支持的命令响应
response := []byte{0x05, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
_, _ = clientConn.Write(response)
return nil, 0, fmt.Errorf(i18n.GetText("socks5_unsupported_command")+": %d", cmd)
}
// 解析目标地址
addrType := header[3]
var targetHost string
var targetPort int
switch addrType {
case 0x01: // IPv4
addr := make([]byte, 6)
if _, err := io.ReadFull(clientConn, addr); err != nil {
return nil, 0, fmt.Errorf("%s", i18n.GetText("ipv4_address_invalid"))
}
targetHost = fmt.Sprintf("%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3])
targetPort = int(addr[4])<<8 + int(addr[5])
case 0x03: // 域名
lenBuf := make([]byte, 1)
if _, err := io.ReadFull(clientConn, lenBuf); err != nil {
return nil, 0, fmt.Errorf("%s", i18n.GetText("domain_format_invalid"))
}
domainLen := int(lenBuf[0])
if domainLen == 0 {
return nil, 0, fmt.Errorf("%s", i18n.GetText("domain_length_invalid"))
}
addr := make([]byte, domainLen+2)
if _, err := io.ReadFull(clientConn, addr); err != nil {
return nil, 0, fmt.Errorf("%s", i18n.GetText("domain_length_invalid"))
}
targetHost = string(addr[:domainLen])
targetPort = int(addr[domainLen])<<8 + int(addr[domainLen+1])View on GitHub (pinned to 95cc12e753)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at plugins/local/socks5proxy.go:217 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/dca9c2f5d51cc4bc.
Report an issue: GitHub.