Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation around extract secret script, automatic injection of client random into wireshark, etc. #57

Open
JeremyWhaling opened this issue Feb 29, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@JeremyWhaling
Copy link
Contributor

Hello!

I was looking at the tools section of this git repo and noticed the "extract_secrets.py" script, and am wondering there is any documentation on this script, is it somehow called by the wireshark-v2g instance in some way? Or is only an independent tool. Is it included in the normal release for Windows (installer)?

Somewhat related, it would be very handy if the decoder could in real time react to seeing a UDP packet with the client random (secret) and begin decrypting the stream in situ. It seems like this tool is only intended for PCAP files, not a live capture (although it is still useful!).

@chardin-cpi
Copy link
Collaborator

@jhart-cpi wrote the tool for processing pcap offline since that was our main use case. Wireshark has the load key from a file and we would need to read up in the new code if they have the get the key from the UDP debug packet. This very likely is solved - just don't know where or how they solved it.

@jhart-cpi
Copy link
Contributor

jhart-cpi commented Feb 29, 2024

Anything in the tools folder is independent and not integrated into the dissector code itself.

The extract_secrets.py works by extracting the session key and then writing a pcap-ng formatted file with the secret embedded in it, but you'll notice that editcap (a Wireshark companion utility) is being called to do that work. I would consider it more of a pre-processor and we've used it independently to process some quantities of files before viewing them.

The python code uses scapy to process the packets and apply some very basic matching logic to extract the session key. Included in that folder is a Pipfile which will automatically pull in the required dependencies and create a virtualenv for you.

A more robust solution is to apply some fuzzy-finding to the packets in Lua and then insert the secret into the TLS dissector, which I have so far been unable to find support for.

@JeremyWhaling
Copy link
Contributor Author

Thanks for this context! It seems that the pathway to injecting the secret is to use the Lua script to detect UDP packets which contain the pre-shared master secret and write it to a file. You would then need to go into wireshark and select this file in the TLS protocols preferences. From there, it seems Wireshark will automatically (?) start decoding. I'll try modifying teh v2g.lua and report back.

@jhart-cpi jhart-cpi added the enhancement New feature or request label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants