Randomly Named User
Randomly Named User

Reputation: 1949

How to send invalid ciphers from client to server?

In the client hello, I want the client to send a set of invalid cipher suites. On wireshark, this is the kind of output I'm looking for.

enter image description here

To do this, I think I have to edit the cipher list that is sent from the client to the server. I know that the cipher list is set for the SSL_CTX object in line 1768 of ssl/ssl_lib.c under the SSL_CTX_new() method, i.e the line below:

ssl_create_cipher_list(ret->method,
         &ret->cipher_list,&ret->cipher_list_by_id,
         meth->version == SSL2_VERSION ? "SSLv2" : SSL_DEFAULT_CIPHER_LIST);

How do I proceed? I assume I have to modify some code in the ssl_create_cipher_list method, which is defined on line 1353 in ssl/ssl_ciph.h, but I'm not able to figure this out.

Any help appreciated!

Upvotes: 1

Views: 788

Answers (3)

juhraffe
juhraffe

Reputation: 555

If you just need to do this as kind of a one-off test you could write a simple TCP-layer proxy that would accept connections from the client, do a RegEx replacement of the (known in advance) client cipher suite list with the desired unsupported list, and forward this to the desired server. Pick your favorite language to implement the proxy. I'm not sure if this is easier than modifying your code, but it's somewhat cleaner if this serves your purpose.

If you actually want the client to establish a TLS session, this won't work, since this is essentially a MITM attack. This is just a way to send the unsupported ciphers to the server and see how the server reacts.

Upvotes: 0

jschultz410
jschultz410

Reputation: 2899

A conforming TLS client can only send the cipher suites that the client supports. It cannot send cipher suites that it does not support. From TLS 1.2, RFC 5246:

7.4.1.2. Client Hello

...

The cipher suite list, passed from the client to the server in the ClientHello message, contains the combinations of cryptographic algorithms supported by the client in order of the client's preference (favorite choice first) ...

cipher_suites

This is a list of the cryptographic options supported by the client, with the client's first preference first. If the session_id field is not empty (implying a session resumption request), this vector MUST include at least the cipher_suite from that session. Values are defined in Appendix A.5.

So, your client will need to specify the cipher suites that it supports. You can either explicitly choose the ones you think are valid for your purposes, or you can rely on your library's definitions. For example, with OpenSSL you can do something like:

SSL_CTX_set_cipher_list(ssl_ctx, "-ALL:HIGH");

Upvotes: 0

Sean Baker
Sean Baker

Reputation: 664

I should think that instead of bothering with the ssl_create_cipher_list, you would instead override the negotiation phase (where ciphers are sent) and send any invalid ciphers which you want. In other words, anything not on this list.

Upvotes: 1

Related Questions