Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpclient skips cert check for TLS #34

Open
blockauditech opened this issue May 2, 2018 · 0 comments
Open

httpclient skips cert check for TLS #34

blockauditech opened this issue May 2, 2018 · 0 comments

Comments

@blockauditech
Copy link

blockauditech commented May 2, 2018

cmd/hcashctl/httpclient.go

// Configure TLS if needed.
[.............]
		pool := x509.NewCertPool()
		if ok := pool.AppendCertsFromPEM(pem); !ok {
			return nil, fmt.Errorf("invalid certificate file: %v",
				cfg.RPCCert)
		}
		tlsConfig = &tls.Config{
			RootCAs:            pool,
			InsecureSkipVerify: cfg.TLSSkipVerify, // HERE
		}
	}

This opens up MITM attacks as the certificate is not checked. If you all choose to accept this risk, or fix it using a proper certificate, it at least should be noted in the comments of the code or documentation.

// InsecureSkipVerify controls whether a client verifies the
// server's certificate chain and host name.
// If InsecureSkipVerify is true, TLS accepts any certificate
// presented by the server and any host name in that certificate.
// In this mode, TLS is susceptible to man-in-the-middle attacks.
// This should be used only for testing.
InsecureSkipVerify bool

References:
https://golang.org/pkg/crypto/tls/
https://info.checkmarx.com/hubfs/GOwhitepaper0504.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant