Archive
Extracting Certs and Keys from .pfx and using with sqlmap
I only had a .pfx file to work with and needed to extract the key and certificate in order to use sqlmap against a particular site. This site provided all the steps I needed to do that.
- Extract private key:
-
openssl.exe pkcs12 -in file.pfx -nocerts -out privKey.pem
-
- Extract certificate:
-
openssl.exe pkcs12 -in file.pfx -clcerts -nokeys -out cert.pem
-
- Remove password from private key:
-
openssl.exe rsa -in privKey.pem -out private.pem
-
Once that is done run sqlmap with the following flags:
-
sqlmap -u https://www.targeturl.com --auth-cert privatekey.pem,cert.pem
To save time typing in the key and cert locations, if in windows you can just drag the file into the command prompt (not sure about linux/mac).
Option 2:
If you have your client cert loaded into Burp, you could just use the sqlmap option ‘–proxy=”http://localhost:8080″‘ and have sqlmap go through Burp and then not worry about extracting certs/keys. This would have been easier, but I found out about it later. Good to know for the future.
Purpose of This Security Blog
I’d like to keep track of my experiences and record the knowledge I gain as I start exploring the world of IT security more in depth. I do not claim to be an expert on any of the topics I introduce here; but welcome any further insights or questions from anyone who takes the time to visit El Blog de Seguridad.
I hope this can become some sort of a digital resume to help display the experience I gain working with and researching IT security. I’d like to set a public goal of publishing here at least once a week (so bug me if you don’t see anything newer than a week).