My thoughts about IT and infosec.

XSS in a certificate signing request

Web application developers will all know, never to trust the input of the users of the web application. But what if you do not really know what they are submitting? While investigating some form fields in our application, I came across a form for checking a certificate signing request (CSR) witch you need to order a SSL / TLS certificate.

What is a CSR

A certificate signing request, CSR, is an encoded file with the information to request a certificate from a certificate authority (CA) or a reseller of that CA. You will need to create that file yourself and put in the information that you want. And that means that you can put everything in it what you want.

For example, something like this:


You also can try to do an SQL injection if the CA or the reseller is saving the information from the CSR to an SQL database for later use.


Here are some examples of websites who didn't validate the data in the CSR. They just encoded the CSR and and put the data on the screen at it is.

Note: All the tested websites are informed about this.

xss-csr-001 xss-csr-002 xss-csr-003 xss-csr-004

This is the CSR I used in all the cases:


You can check the contents of it here:

How I made the CSR

Generatig the CSR was easy. It is like creating normal CSR's but with some code in one field. I used OpenSSL on my Linux machine to generate the CSR. In the code block below you can see where I did put in the XSS. The line is highlighted.

sebastian@blade:~$ openssl req -utf8 -nodes -sha256 -newkey rsa:2048 -keyout private2.key -out cert2.csr
Generating a 2048 bit RSA private key
writing new private key to 'private2.key'
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [AU]:NL
State or Province Name (full name) [Some-State]:Utrecht
Locality Name (eg, city) []:Utrecht
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Nw4all BV
Organizational Unit Name (eg, section) []:<script>alert('attacked')</script>
Common Name (e.g. server FQDN or YOUR name) []
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:



What can we learn from this? Do not only check your input, also the results what will be displayed on the screen.

  • Update 2017-09-29: Most of them updated their website.
  • Update 2017-10-14: One certificate reseller didn't understand the problem.
2017-09-28 10:25
#xss #sqli #csr