Review the minimum TLS version

Review the minimum TLS version

Description

When MinVersion is omitted, Go’s crypto/tls sets the TLS minimum. It currently defaults to TLS 1.2. Check the deployed Go version and environment settings when choosing the minimum for your service.

Potential impact

  • Older protocols and weak cipher suites can compromise the confidentiality and integrity of traffic.
  • A runtime default or override may fall below policy. Raising the minimum may disconnect clients that still need an older version.

Remediation

  • Set MinVersion: tls.VersionTLS12 in tls.Config. Prefer tls.VersionTLS13 when all required clients support it.
  • If a legacy client such as an older browser still requires TLS 1.0 or 1.1, isolate it on a separate service or domain. Consider additional monitoring and informing affected users of the risk.
  • Periodically check your policy, browser and platform support, OWASP guidance and Go release notes. Verify which protocols and cipher suites your service accepts with sslscan, nmap --script ssl-enum-ciphers or an online TLS checker.

Examples

Before

go
package main

import (
    "crypto/tls"
    "net/http"
)

func newInsecureServer() *http.Server {
    // MinVersion omitted: the minimum depends on Go and environment settings
    // The current default is TLS 1.2
    tlsConfig := &tls.Config{
        // Other options only; no MinVersion
        // For example, only CipherSuites or Certificates
    }

    return &http.Server{
        Addr:      ":8443",
        TLSConfig: tlsConfig,
    }
}

func main() {
    srv := newInsecureServer()
    // Example certificate and key paths
    _ = srv.ListenAndServeTLS("server.crt", "server.key")
}

After

go
package main

import (
    "crypto/tls"
    "net/http"
)

func newSecureServer() *http.Server {
    tlsConfig := &tls.Config{
        // Explicitly require TLS 1.2 or later
        MinVersion: tls.VersionTLS12,
        // Add other security settings if needed, such as cipher-suite restrictions
        // CipherSuites: []uint16{ ... },
    }

    return &http.Server{
        Addr:      ":8443",
        TLSConfig: tlsConfig,
    }
}

func main() {
    srv := newSecureServer()
    // Example certificate and key paths
    _ = srv.ListenAndServeTLS("server.crt", "server.key")
}

The revised server explicitly requires TLS 1.2 or later. If its previous default was TLS 1.2, the allowed versions stay the same. Review certificate verification and TLS 1.2 cipher suites separately.

References