shadow1ng/fscan · error

socks5_unsupported_address_type: %d

Error message

socks5_unsupported_address_type: %d

What it means

Guard in the address-type switch of handleSocks5Request: header[3] (ATYP) is none of 0x01 (IPv4), 0x03 (domain), or 0x04 (IPv6). The request is rejected after sending the SOCKS5 0x08 'address type not supported' reply, because the target address format is unrecognizable.

Source

Thrown at plugins/local/socks5proxy.go:248

		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])
	case 0x04: // IPv6
		addr := make([]byte, 18)
		if _, err := io.ReadFull(clientConn, addr); err != nil {
			return nil, 0, fmt.Errorf("%s", i18n.GetText("ipv6_address_invalid"))
		}
		// IPv6地址解析(简化实现)
		targetHost = net.IP(addr[:16]).String()
		targetPort = int(addr[16])<<8 + int(addr[17])
	default:
		// 发送不支持的地址类型响应
		response := []byte{0x05, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
		_, _ = clientConn.Write(response)
		return nil, 0, fmt.Errorf(i18n.GetText("socks5_unsupported_address_type")+": %d", addrType)
	}
	if targetPort == 0 {
		return nil, 0, fmt.Errorf("%s", i18n.GetText("socks5_invalid_request"))
	}

	// 连接目标服务器
	targetAddr := net.JoinHostPort(targetHost, strconv.Itoa(int(targetPort)))
	targetConn, err := net.DialTimeout("tcp", targetAddr, 10*time.Second)
	if err != nil {
		// 发送连接失败响应
		response := []byte{0x05, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
		_, _ = clientConn.Write(response)
		return nil, 0, fmt.Errorf("%s: %w", i18n.GetText("socks5_target_connect_failed"), err)
	}

	// 获取本地监听端口(从targetConn获取)
	localAddr, ok := targetConn.LocalAddr().(*net.TCPAddr)
	if !ok {

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Update the client to use a standard SOCKS5 address type (IPv4, domain, or IPv6)
  2. Add support for the missing ATYP if a legitimate client requires it
  3. Log the offending ATYP value to identify misbehaving clients
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugins/local/socks5proxy.go:248 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/2505255aa3c4647d. Report an issue: GitHub.