0

current setup: i have a pki setup which issues client certificates to the users (so that only clients with the certificate can access the web application). was looking for ways to implement this and i came across this question on SO. Answer by @John Wu seems a reasonable approach, according to which this is the first step:

The client has to prove that it is the proper owner of the client certificate. The web server challenges the client to sign something with its private key, and the web server validates the response with the public key in the certificate.

What is this something ? Can it be a random text generated by the server as mentioned by the OP in this SO question?

Server randomly generates a plaintext, encrypts the message using the client's public key, and asks the client to decrypt and send back the plaintext. The server can verify that the plaintext matches the one it generated.

.The answer by @Ilmari Karonen rightly claims that this way of identity verification can be compromise via MITM

In particular, an attacker who wants to impersonate the client can simply relay the server's challenge to the real client, pretending to be the server, and then relay the real client's reply to the server. After that, they're free to keep pretending to be the client.

in order to avoid this the second scheme presented by the OP can be modified to setup a secure key exchange between client & server.

instead of sending the random number back to the server in the plain, the client should use it (or something derived from it, using a KDF) as the key for a symmetric (authenticated) encryption scheme, and encrypt all subsequent communications with the server using that key. Thus, the server can be confident that any messages encrypted with this key really come from the same client that successfully decrypted the original encrypted key — effectively, the two parties have established a secure channel.

Questions:

Is there any other way to validate the client(remember i want only clients with certificate generated by me to be able to access the web app)? Like just verifying the client certificate to check if it was generated by my CA & other things like verifying against CRL and certificate expiry?

  • 1
    I think you are missing the point. The question you refer to does not describe client certificates in TLS. Client certificates in TLS are already save against MITM (due to authenticating the server using the servers certificate) so all you need to do in your application is to enable client certificate validation, provide the trusted CA which has issued the certificate and maybe check the subject of the certificate. – Steffen Ullrich Apr 3 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.