CyberChef icon indicating copy to clipboard operation
CyberChef copied to clipboard

Feature request: Add Kerberos / KRB5 Keytab Generator for Wireshark Decryption

Open solcoteh opened this issue 6 months ago • 0 comments

Hello CyberChef team,

I would like to suggest a new CyberChef feature for generating Wireshark-compatible Kerberos keytab files from user-provided Kerberos keys or NT hashes.

When analyzing Windows and Active Directory network traffic in Wireshark, it is often possible to decrypt Kerberos, DCE/RPC, LDAP, SMB, or NTLMSSP-related encrypted data if the analyst has the correct keys. However, creating a usable keytab file is not always simple, especially in CTF, lab, DFIR, or research environments.

In many cases, analysts have one or more of the following:

  • NT hash of a user
  • NT hash of a machine account
  • RC4-HMAC Kerberos key
  • AES128 Kerberos key
  • AES256 Kerberos key
  • Principal name
  • Realm
  • KVNO
  • Encryption type

But they still need a tool such as ktutil, Metasploit auxiliary/admin/kerberos/keytab, or a GitHub script to build a keytab file that Wireshark can consume.

It would be very useful if CyberChef could provide an operation such as:

  • Generate Kerberos Keytab
  • Build KRB5 Keytab
  • Create Wireshark Keytab
  • Kerberos Keytab from Keys
  • NT Hash to Wireshark Keytab

The feature could accept one key or multiple keys and generate a binary keytab file as output.

Possible input fields:

For each key entry:

  • Principal
  • Realm
  • KVNO
  • Encryption type
  • Key value in hex

Supported encryption types could include:

  • RC4-HMAC / etype 23
  • AES128-CTS-HMAC-SHA1-96 / etype 17
  • AES256-CTS-HMAC-SHA1-96 / etype 18

A very useful shortcut would be:

Input:

  • Username or principal
  • Realm
  • NT hash

Output:

  • A keytab entry using RC4-HMAC / etype 23, because in this specific case the RC4 key is the NT hash

Important note: CyberChef should be careful not to imply that all Kerberos key types can be generated from only an NT hash. From an NT hash alone, the practical Wireshark-compatible use case is mainly RC4-HMAC / etype 23. AES128/AES256 entries should require the actual AES keys, or a separate password-based derivation feature if maintainers decide to support that later.

A possible workflow could be:

  1. Analyst obtains authorized keys from a lab, CTF, memory dump, or DFIR source
  2. Analyst opens CyberChef
  3. Analyst selects “Generate Kerberos Keytab”
  4. Analyst adds entries such as:

Entry 1: Principal: eshellstrop Realm: WORKGROUP KVNO: 1 Encryption type: RC4-HMAC / 23 Key: 3f29138a04aadc19214e9c04028bf381

Entry 2: Principal: cifs/server.example.local Realm: EXAMPLE.LOCAL KVNO: 2 Encryption type: AES256 / 18 Key:

  1. CyberChef outputs:
  • Binary keytab file
  • Optional Base64 representation
  • Optional hex representation
  • Optional summary table
  1. Analyst loads the keytab into Wireshark:

Edit → Preferences → Protocols → KRB5 Enable Kerberos decryption Select the generated keytab file

This would be very helpful because Wireshark can use keytab files to decrypt Kerberos traffic when the correct keys are available. It can also help with some NTLMSSP decryption workflows where an NT hash is placed into a keytab as RC4-HMAC / etype 23.

The operation could include options such as:

  • Add one key
  • Add multiple keys
  • Import keys from CSV
  • Import keys from JSON
  • Import keys from lines in the format: principal,realm,kvno,etype,key
  • Export binary .keytab
  • Export CyberChef-friendly hex/base64
  • Validate key length for selected etype
  • Warn if key length does not match the selected encryption type
  • Show a Wireshark usage note after generation

Example validation rules:

  • etype 23 / RC4-HMAC: 16-byte key / 32 hex characters
  • etype 17 / AES128: 16-byte key / 32 hex characters
  • etype 18 / AES256: 32-byte key / 64 hex characters

This would make the feature beginner-friendly and reduce common mistakes.

This feature would be useful for:

  • Active Directory traffic analysis
  • Kerberos research
  • DFIR investigations
  • CTF challenges
  • Wireshark training
  • Windows protocol learning
  • Decrypting authorized lab captures
  • Creating keytabs without installing extra tooling

Important safety boundaries:

  • The feature should not extract secrets from systems
  • The feature should not perform DCSync
  • The feature should not attack Kerberos
  • The feature should not request tickets
  • The feature should not connect to any network
  • It should only generate a keytab from keys already provided by the user
  • It should include a clear warning that users must only use keys and captures they are authorized to analyze

This would fit CyberChef well because CyberChef is already excellent at transforming structured data, binary data, hex, Base64, and cryptographic material. A keytab generator would turn a workflow that currently requires external tools into a simple static browser-based operation.

References:

  • Wireshark Kerberos wiki: https://wiki.wireshark.org/Kerberos

  • Wireshark NTLMSSP wiki: https://wiki.wireshark.org/NTLMSSP

  • MIT Kerberos ktutil documentation: https://web.mit.edu/kerberos/krb5-devel/doc/admin/admin_commands/ktutil.html

  • MIT Kerberos keytab documentation: https://web.mit.edu/kerberos/krb5-latest/doc/basic/keytab_def.html

  • Linux ktutil man page: https://linux.die.net/man/8/ktutil

  • Dirk-jan Mollema keytab.py example: https://github.com/dirkjanm/forest-trust-tools/blob/master/keytab.py

  • Tenable article about decrypting Kerberos/NTLM encrypted stub data in Wireshark: https://medium.com/tenable-techblog/decrypt-encrypted-stub-data-in-wireshark-deb132c076e7

  • KeyTabExtract: https://github.com/sosdave/KeyTabExtract

Thank you very much for considering this feature. I think this could be a very powerful addition for analysts who use CyberChef together with Wireshark for Windows and Active Directory network forensics.

solcoteh avatar May 29 '26 23:05 solcoteh