shadow1ng/fscan · error
i18n.GetText("memcached_connect_failed")
Error message
i18n.GetText("memcached_connect_failed") What it means
identifyService returns this error when the initial TCP dial to the memcached target fails inside connectToMemcached (dial error or context cancellation). The plugin could not even open a socket, so it reports 'memcached connect failed' instead of a service-identification failure. It surfaces in DisableBrute mode or whenever identifyService runs via Scan.
Source
Thrown at plugins/services/memcached.go:124
response := make([]byte, 1024)
n, err := conn.Read(response)
if err != nil {
return false
}
responseStr := string(response[:n])
return common.ContainsAny(responseStr, "VERSION", "memcached")
}
func (p *MemcachedPlugin) identifyService(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
target := info.Target()
conn := p.connectToMemcached(ctx, info, session)
if conn == nil {
return &ScanResult{
Success: false,
Service: "memcached",
Error: fmt.Errorf("%s", i18n.GetText("memcached_connect_failed")),
}
}
defer func() { _ = conn.Close() }()
if p.testBasicCommand(conn, session.Config) {
banner := "Memcached"
session.LogSuccess(i18n.Tr("memcached_service", target, banner))
return &ScanResult{
Type: plugins.ResultTypeService,
Success: true,
Service: "memcached",
Banner: banner,
}
}
return &ScanResult{
Success: false,
Service: "memcached",View on GitHub (pinned to 95cc12e753)
Solutions
- Confirm the port is open: nc -zv <host> 11211 from the scanning machine.
- Check for firewalls/iptables/security groups blocking the scanner's source IP.
- Raise ModuleTimeout in the scan config for high-latency networks.
- Verify the target address format (host:port) in HostInfo is correct and reachable.
- Re-run with retries; transient packet loss can fail a single dial attempt.
Example fix
// before
conn := p.connectToMemcached(ctx, info, session)
if conn == nil {
return &ScanResult{Success: false, Error: fmt.Errorf("%s", i18n.GetText("memcached_connect_failed"))}
}
// after
// caller-side guard: verify reachability and retry once before treating as connect failure
if !isTCPPortOpen(host, 11211, 3*time.Second) {
log.Printf("skip %s: port 11211 not reachable", host)
return
}
result := plugin.Scan(ctx, info, session) // retry logic configured via session timeouts Defensive patterns
Strategy: validation
Validate before calling
func ensureMemcachedDialable(target string, timeout time.Duration) error {
conn, err := net.DialTimeout("tcp", target, timeout)
if err != nil { return fmt.Errorf("cannot reach %s: %w", target, err) }
_ = conn.Close()
return nil
}
// call before plugin.Scan
if err := ensureMemcachedDialable("10.0.0.5:11211", 3*time.Second); err != nil { log.Fatal(err) } Type guard
func isConnectFailure(r *services.ScanResult) bool {
return r != nil && !r.Success && r.Error != nil && strings.Contains(r.Error.Error(), "connect")
} Try / catch
result := plugin.Scan(ctx, info, session)
if !result.Success && isConnectFailure(result) {
log.Printf("skipping %s: TCP connect failed: %v", info.Target(), result.Error)
return // do not retry immediately; check network first
} Prevention
- Validate host:port reachability with a quick TCP dial before the full scan
- Increase ModuleTimeout for high-latency or WAN targets
- Ensure firewalls permit outbound connections to 11211-11213
- Avoid scanning through misconfigured NAT/proxies that silently drop the connection
When it happens
Trigger: Running the memcached plugin (ports 11211-11213) against a host where: the port is closed/filtered; DNS or IP routing fails; ModuleTimeout expires during DialTCP; the parent context is cancelled before the dial completes.
Common situations: Scanning hosts behind a firewall that drops (rather than rejects) packets, causing timeouts; typo'd targets or stale IP lists; scanning through NAT where 11211 is not forwarded; rate-limiting by the target network.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- socks5_target_connect_failed: %w
- ms17010_set_timeout_error: %w
- netbios_smb_negotiate_read_failed: %w
- service_connection_failed
- network_rate_limited
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/39d9506d975e762c.
Report an issue: GitHub.