smbServer Message Block SMB2 & SMB3 File SharingWindows \\IPC$ Lateral Movement & File Shares (ws <-> filesrv smb TCP 445)
What It Does on the Wire
Port 445 is ground zero for east-west lateral movement (\\filesrv\IPC$, svcctl, ADMIN$). smb packs the 4-byte NetBIOS session length + 64-byte \xfeSMB header cleanly over stateful TCP.
Server Message Block (smb, MS-SMB2) handles Windows file shares, domain SYSVOL Group Policy delivery, and remote administration (IPC$, ADMIN$, C$) over TCP port 445. Because lateral-movement tools (PsExec, Impacket, ransomware) target TCP 445, East-West SMB monitoring is one of the highest-priority detections in every SOC.
FrameAssembly prepends the 4-byte NetBIOS Session Service length header plus the 64-byte þSMB SMB2/3 header, encodes UTF-16LE UNC paths (share) and file paths (filename), and sets SMB2_FLAGS_SERVER_TO_REDIRECTOR automatically on <- replies or NTSTATUS error responses.
Test ADMIN$ / C$ / IPC$ Lateral Movement Detections
Replay negotiate -> sessionsetup -> treeconnect share "\\dc01\ADMIN$" -> create filename "svcctl" over TCP 445 to validate Suricata, Zeek smb_mapping.log, and NDR rules safely.
Verify Workstation-to-Workstation Port 445 Microsegmentation
Confirm zero-trust host firewalls and switch ACLs block peer-to-peer workstation SMB while allowing access to file servers.
Simulate STATUS_LOGON_FAILURE (0xc000006d) Password Spraying
Emit sessionsetup status 0xc000006d replies to test SIEM alerts for SMB credential stuffing.
Minimal Quickstart (smb_quickstart.frasm)
Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.
host client_pc { ip 10.10.20.31 }host file_srv { ip 10.10.1.45 }compile { client_pc -> file_srv tcp syn srcport 51445 dstport 445 wait 1ms client_pc <- file_srv tcp syn ack wait 1ms client_pc -> file_srv tcp ack wait 1ms client_pc -> file_srv smb negotiate msgid 0 wait 1ms client_pc <- file_srv smb negotiate msgid 0 status 0 wait 2ms client_pc -> file_srv smb treeconnect sessionid 0x1001 msgid 1 share "\\file_srv\Engineering"}What the Compiler Calculates So You Don't Have To
- Defaults to TCP destination port
445(psh ack) and prepends the 4-byte big-endian NetBIOS Session length header (0x00+ 24-bit size). - Builds the full 64-byte
þSMBheader (StructureSize = 64,Command,NTSTATUS,MessageId,TreeId,SessionId) and sets the Server-to-Client flag on<-replies. - Encodes
shareUNC strings andfilenamestrings in Windows little-endian UTF-16LE automatically.
SMB2 Login Failure (0xc000006d) + Administrative ADMIN$ Named-Pipe Access
Completes TCP 445 setup, captures a failed sessionsetup, then connects to \\srv01\ADMIN$ and opens a remote file handle (create + read + close).
host admin_pc { ip 172.16.20.55 }host srv_01 { ip 172.16.10.45 }compile { admin_pc -> srv_01 tcp syn srcport 52445 dstport 445 win 65535 mss 1460 wait 1ms admin_pc <- srv_01 tcp syn ack win 65535 mss 1460 wait 1ms admin_pc -> srv_01 tcp ack wait 1ms // 1. SMB2 Negotiate + Failed SessionSetup (STATUS_LOGON_FAILURE = 0xc000006d) admin_pc -> srv_01 smb negotiate msgid 0 wait 1ms admin_pc <- srv_01 smb negotiate msgid 0 status 0 wait 1ms admin_pc -> srv_01 smb sessionsetup msgid 1 wait 2ms admin_pc <- srv_01 smb sessionsetup msgid 1 status 0xc000006d wait 5ms // 2. Successful SessionSetup + ADMIN$ TreeConnect + Create/Read/Close admin_pc -> srv_01 smb sessionsetup msgid 2 sessionid 0x400001 wait 1ms admin_pc <- srv_01 smb sessionsetup msgid 2 sessionid 0x400001 status 0 wait 1ms admin_pc -> srv_01 smb treeconnect msgid 3 sessionid 0x400001 share "\\srv_01\ADMIN$" wait 2ms admin_pc <- srv_01 smb treeconnect msgid 3 sessionid 0x400001 treeid 1 status 0 wait 1ms admin_pc -> srv_01 smb create msgid 4 sessionid 0x400001 treeid 1 filename "System32\\drivers\\etc\\hosts" wait 2ms admin_pc <- srv_01 smb create msgid 4 sessionid 0x400001 treeid 1 status 0 wait 1ms admin_pc -> srv_01 smb close msgid 5 sessionid 0x400001 treeid 1}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show smb_lateral_movement_lab.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly smb_lateral_movement_lab.frasm smb_lateral_movement_lab.pcap
frameassembly smb_lateral_movement_lab.frasm smb_lateral_movement_lab.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse smb_lateral_movement_lab.pcap smb_lateral_movement_lab_edited.frasmAll smb 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 smb:
src_host -> dst_host smb [negotiate | sessionsetup | treeconnect | treedisconnect | create | close | read | write | logoff | command "<text>"] [status <hex_or_num>] [treeid <number>] [sessionid <hex_or_num>] [msgid <number>] [share "<unc_path>"] [filename "<text>"]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| negotiate | sessionsetup | treeconnect | treedisconnect | create | close | read | write | logoff | SMB2/3 command keyword (or command "<text>") | negotiate (0x0000) | Selects the 16-bit MS-SMB2 command (0x00 Negotiate, 0x01 SessionSetup, 0x02 Logoff, 0x03 TreeConnect, 0x04 TreeDisconnect, 0x05 Create, 0x06 Close, 0x08 Read, 0x09 Write). |
| status <hex_or_num> | 32-bit NTSTATUS code (0 STATUS_SUCCESS, 0xc000006d LOGON_FAILURE, 0xc0000022 ACCESS_DENIED) | 0 (STATUS_SUCCESS) | Sets bytes 8..11 (Status) of the 64-byte SMB2 header. |
| sessionid <hex_or_num> | treeid <number> | msgid <number> | 64-bit SessionId, 32-bit TreeId, 64-bit MessageId | 0 | Links SMB2 requests and replies across authenticated sessions and mounted shares. |
| share "<unc_path>" | Quoted UNC share path ("\\server\IPC$") | "\\server\IPC$" on treeconnect | Encodes the UTF-16LE share path inside treeconnect requests. |
| filename "<text>" | Quoted file or pipe name | "test.txt" on create | Encodes the UTF-16LE target filename inside create requests. |
Cross-Layer Wrappers Valid with smb
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 smb
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 445 | 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
Escape Backslashes in UNC Share Paths ("\\\\srv\\IPC$")
client_pc -> file_srv smb treeconnect share "\srv\IPC$"client_pc -> file_srv smb treeconnect share "\\srv\IPC$"Each \\ in a double-quoted .frasm string writes one literal \ character, so "\\srv\IPC$" produces \srvIPC$ on the wire (or "\\\\srv\\IPC$" for double leading slashes \\srv\IPC$).
Wireshark Filter for SMB2/3 Is smb2 (Not smb)
Wireshark display filter: smb2In Wireshark, smb filters legacy 1990s SMBv1 (ÿSMB), while modern SMB2 and SMB3 (þSMB) use the smb2 display filter.