I’m happy to announce that I’ve got a guest blogger for the day. My guest blogger is David, a colleague of mine from work. He and I have been working together for about 2 years now and we’ve had some pretty interesting times.. so here it is:
Christian and I were recently asked to perform an application security assessment on a .NET smart-client / web services application (What is a smart-client you ask? -c). This required a bit of hackery with certificates to get the traffic flowing through Burp. We figured this would be worth sharing, if only to save others a bit of time in future. So, I get to be guest blogger for the day.
The smart client was hardcoded with the address of the web services providers. Initially it seemed that this might require the intercepting proxy to run as a reverse (or transparent) proxy but it turned out that the app honoured IE proxy settings, so this was not necessary.
Next, we found that the client was failing to validate the SSL certificate provided by Burp, and there was no option to ignore the cert error and continue. To get around this, we generated a self-signed certificate for the correct server name, then this cert was loaded into Burp and imported into the certificate store on the client.
The Short Way
To generate the self-signed cert…
openssl genrsa 4096 > server.key
openssl req -new -x509 -nodes -sha1 -days 1000 -key server.key > server.crt
(Common Name = FQDN for the SSL server)
openssl pkcs12 -export -out server.p12 -in server.crt -inkey server.key
To load the cert into Burp…
Choose "Proxy" tab.
Choose "Options" tab.
Select the active listener.
Click "edit" button.
Tick "use a custom server SSL certificate".
Specify path to server.p12 and password.
Click "update" button.

To load the cert into the client’s trusted store…
Copy either server.crt or server.p12 to the client machine.
Right-click, “Install Certificate”.
“Place all certificates in the following store” / “Trusted Root Certificate Authorities”
Restarting the smart client, it connected through Burp to the web services provider with no further problems.
A Slightly Longer Way
The above was sufficient for our purposes, but what if the smart client was using web services from a number of providers, all requiring SSL? So long as all the WS providers could be wildcarded to the same domain name, the above methodology can still be used with a couple of tweaks.
Or, what if you frequently needed to change the cert presented by Burp, but didn’t want the hassle of having to load a new certificate into the client machine each time.
First, generate a self-signed CA certificate…
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 1000 -key ca.key -out ca.crt
(Make the CN whatever you like... 'App Testing CA')
Import the CA cert into the client machine as before. You shouldn’t need to repeat this step ever again; any certs subsequently signed by your CA cert will validate.
Then, generate the wildcard server cert, signed by your (self-signed) CA cert…
openssl genrsa -des3 -out server.key 4096
openssl req -new -key server.key -out server.csr
(Make the CN something like... '*.yourdomain.com')
openssl x509 -req -days 1000 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
openssl pkcs12 -export -out server.p12 -in server.crt -inkey server.key
Finally, load the server.p12 file into Burp like before.
Notes, restrictions, the potential for mischief…
This all got me thinking that it might be nice to build a wildcard cert for something like “CN = *” that would be valid for any SSL site I might visit through Burp. This would save some time wading through pages of validation errors when testing browser-based apps. It would also present some interesting possibilities if one could, say, surreptitiously load a cert into the trusted store on a client then transparently proxy their web traffic…
Unfortunately (or fortunately), it turns out that this is not possible. Wildcard certs are only good for one level of wildcard. *.yourdomain.com is good for aaa.yourdomain.com and bbb.yourdomain.com, but not for some.thing.yourdomain.com. In the same way, a cert for “*” would presumably be good for “com” or “au”, but not mail.google.com or www.ebay.com. Foiled by the ITU-T. :-)
Tags: security assessment, web application