Weak or risky TLS cipher suites

Weak or risky TLS cipher suites

Description

Explicitly enabling RC4, 3DES or the discouraged CBC suite shown below allows Go to negotiate those suites. RC4 has a biased keystream, 3DES has a small block size, and CBC risks depend on how the implementation handles padding.

Potential impact

Depending on the negotiated suite and implementation, sensitive data such as tokens may be exposed or traffic altered, falling short of security requirements.

Remediation

Prefer the defaults of a maintained Go release and set a minimum of tls.VersionTLS12, or tls.VersionTLS13 when both sides support it. If you must specify TLS 1.2 suites, consult tls.CipherSuites() and Go release guidance for suitable AEAD choices. tls.Config.CipherSuites applies only to TLS 1.0–1.2.

Examples

Before

go
package main

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

// Before: explicitly select weak cipher suites
func insecureClient() *http.Client {
    tr := &http.Transport{
        TLSClientConfig: &tls.Config{
            // These RC4, 3DES and CBC suites are weak or discouraged
            CipherSuites: []uint16{
                tls.TLS_RSA_WITH_RC4_128_SHA,
                tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
                tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
            },
            MinVersion: tls.VersionTLS10,
        },
    }

    return &http.Client{Transport: tr}
}

After

go
package main

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

// After: use modern cipher suites and TLS versions
func secureClient() *http.Client {
    tr := &http.Transport{
        TLSClientConfig: &tls.Config{
            // Prefer TLS 1.3 where possible; Go maintains default cipher suites
            MinVersion: tls.VersionTLS12,
            // If required, explicitly choose suitable TLS 1.2 cipher suites
            CipherSuites: []uint16{
                tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
                tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
                tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
                tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
                tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
                tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
            },
        },
    }

    return &http.Client{Transport: tr}
}

The example limits TLS 1.2 to AES-GCM and ChaCha20-Poly1305 suites. Go manages TLS 1.3 suites separately. Server authentication still requires certificate validation.

References