Git Product home page Git Product logo

Comments (5)

alexmgr avatar alexmgr commented on August 23, 2024

Hi,

For the most part this should work out of the box. Do something like that:

pkt = TLSRecord() / TLSHandshake() / TLSClientHello(version=TLSVersion.TLS_1_2, extensions=[TLSExtension() / TLSExtRenegotiationInfo()])
with TLSSocket(socket.socket(), client=True) as s:
    s.connect(("127.0.0.1", 8443))
    s.sendall(pkt)
    r = s.recvall()
    r[TLSServerHello].extensions[0].show()

Will output:

###[ TLS Extension ]###
  type= renegotiation_info
  length= 0x1
###[ TLS Extension Renegotiation Info ]###
     length= 0x0
     data= ''

Just continue the full handshake as examplified in examples/full_rsa_connection_with_application_data.py, but after sending a few bytes of payload, send a new client hello with the verify_data set in the renegotiation_info extension.

Ciphers can be specified at TLSClientHello time, as well as ECs through the use of extensions:

TLSClientHello(cipher_suites=TLSCipherSuite.ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, extensions=[TLSExtension() / TLSExtEllipticCurves(elliptic_curves=TLSEllipticCurve.SECP521R1), TLSExtension() / TLSExtECPointsFormat(ec_point_formats=TLSEcPointFormat.UNCOMPRESSED)]).show2()
###[ TLS Client Hello ]###
  version= TLS_1_0
  gmt_unix_time= 1476220482
  random_bytes= '\x9d\xbc\xd9\x84\xa5\xe9\x1d\x9b7-\xbeN\xc7h+:1\xf1\xe5Y}\xee\x89\xdb\x87KZK'
  session_id_length= 0x0
  session_id= ''
  cipher_suites_length= 0x2
  cipher_suites= ['ECDHE_ECDSA_WITH_AES_128_CBC_SHA256']
  compression_methods_length= 0x1
  compression_methods= ['NULL']
  extensions_length= 0xe
  \extensions\
   |###[ TLS Extension ]###
   |  type= supported_groups
   |  length= 0x4
   |###[ TLS Extension Elliptic Curves ]###
   |     length= 0x2
   |     elliptic_curves= ['secp521r1']
   |###[ TLS Extension ]###
   |  type= ec_point_formats
   |  length= 0x2
   |###[ TLS Extension EC Points Format ]###
   |     length= 0x1
   |     ec_point_formats= ['uncompressed']

Now for the issues ;):

  1. verify_data is not exposed in the TLSSessionCtx, meaning that you'll have a hard time getting a hold of it. I'll fix that once #73 is merged.
  2. All this would be way easier if do_handshake() accepted an extension argument. I'll add that in the same PR

Hope that helps with the general flow.

from scapy-ssl_tls.

mukundamj avatar mukundamj commented on August 23, 2024

Thanks very much for the response.
I will keep watching for the #73 merger.

from scapy-ssl_tls.

alexmgr avatar alexmgr commented on August 23, 2024

Hi @mukundamj,

#73 has been merged. I'll have a look into addressing this. You can follow progress on renegotiation branch if interested.

Alex

from scapy-ssl_tls.

alexmgr avatar alexmgr commented on August 23, 2024

OK, so this is way more complicated then I initially thought. I've got this working until the second symmetric encryption kicks in. So master-secret and symmetrical keys are re-negotiated OK.

For this to work fully, I'd have to split the _process function into a client and a server state machine like construct. I don't have time to do this major work right now, so I'll be putting this on hold.

Sorry, this will have to wait a bit.

If you want to play with the half backed solution, you can checkout the renegotiation branch. It's hacky though.

from scapy-ssl_tls.

mukundamj avatar mukundamj commented on August 23, 2024

Thanks Alex. I will try if I can figure out something in the renegotiation branch.

from scapy-ssl_tls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.