1

I'm trying to solve an online challenge and I've hit a wall. We're given the address of a web server with two endpoints:

  • One endpoint accepts a CSR and a private key and returns a certificate signed by the server's SSL certificate if, and only if, the CN specified in the CSR is not "administrator". The server's certificate is self signed.

  • The other endpoint implements TLS 1.2 and asks for a client certificate that has the 'Distinguished Name` set to the server's organization name (I've picked that up from Wireshark).

After the connection is established, the server returns either a regular page for non-administrators, or a special page (which contains information I'm supposed to steal) for the administrator.

The only idea I've had so far was to generate two certificates:

  1. One will be used as the CA and will have the DN set to the server's organization name
  2. The other will have the CN set to "administrator" and will be signed by the first certificate. While the browser did offer to use that certificate while handshaking, a general TLS connection error followed immediately after.

Are there any known attack vectors against this setup that I should get myself familiar with?

  • A page? Is that a Web context? With regular Web navigators? Customized navigators? – curiousguy May 11 at 11:09
  • @curiousguy Just a static HTML page which contains data I'm supposed to steal – Shmoopy May 11 at 11:17
  • The point is the legitimate client might be a regular Web browser with all the issues of the Web. – curiousguy May 11 at 11:27
1

One endpoint accepts a CSR and a private key

end of story. Client shall never expose their private key to anyone. Private key is known only to its owner.

returns a certificate signed by the server's SSL certificate

only CA certificates are allowed to sign other certificates. SSL and other client-type certificates are not allowed to sign other certificates. CA and end-entity certificates are distingushed by Basic Constraints certificate extension. If isCA attribute is set to True, the certificate is CA certificate and can be used to sign other certificates, otherwise it is end-entity certificate and cannot be used to sign other certificates.

if, and only if, the CN specified in the CSR is not "administrator"

there must be additional client authentication mechanism to determine if particular requester is authorized to get signed certificates from your CA (of course, if you have CA). Otherwise, any user can submit request on behalf of other users (non-administrators) and impersonate them. Ultimately, you need to authenticate and authorize every requester and sign certificate only when CSR contains names allowed for authenticated requester. Otherwise, CSR must be rejected.

The other endpoint implements TLS 1.2 and asks for a client certificate that has the 'Distinguished Name` set to the server's organization name

this sentence is a bit unclear. What's the point of this requirement? If you want to allow client certificates signed by your CAs, it is better to use a CA whitelist in client certificate validation logic. That is, client certificate is accepted only when it is issued by an explicitly approved CA.

  • Thanks for your help! turns out the solution was to generate a CSR request with CA set to TRUE and then use that certificate to sign a third certificate with CN set to administrator – Shmoopy May 12 at 11:10
  • Among this, there are other issues in your design. I would suggest to revisit the whole conception with a clear understanding of what you want to get in the end. Otherwise, you may run into XY problem. – Crypt32 May 12 at 11:23
  • It's an online challenge, they "planted" the attack :) – Shmoopy May 12 at 12:05
1

If anyone's interested, the solution was to generate a CSR request with CA set to true. After that, I've created my own certificate with CN set to administrator and signed the certificate using the intermediate certificate

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.