shadow1ng/fscan · error

connection_timeout

Error message

connection_timeout

What it means

The SMB authentication attempt exceeded its configured timeout. Authenticate selects on a timer channel and returns an ErrorTypeNetwork result with a localized 'connection_timeout' message, closing the result connection in a background goroutine. It indicates the remote host did not complete the SMB handshake in time.

Source

Thrown at plugins/services/smb_protocol.go:458

				Error:     fmt.Errorf("%s", i18n.GetText("service_auth_failed")),
			}
		}
	}()

	select {
	case result := <-resultChan:
		return result, nil
	case <-timeoutCtx.Done():
		go func() {
			result := <-resultChan
			if result != nil && result.Conn != nil {
				_ = result.Conn.Close()
			}
		}()
		return &AuthResult{
			Success:   false,
			ErrorType: ErrorTypeNetwork,
			Error:     fmt.Errorf("%s", i18n.GetText("connection_timeout")),
		}, nil
	case <-ctx.Done():
		go func() {
			result := <-resultChan
			if result != nil && result.Conn != nil {
				_ = result.Conn.Close()
			}
		}()
		return &AuthResult{
			Success:   false,
			ErrorType: ErrorTypeNetwork,
			Error:     ctx.Err(),
		}, nil
	}
}

// ListShares 列举SMB共享(SMB1使用SMB2库列举)
func (a *SMB1Authenticator) ListShares(ctx context.Context, host string, port int, cred Credential, domain string, timeout time.Duration, session *common.ScanSession) ([]string, error) {

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Increase the timeout value in the scan/plugin configuration.
  2. Verify port 445 is reachable (no silent firewall drop) with a TCP connect test.
  3. Retry the target; transient latency or rate limiting often causes one-off timeouts.
  4. Ensure the context passed to Authenticate has an adequate deadline and is not cancelled early.

Example fix

// before
cfg.SetTimeout(2 * time.Second)
// after
cfg.SetTimeout(15 * time.Second) // accommodate slow SMB negotiation
Defensive patterns

Strategy: retry

Validate before calling

if cfg.Timeout() < 10*time.Second { cfg.SetTimeout(10 * time.Second) }

Try / catch

res := plugin.Authenticate(ctx, conn, cred)
if res.ErrorType == ErrorTypeNetwork {
    // timeout: retry with backoff or skip unreachable host
}

Prevention

When it happens

Trigger: Calling Authenticate where the auth goroutine does not deliver a result before the timer fires; also returned when the caller-supplied context is cancelled (ctx.Done branch).

Common situations: Scanning slow or rate-limiting hosts; firewalls silently dropping SMB packets (port 445 filtered); overly aggressive timeout configuration; network congestion.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/d91747eef583addb. Report an issue: GitHub.