Inspect a user's certificate in a request while using the proxy! I am sure this can be done??

102 views
Skip to first unread message

Jeryl Cook

unread,
May 25, 2017, 9:05:05 AM5/25/17
to LittleProxy, ext. Jeryl Cook

Hello,

How do I inspect the user’s certificate of an incoming request to the little proxy using MITM?

For example:

wget https://facebook.com/index.html -e use_proxy on -e https_proxy=https://0.0.0.0:8442 -ca-crt=/mitm.cer –private-key /home/jeryl/.ssh/private.pem –certificate=/home/jmcook3/.ssh/cert/mycert.cer

I want to get this client’s x509 in the MITM implementation little prox.

LittleProxy is running on port 8442

This is easy in for example, a java web server, I would have a filter and extract the certificate like from a request.

//HttpRequest is javax.servlet.http.HttpServletRequest

X509Certificate[] x509s = (X509Certificate[])httpServletRequest.getAttribute(“javax.servlet.request.X509Certi

The x509 I would see the X509 of mycert.cer!

 

This is not available with LittleProxy(but I hope I can do this..)

In  MITM…clientSslEngineFor(SSLSession sslSession) for example I assumed it would be here in the peerCertificates perhaps, but the X509 is not there. It only contains the ‘impersonation’ cert I created so the CN is facebook.com.

 

Also, I checked in inside my implementation of HttpFlitersSource.filterRequest(io.netty.handler.codec.http.HttpRequest httpRequest,…)

But the httpRequest, does not contain a way to grab anything on that may be in the attribute.


How do I get the user’s client x509 used when connecting over proxy?

 

Thanks!

Jeryl Cook

unread,
May 26, 2017, 7:55:55 AM5/26/17
to LittleProxy
Any theories?:/

Jeryl Cook

unread,
May 30, 2017, 3:51:45 PM5/30/17
to LittleProxy, ext....@keywcorp.com
$50.00 bucks via paypal for an attempted answer.

Sivasubramaniam Sivakumar

unread,
May 31, 2017, 10:47:10 AM5/31/17
to LittleProxy, ext....@keywcorp.com
I have an idea, but I have not verified it in code - 

You can try storing the SSLEngine that you return from the MITMManager's clientSslEngineFor() method as a member variable. This is the SSLEngine used for Client to Proxy connection. The SSLSession from this SSLEngine would contain the client certificates sent by the client (either in getPeerCertificates or getLocalCertificates, not sure which). However, you would get this only after the SSL handshake with the client has completed. So you could call this in the MITMManager's serverSslEngine() methods, which are called after the client to proxy SSL handshake. I have created a gist to make this clearer - 


Hope this helps.

Thanks,
Siva

Sivasubramaniam Sivakumar

unread,
May 31, 2017, 10:54:24 AM5/31/17
to LittleProxy, ext....@keywcorp.com
And oh. I just realised that littleproxy does not support MITM + client cert authentication. Littleproxy disables client cert auth on this line - 


You can test by changing this to true.

Thanks.
Reply all
Reply to author
Forward
0 new messages