Protocol 31 of 81Layer 4FrameAssembly v3.1.2
llms-full.txt
sctpStream Control Transmission Protocol

4-Way Telecom Handshakes & Multi-Stream Chunks (sctp Proto 132)

Default Port / Protocol
IP Proto 132 (38412 NGAP / 36412 S1AP)
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
sctp
Standards & Specs
RFC 9260, RFC 4960, 3GPP TS 38.412
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6SCTP (CRC-32c) (IP Proto 132 (38412 NGAP / 36412 S1AP))

What It Does on the Wire

Powering 4G S1AP and 5G NGAP telecom cores on IP Protocol 132, sctp packs 32-bit padded chunks (init, data, sack, heartbeat) and computes the infamous reflected Castagnoli CRC-32c automatically.

Stream Control Transmission Protocol (sctp, IP protocol 132, RFC 9260) is the message-oriented, multi-stream Layer 4 transport underpinning 5G Core NGAP (38412), 4G LTE S1AP (36412), Diameter (3868), SS7 SIGTRAN M3UA (2905), and WebRTC DataChannels. Every SCTP packet carries a 12-byte Common Header (Source Port, Destination Port, 32-bit Verification Tag, and 32-bit checksum) followed by chunk TLVs.

Unlike TCP and UDP, SCTP mandates the Castagnoli CRC-32c polynomial rather than an ones'-complement sum. FrameAssembly computes the exact hardware-table Castagnoli CRC-32c across the Common Header and 4-byte-padded chunks automatically so Wireshark and telecom core stacks validate every packet cleanly.

5G Core N2 (gNB <-> AMF NGAP) & 4G S1-MME Signaling Labs

Generate 4-way init -> initack -> cookieecho -> cookieack SCTP associations followed by data chunks with ppid 60 (NGAP) on port 38412 or ppid 18 (S1AP) on 36412.

Telecom Firewall & GTP/SCTP Inspection Validation

Audit carrier border firewalls forVerification Tag (vtag) state tracking, heartbeat / heartbeatack keepalives, and abort / shutdown association teardown.

SS7 SIGTRAN M3UA & Diameter Core Transport Captures

Craft multi-stream (stream, ssn, tsn) SCTP frames on port 2905 (ppid 3 M3UA) or 3868 (ppid 46 Diameter) without needing live mobile core infrastructure.

Minimal Quickstart (sctp_quickstart.frasm)

Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.

sctp_quickstart.frasm8 lines
Open in Playground
host gnb_01 { ip 10.50.1.10 }
host amf_01 { ip 10.50.1.20 }
compile {
gnb_01 -> amf_01 sctp init srcport 38412 dstport 38412 vtag 0 tsn 1000 wait 1ms
gnb_01 <- amf_01 sctp initack vtag 0x11223344 tsn 2000 wait 1ms
gnb_01 -> amf_01 sctp data vtag 0x22334455 tsn 1001 stream 0 ssn 0 ppid 60 hexpayload "0015000900000100"
}

What the Compiler Calculates So You Don't Have To

  • Computes the 32-bit reflected Castagnoli CRC-32c checksum across the 12-byte SCTP Common Header and all padded chunk bytes.
  • Pads chunk payloads to 4-byte alignment per RFC 9260 while recording the exact unpadded length inside the Chunk Length field.
  • Inherits bidirectional ports (38412 <-> 38412) across -> and <- statements after the initial init packet.
Multi-Frame Lab · Ready to Compile

Complete 5G N2 NGAP SCTP 4-Way Handshake, Data Transfer & Heartbeat

Models a 5G gNodeB establishing a full 4-way cookie handshake with an AMF on port 38412, transmitting an NGAP Setup Request (ppid 60), receiving sack, and exchanging heartbeat / heartbeatack.

sctp_5g_ngap_association.frasm16 lines
Open in Playground
host gnb_du { ip 172.20.10.11 }
host core_amf { ip 172.20.10.50 }
compile {
// 1. RFC 9260 4-way association handshake (INIT must carry vtag 0)
gnb_du -> core_amf sctp init srcport 38412 dstport 38412 vtag 0 tsn 1000 dscp 46 wait 1ms
gnb_du <- core_amf sctp initack vtag 0xa1b2c3d4 tsn 5000 dscp 46 wait 1ms
gnb_du -> core_amf sctp cookieecho vtag 0x55667788 dscp 46 wait 1ms
gnb_du <- core_amf sctp cookieack vtag 0xa1b2c3d4 dscp 46 wait 2ms
// 2. NGAP payload over Stream 0 (PPID 60 = 3GPP NGAP) + SACK acknowledgment
gnb_du -> core_amf sctp data vtag 0x55667788 tsn 1000 stream 0 ssn 0 ppid 60 dscp 46 hexpayload "00150014000002001b00080000f110000001" wait 1ms
gnb_du <- core_amf sctp sack vtag 0xa1b2c3d4 tsn 1000 dscp 46 wait 5ms
// 3. Path liveness probe
gnb_du -> core_amf sctp heartbeat vtag 0x55667788 wait 1ms
gnb_du <- core_amf sctp heartbeatack vtag 0xa1b2c3d4
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show sctp_5g_ngap_association.frasm

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly sctp_5g_ngap_association.frasm sctp_5g_ngap_association.pcap
frameassembly sctp_5g_ngap_association.frasm sctp_5g_ngap_association.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse sctp_5g_ngap_association.pcap sctp_5g_ngap_association_edited.frasm

All sctp 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 sctp:

src_host -> dst_host sctp [chunk <type> | data | init | initack | sack | heartbeat | heartbeatack | abort | shutdown | shutdownack | cookieecho | cookieack] [vtag <number>] [tsn <number>] [stream <0..65535>] [ssn <0..65535>] [ppid <number>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
data | init | initack | sack | heartbeat | heartbeatack | abort | shutdown | shutdownack | cookieecho | cookieackBare chunk keyword (or chunk <type>)data (Chunk Type 0)Selects the RFC 9260 SCTP chunk type (0=DATA, 1=INIT, 2=INIT_ACK, 3=SACK, 4=HEARTBEAT, 5=HEARTBEAT_ACK, 6=ABORT, 7=SHUTDOWN, 8=SHUTDOWN_ACK, 10=COOKIE_ECHO, 11=COOKIE_ACK).
vtag <number>Whole number0 on init, 1 otherwiseSets the 32-bit Verification Tag in bytes 4..7 of the SCTP Common Header (0 mandatory on init).
tsn <number>Whole number1Sets Initial TSN in init/initack, Cumulative TSN Ack in sack, or chunk TSN in data.
stream <0..65535>Whole number (0..65535)0Sets the Stream Identifier S field inside data chunks.
ssn <0..65535>Whole number (0..65535)0Sets the 16-bit Stream Sequence Number inside data chunks.
ppid <number>32-bit IANA Payload Protocol Identifier0Sets the big-endian Payload Protocol ID in data chunks (60=NGAP, 18=S1AP, 46=Diameter, 3=M3UA) so Wireshark auto-dissects upper layers.

Cross-Layer Wrappers Valid with sctp

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

10 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances 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)OmittedAppends 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 MACHost MAC / RFC multicast MACOverrides 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..1UntaggedWraps 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..4095Untagged (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..255Unlabeled (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..3ttl 64, dscp 0, ecn 0Sets 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..8191ipid 1, flags 0, fragoffset 0Sets 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)0Sets 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..65535srcport 49152 (remembered), IP Proto 132 (38412 NGAP / 36412 S1AP)Overrides source or destination port and remembers the port pair automatically on <- replies.

Gotchas & Quick Fixes

Chunk Names Have Zero Underscores (initack, cookieecho, heartbeatack)

Avoid
gnb_du <- core_amf sctp init_ack vtag 0x11223344
Valid v3.1.2 Syntax
gnb_du <- core_amf sctp initack vtag 0x11223344

All SCTP chunk keywords follow FrameAssembly's [a-z0-9]+ rule: initack, cookieecho, cookieack, heartbeatack, and shutdownack.

Use tsn Instead of TCP seq on SCTP Frames

Avoid
gnb_du -> core_amf sctp data seq 1001 ppid 60
Valid v3.1.2 Syntax
gnb_du -> core_amf sctp data tsn 1001 ppid 60

seq is a TCP-only option and cannot be used on SCTP packets; use tsn for Transmission Sequence Numbers and ssn for Stream Sequence Numbers.

Field Guide 03
Poke Stateful Firewalls, Suricata, Zeek & OT Conduits