Repository navigation
Conversation
Stop treating 0 as an insecure or tracked TLS version in go/insecure-tls, since 0 selects Go's default TLS version (TLS 1.2 for MinVersion in modern Go). Update the query help, examples, change note, and regression tests. Fixes github#23058 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove fieldName from isInsecureTlsVersion and the unused Field parameters from secureTlsVersionFlow and secureTlsVersionFlowsToSink. Update callers and simplify the alert message binding without changing query results. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
QHelp previews: go/ql/src/Security/CWE-327/InsecureTLS.qhelpInsecure TLS configurationThe TLS (Transport Layer Security) protocol secures communications over the Internet. The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery. The current latest version is 1.3 (with the 1.2 version still being considered secure). Older versions are not deemed to be secure anymore because of various security vulnerabilities, and tht makes them unfit for use in securing your applications. Unfortunately, many applications and websites still support deprecated SSL/TLS versions and cipher suites. RecommendationOnly use secure TLS versions (1.3 and 1.2) and avoid using insecure cipher suites (you can see a list here: https://golang.org/src/crypto/tls/cipher_suites.go\#L81) A zero ExampleThe following example shows a few ways how an insecure TLS configuration can be created: package main
import (
"crypto/tls"
)
func main() {}
func insecureMinMaxTlsVersion() {
{
config := &tls.Config{}
config.MinVersion = tls.VersionTLS10 // BAD: TLS 1.0 is a non-secure version of the protocol; it's not safe to use it as MinVersion.
}
{
config := &tls.Config{}
config.MinVersion = tls.VersionSSL30 // BAD: SSL 3.0 is a non-secure version of the protocol; it's not safe to use it as MinVersion.
}
{
config := &tls.Config{}
config.MaxVersion = tls.VersionSSL30 // BAD: SSL 3.0 is a non-secure version of the protocol; it's not safe to use it as MaxVersion.
}
}
func insecureCipherSuites() {
config := &tls.Config{
CipherSuites: []uint16{
tls.TLS_RSA_WITH_RC4_128_SHA, // BAD: TLS_RSA_WITH_RC4_128_SHA is one of the non-secure cipher suites; it's not safe to be used.
},
}
_ = config
}The following example shows how to create a safer TLS configuration: package main
import "crypto/tls"
func saferTLSConfig() {
config := &tls.Config{}
config.MinVersion = tls.VersionTLS12
config.MaxVersion = tls.VersionTLS13
// OR
config.MaxVersion = 0 // GOOD: Setting MaxVersion to 0 means that the highest version available in the package will be used.
}References
|
go/insecure-tlsstated thatMinVersion = 0fortls.Configmeans "lowest supported version". This is wrong: it means the minimum acceptable version. This PR fixes the way that 0 is treated.I ran variant analysis on 1000 go repos. The version on main had 55 alerts and the version in this PR had 52. I confirmed the 3 lost alerts were FPs of the type intended.
Fixes #23058.