rapid7/metasploit-framework — pull request #1715 by sempervictus (2013-04-09 00:47:47+00:00)
Title: Allow meterpreter transport ssl version selection

Meterpreter sessions cache the first SSL context generated for
later reuse when multiple sessions need to quickly set up SSL. In
the event that one were to use a TLSv1 transport for meterpreter
on one platform and SSLv3 on another (because they cant build
a working binary..), their sessions would fail on the second
platform as the original one would create and fix the SSL context
for all later sessions.

This can be remedied by passing a datastore option down from the
user interface to Rex meterpreter client class each time the
handler passes the execution context to the stager. Each session
created will either generate a valid SSL context if it is the
first to run, or simply change the context to use its preferred
SSL implementation during the mutex lock.

The same approach can be used to generate individual client certs
or big numbers from the existing SSL context to pass with stage0
as a mutual secret.

Testing: build a TLSv1-using meterpreter and test incoming sessions
with both configurations by starting handlers using
TransportSSLVersion SSLv3 and TLSv1, others to come as we upgrade
OpenSSL on both sides of the session.

@devs: is it feasible to teach meterpreter to recognize when a UDP socket is in use and switch to DTLS? A few blocks of shellcode and DTLS support and we should have working UDP. Apparently it can be done on the Ruby side - https://github.com/ruby/ruby/commit/060184c347822b11dff3db6bef915c04a564c4e4