sshSecure Shell Transport Layer ProtocolPort 22 Version Banners & Key-Exchange Packets (admin <-> bastion ssh)
What It Does on the Wire
Test SSH version-banner threat signatures (SSH-2.0-OpenSSH_9.6 vs legacy 1.99) and RFC 4253 binary kexinit -> newkeys framing over stateful TCP port 22.
Secure Shell (ssh, RFC 4253) provides encrypted CLI administration, SFTP file transfer, and port forwarding on TCP port 22. Before encryption starts, both sides exchange cleartext SSH-2.0-... identification banners followed by binary SSH_MSG_KEXINIT (msgcode 20) algorithm negotiation and SSH_MSG_NEWKEYS (msgcode 21) packets—which IDS engines (Suricata ssh.protoversion, ssh.software, Zeek HASSH) inspect to spot outdated SSH servers, lateral movement, or C2 tunnels.
FrameAssembly formats
-terminated SSH version banners (banner), RFC 4253 binary padded kexinit frames (with 16-byte cookie and algorithm lists), newkeys transitions, and custom msgcode binary packets.
Test Vulnerable SSH Version & Lateral Movement IDS Rules
Replay specific banner "SSH-2.0-OpenSSH_7.4" or custom client banners (banner "SSH-2.0-Paramiko_2.12.0") across internal subnets to verify SOC alerts.
Bastion / Jump-Host Firewall ACL Verification (TCP 22 / 2222)
Test TCP 22 (or dstport 2222) reachability from admin subnets vs untrusted guest VLANs.
Zeek ssh.log & Key-Exchange Inspection Checks
Combine bidirectional banner, kexinit, and newkeys packets to populate complete Zeek SSH handshake logs.
Minimal Quickstart (ssh_quickstart.frasm)
Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.
host jump_box { ip 10.10.99.5 }host core_sw { ip 10.10.0.1 }compile { jump_box -> core_sw tcp syn srcport 51022 dstport 22 wait 1ms jump_box <- core_sw tcp syn ack wait 1ms jump_box -> core_sw tcp ack wait 1ms jump_box -> core_sw ssh banner "SSH-2.0-OpenSSH_9.7" wait 1ms jump_box <- core_sw ssh banner "SSH-2.0-Cisco-2.0"}What the Compiler Calculates So You Don't Have To
- Defaults to TCP destination port
22(psh ack) and appends standard RFC 4253terminators tobannerstrings. - Computes RFC 4253 binary packet framing (
4-byte packet_length,1-byte padding_length, payload, and 8-byte block padding) automatically onkexinit,newkeys, andmsgcodepackets. - Populates valid curve25519 / chacha20-poly1305 / ssh-ed25519 name-lists inside
kexinitso Wireshark dissects every KEX field cleanly.
Complete SSH-2 Banner Exchange, KEXINIT Negotiation & NEWKEYS Cutover
Establishes a TCP 22 session between an admin workstation and a Linux server, exchanges version banners, negotiates keys via kexinit, activates encryption with newkeys, and sends encrypted session data.
host admin_ws { ip 172.16.99.10 }host linux_srv { ip 172.16.10.22 }compile { admin_ws -> linux_srv tcp syn srcport 53220 dstport 22 win 65535 mss 1460 wait 1ms admin_ws <- linux_srv tcp syn ack win 65535 mss 1460 wait 1ms admin_ws -> linux_srv tcp ack wait 1ms // 1. Cleartext RFC 4253 §4.2 protocol version exchange admin_ws -> linux_srv ssh banner "SSH-2.0-OpenSSH_9.7p1" wait 1ms admin_ws <- linux_srv ssh banner "SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13" wait 2ms // 2. Binary KEXINIT (msgcode 20) + NEWKEYS (msgcode 21) admin_ws -> linux_srv ssh kexinit cookie "0102030405060708" wait 1ms admin_ws <- linux_srv ssh kexinit cookie "aabbccddeeff0011" wait 2ms admin_ws -> linux_srv ssh newkeys wait 1ms admin_ws <- linux_srv ssh newkeys}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show ssh_handshake_audit.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly ssh_handshake_audit.frasm ssh_handshake_audit.pcap
frameassembly ssh_handshake_audit.frasm ssh_handshake_audit.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse ssh_handshake_audit.pcap ssh_handshake_audit_edited.frasmAll ssh Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after ssh:
src_host -> dst_host ssh [banner "<text>"] [kexinit] [newkeys] [msgcode <0..255>] [cookie "<text>"]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| banner "<text>" | Quoted SSH identification string (e.g. "SSH-2.0-OpenSSH_9.7") | "SSH-2.0-OpenSSH_9.6" | Emits the cleartext
-terminated SSH version banner. |
| kexinit | Keyword flag | Omitted | Emits a binary RFC 4253 SSH_MSG_KEXINIT (20) packet with 16-byte cookie and KEX algorithm lists. |
| newkeys | Keyword flag | Omitted | Emits a binary SSH_MSG_NEWKEYS (21) packet signaling transition to negotiated keys. |
| msgcode <0..255> | RFC 4253 message number (e.g. 5 SERVICE_REQUEST, 50 USERAUTH_REQUEST) | Omitted | Emits a properly length-prefixed and block-padded SSH binary packet with the chosen message code. |
| cookie "<text>" | Quoted cookie value for kexinit | 16 deterministic bytes | Populates the 16-byte KEX cookie inside kexinit messages. |
Cross-Layer Wrappers Valid with ssh
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
11 options
Cross-Layer Wrappers Valid with ssh
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | Colon, hyphen, or Cisco dot MAC | Host MAC / RFC multicast MAC | Overrides the 14-byte Ethernet II source or destination MAC address for this single packet. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | Unlabeled (at most 1 mpls tag per packet) | Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] | IPv4 ID, DF/MF flags, fragment offset 0..8191 | ipid 1, flags 0, fragoffset 0 | Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), TCP 22 | Overrides source or destination port and remembers the port pair automatically on <- replies. |
| seq <number> | acknum <number> | win <0..65535> | syn | ack | psh | fin | rst | TCP sequence/ack numbers, window size, flags & RFC 7323 options | psh ack, win 65535, automatic TCP seq/acknum | Overrides automatic TCP sequence tracking, flags, or RFC 7323 options (mss, wscale, sackperm, tsval, tsecr). |
Gotchas & Quick Fixes
Start Custom Banners With SSH-2.0- so Wireshark Dissects Them as SSH
jump_box -> core_sw ssh banner "OpenSSH_9.7"jump_box -> core_sw ssh banner "SSH-2.0-OpenSSH_9.7"RFC 4253 requires SSH version strings to start with SSH-protoversion-softwareversion (SSH-2.0-...).
Send Banners Before kexinit on the Same 4-Tuple
Exchange ssh banner lines before ssh kexinitStateful analyzers like Zeek and Suricata expect the cleartext SSH-2.0- banner exchange at the start of the TCP stream before binary kexinit frames.