Skip to content

GRPC with TLS mutual authentication: Server accepts untrusted client certificate #1325

Description

@matthild

A Java GRPC server configured to require client authentication appears to accept client certificates issued by CAs that the server does not trust. If so, this is a dangerous security vulnerability.

Here is a minimal project that reproduces the problem. Curiously, pretty much exactly the same code works correctly when part of the grpc-java repository's test suites; see the tests added in this pull request.

Perhaps I'm simply missing something; perhaps there is a genuine bug; or perhaps there is some subtle interaction of JARs or whatnot that causes this code to work in some environments but to be silently dangerous in others.

Output of the minimal project is below. This output is from Java 1.8.0_65 on Mac OS X (El Capitan); the test fails in the same way on Linux (Debian 8). The output shows that the SSL engine in use is OpenSSL.

$ ./run_test 
Netty can use OpenSSL: true
Running test...
Jan 16, 2016 9:51:02 PM io.grpc.internal.TransportSet$1 run
INFO: Created transport io.grpc.netty.NettyClientTransport@1e7c7811(localhost/127.0.0.1:64417) for localhost/127.0.0.1:64417
Jan 16, 2016 9:51:02 PM io.grpc.internal.TransportSet$TransportListener transportReady
INFO: Transport io.grpc.netty.NettyClientTransport@1e7c7811(localhost/127.0.0.1:64417) for localhost/127.0.0.1:64417 is ready
Exception in thread "main" Jan 16, 2016 9:51:02 PM io.grpc.internal.TransportSet$TransportListener transportShutdown
INFO: Transport io.grpc.netty.NettyClientTransport@1e7c7811(localhost/127.0.0.1:64417) for localhost/127.0.0.1:64417 is being shutdown
Jan 16, 2016 9:51:02 PM io.grpc.internal.TransportSet$TransportListener transportTerminated
INFO: Transport io.grpc.netty.NettyClientTransport@1e7c7811(localhost/127.0.0.1:64417) for localhost/127.0.0.1:64417 is terminated
java.lang.AssertionError: TLS handshake should have failed, but didn't; received RPC response: text: "Request said: dummy text"

    at org.junit.Assert.fail(Assert.java:88)
    at io.grpc.testing.integration.TlsTest.serverRejectsUntrustedClientCert(TlsTest.java:84)
    at RunTest.main(RunTest.java:14)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions