Feature request: Add NTLMv2 / SMB Session Key Generator for Wireshark Decryption
Hello CyberChef team,
I would like to suggest a new CyberChef operation for generating NTLMv2 / SMB session keys that can be used for Wireshark SMB2/SMB3 decryption.
While working on SMB traffic analysis in a CTF/forensics scenario, I noticed that generating the correct SMB session key can be confusing and error-prone. CyberChef already has many of the required low-level operations, such as UTF-16LE encoding, HMAC-MD5, From Hex, and RC4, but the analyst currently has to chain everything manually and understand the full NTLMv2 key derivation process.
It would be very useful if CyberChef had a dedicated operation such as:
- Generate NTLMv2 SMB Session Key
- Calculate SMB Session Key from NTLMv2
- NTLMv2 Session Key Builder
- SMB2/SMB3 Wireshark Session Key Generator
The goal would be to take the required NTLMv2 fields as input and produce the final session key that can be imported into Wireshark under:
Edit → Preferences → Protocols → SMB2 → Secret session keys for decryption
The operation could accept fields such as:
Required inputs:
- Username
- Domain / Workgroup
- NT hash, or optionally plaintext password
- NTProofStr
- Encrypted Session Key
Optional inputs:
- SMB Session ID
- Server Challenge
- NTLMv2 Blob
- Full NTLMv2 hash line
- Negotiate flags
- Output format selector
Expected outputs:
- ResponseKeyNT
- SessionBaseKey / KeyExchangeKey
- Decrypted Random Session Key / Exported Session Key
- Wireshark-ready Session ID + Session Key pair
- Optional JSON output
- Optional CyberChef table output
- Optional explanation of each intermediate value
The manual process currently looks like this:
Step 1: Calculate ResponseKeyNT
Input: USERNAME + DOMAIN
Example: ESHELLSTROPWORKGROUP
Operations:
- Encode text as UTF-16LE
- HMAC-MD5
- Key: NT hash
- Key format: Hex
Output: ResponseKeyNT
Step 2: Calculate SessionBaseKey / KeyExchangeKey
Input: NTProofStr
Operations:
- From Hex
- HMAC-MD5
- Key: ResponseKeyNT
- Key format: Hex
Output: SessionBaseKey / KeyExchangeKey
Step 3: Decrypt Encrypted Session Key
Input: Encrypted Session Key from Wireshark
Operations:
- From Hex
- RC4
- Key: SessionBaseKey / KeyExchangeKey
- Key format: Hex
- Input format: Hex
- Output format: Hex
Output: Random Session Key / Exported Session Key
Step 4: Use in Wireshark
Edit → Preferences → Protocols → SMB2 Secret session keys for decryption → Add
Session ID:
Session Key:
This is possible today with manual CyberChef recipes, but a dedicated operation would reduce mistakes and make the workflow much more accessible to analysts and students.
A nice user experience could be:
Input mode 1:
- Username
- Domain
- NT hash
- NTProofStr
- Encrypted Session Key
Input mode 2:
- Full NTLMv2 hash line
- Encrypted Session Key
- Optional Session ID
Input mode 3:
- Parsed output from a PCAP extraction operation
- Automatically use extracted NTLMSSP fields
Output mode examples:
-
Raw session key only
-
Wireshark table format: Session ID: <session_id> Session Key: <session_key>
-
JSON: { "username": "...", "domain": "...", "responseKeyNT": "...", "sessionBaseKey": "...", "encryptedSessionKey": "...", "sessionKey": "...", "wireshark": { "sessionId": "...", "sessionKey": "..." } }
This would be useful for:
- SMB2/SMB3 traffic decryption in Wireshark
- DFIR investigations
- SOC packet analysis
- CTF challenges
- Windows authentication learning
- Validating NTLMv2 calculations
- Avoiding manual copy/paste mistakes between multiple tools
Important safety boundaries:
- The feature should not crack passwords
- The feature should not attempt authentication
- The feature should not connect to any network service
- It should only calculate keys from user-provided values
- It should clearly state that the user must have authorization to analyze the traffic
- It should support safe local/browser-side calculation only
This operation would fit CyberChef very well because the underlying primitives already exist in CyberChef. The feature would mostly package them into a reliable, documented, repeatable, analyst-friendly operation.
References:
-
Microsoft NTLM / MS-NLMP session key logic: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/c0250a97-2940-40c7-82fb-20d208c71e96
-
Microsoft SMB2 session key handling: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/7fd079ca-17e6-4f02-8449-46b606ea289c
-
Microsoft SMB2 GSS-API authentication notes: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/5ed93f06-a1d2-4837-8954-fa8b833c2654
-
Decrypting SMB3 Traffic with just a PCAP: https://medium.com/maverislabs/decrypting-smb3-traffic-with-just-a-pcap-absolutely-maybe-712ed23ff6a2
-
SMB session key generator example: https://github.com/jozwikaleksander/smb-sessionkey-gen
-
Random session key calculation examples: https://gist.github.com/khr0x40sh/747de1195bbe19f752e5f02dc22fce01 https://gist.github.com/h4sh5/1cc22aa46037f253ca6c785d846b8cf3 https://gist.github.com/cicero343/b8eac1a5e5ac46d15ac8dee805388fc4
-
Samba Wireshark decryption notes: https://wiki.samba.org/index.php/Wireshark_Decryption
Thank you for considering this feature. I believe it would make CyberChef even more valuable for Windows network forensics and SMB traffic analysis.