Skip to content

"insecureSkipVerify: true" by default -- is this intentional? #698

@cjheppell

Description

@cjheppell

In the certs.go file:

goproxy/certs.go

Lines 26 to 30 in 088f758

var tlsClientSkipVerify = &tls.Config{InsecureSkipVerify: true}
var defaultTLSConfig = &tls.Config{
InsecureSkipVerify: true,
}
InsecureSkipVerify is set to true for both the "defaultTLSConfig" and the "tlsClientSkipVerify" structs.

The latter having this true makes sense given the name. But disabling TLS verification by default feels like a dangerous thing to be doing.

Is there a reason for this? I've searched through the Git history but cannot find a specific reason. The line dates back to the initial commit of this module 13 years ago.

It feels like it would be much safer to ensure verification is enabled by default, and make skipping verification opt-in. Unless I'm misunderstanding something, this makes the default mode of the proxy open to MITM attacks between the proxy server and the upstream host.

The Go source code documentation makes it explicitly clear setting this to true enables MITM attacks: https://github.com/golang/go/blob/9d828e80fa1f3cc52de60428cae446b35b576de8/src/crypto/tls/common.go#L679-L685

	// InsecureSkipVerify controls whether a client verifies the server's
	// certificate chain and host name. If InsecureSkipVerify is true, crypto/tls
	// accepts any certificate presented by the server and any host name in that
	// certificate. In this mode, TLS is susceptible to machine-in-the-middle
	// attacks unless custom verification is used. This should be used only for
	// testing or in combination with VerifyConnection or VerifyPeerCertificate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions