IKE
Internet Key Exchange, in both its versions: IKEv1, RFC 2409 on the ISAKMP framework of RFC 2408, and IKEv2, RFC 7296. Added in 11.6.0 (#124) with its companion ESP, as part of the defense lot (#125), which this release completes: on a defense network, the "black" side of the IP encryptors is made of IKE and ESP, and labelling IKE and exposing the SPIs is enough to map who negotiates with whom. The decoder reads the 28-byte header and the chain of top-level payloads without entering them; what is encrypted stays bytes. The module is packet_parser::parse::application::protocols::ike, the error type IkeParseError is in packet_parser::errors::application::ike.
On UDP 500 and 4500, by port
IKE travels over UDP: port 500 (IANA isakmp), and port 4500 (IANA ipsec-nat-t) behind a NAT (RFC 3948), or because the implementation chose that port. The rule of the dispatch table is port-guarded, 500 or 4500 on either side:
#![allow(unused)] fn main() { port_rule(ApplicationProtocol::Ike, Guard::Udp, is_ike_udp_port, ProbeId::Ike), // 500, 4500 }
There is no blind probe: a 28-byte header with a plausible version and length is not a signature strong enough to try on every datagram. The probe is IkePacket::from_udp, run on the whole datagram, as every probe but the four text ones since 11.7.0: the header's length must cover the message exactly. The rule sits among the port rules, after PostgreSQL's and right before the two other rules of port 4500, ESP and NAT-keepalive; the WireGuard rule of UDP 51820 comes later, so that an IKE packet whose peer drew 51820 as its ephemeral port keeps its label.
One side is enough. In ipsec_isakmp_esp.pcap, a client behind a NAT, 192.168.2.100, talks to nine gateways from ports 10500, 14500 and a few ephemeral ones: only the gateway's side is 500 or 4500. The capture's 279 IKE_SA_INIT messages are on UDP 500, its 240 IKE_AUTH and INFORMATIONAL messages on UDP 4500, with its 315 ESP packets.
IKE on another port is declared with ParseConfig::decode_as(port, DecodeAsProtocol::Ike) (Decode As), one of the DecodeAsProtocol variants added in 11.6.0: same probe, same transport guard, and the content still decides (tested):
#![allow(unused)] fn main() { #[test] fn ike_on_another_port_needs_decode_as() { let mut raw = hex::decode(NAT_T_IKE_HEX).unwrap(); move_to_port_4501(&mut raw); // The same bytes, on a port the table does not guard: no IKE. assert_eq!(label(&raw, &ParseConfig::new()), Some("Unknown")); // Declared, the port is guarded too... let config = ParseConfig::new().decode_as(4501, DecodeAsProtocol::Ike); assert_eq!(label(&raw, &config), Some("IKE")); // ...and the content still decides: one bit off in the IKE length // (bytes 70 to 73 of the frame, 76 becomes 77), and no label. raw[73] ^= 0x01; assert_eq!(label(&raw, &config), Some("Unknown")); } }
Being port-guarded, IKE is not tried by classify_payload when it is given no port (None, None): a port rule needs a port to check.
UDP 4500: three things on one port
RFC 3948 §2 shares port 4500 between three kinds of datagrams, and UdpEncapsulation::classify tells them apart:
#![allow(unused)] fn main() { #[non_exhaustive] pub enum UdpEncapsulation<'a> { Ike(&'a [u8]), // the non-ESP marker, then an IKE message: the bytes after the marker Esp(&'a [u8]), // an ESP packet, non-zero SPI first: the whole datagram Keepalive, // NAT-keepalive: a single 0xFF byte } }
classify reads the UDP payload in this order, and the first matching row decides:
| UDP payload | classify |
|---|---|
exactly one byte, 0xFF (§2.3) | Keepalive |
| four zero bytes, the non-ESP marker (§2.2), then at least one byte | Ike(rest), the bytes after the marker, not yet decoded |
| the marker alone, or fewer than 8 bytes | Err(InvalidUdpEncapsulation { length }) |
| anything else: a non-zero SPI and a sequence number (§2.1) | Esp(payload), the whole datagram |
The marker sits where an ESP packet has its SPI, and an SPI of zero is reserved and never sent (RFC 4303 §2.1): no ESP packet starts with it. Port 4500 has three rules, in this order:
#![allow(unused)] fn main() { port_rule(ApplicationProtocol::Ike, Guard::Udp, is_ike_udp_port, ProbeId::Ike), // 500, 4500 port_rule(ApplicationProtocol::Esp, Guard::Udp, is_nat_t_udp_port, ProbeId::EspNatT), // 4500 port_rule(ApplicationProtocol::NatKeepalive, Guard::Udp, is_nat_t_udp_port, ProbeId::NatKeepalive), // 4500 }
The IKE probe does not go through classify: IkePacket::from_udp tries the bare message first, as on port 500, and if that fails while the marker is there with something after it, it decodes what follows the marker. A bare IKE message on 4500 is therefore accepted too. The other two rules give the labels "ESP" and "NAT-keepalive", described on the ESP page; UDP 500 carries neither.
Frame 42 of ipsec_isakmp_esp.pcap is an INFORMATIONAL behind the marker. Read bare, the marker becomes the first half of an initiator SPI, every field slides by four bytes, and the length read is 0 (tested):
#![allow(unused)] fn main() { #[test] fn ike_on_udp_4500_follows_the_non_esp_marker() { let raw = hex::decode(NAT_T_IKE_HEX).unwrap(); let flow = parse(LinkType::ETHERNET, &raw).unwrap(); let transport = flow.transport.as_ref().unwrap(); assert_eq!( (transport.source_port, transport.destination_port), (Some(4500), Some(14500)) ); assert_eq!( flow.application.as_ref().unwrap().protocol.label(), "IKE" ); let payload = transport.payload.unwrap(); assert_eq!(&payload[..4], [0, 0, 0, 0]); // the non-ESP marker // Read bare, the marker becomes half of an initiator SPI, every field // slides by four bytes, and the length read is 0. assert_eq!( IkePacket::try_from(payload), Err(IkeParseError::LengthMismatch { declared: 0, actual: 80 }) ); let Ok(UdpEncapsulation::Ike(message)) = UdpEncapsulation::classify(payload) else { panic!("expected the non-ESP marker"); }; assert_eq!(message.len(), 76); // from_udp tries the bare message, then what follows the marker. let ike = IkePacket::from_udp(payload).unwrap(); assert_eq!(ike.header.initiator_spi, 0xde64_8338_c613_aa68); assert_eq!(ike.header.exchange(), Some(ExchangeType::Informational)); assert_eq!(ike.header.length, 76); assert_eq!(ike.payload_types().collect::<Vec<_>>(), [46]); } }
The header
#![allow(unused)] fn main() { #[non_exhaustive] pub struct IkeHeader { pub initiator_spi: u64, // IKEv1: the initiator's cookie pub responder_spi: u64, // zero in the first message of an initial exchange pub next_payload: u8, // type of the first payload pub version: u8, // raw: major version on the high nibble, minor on the low pub exchange_type: u8, // raw; exchange() names it pub flags: u8, // raw; one accessor per flag, by version pub message_id: u32, pub length: u32, // the whole message, header included } }
ISAKMP and IKEv2 share the layout (RFC 2408 §3.1, RFC 7296 §3.1), big-endian:
| Bytes | Field | Note |
|---|---|---|
| 0–7 | initiator_spi | never zero in IKEv2 (ZeroInitiatorSpi) |
| 8–15 | responder_spi | |
| 16 | next_payload | in an IKEv1 message under the E flag, the first payload under the encryption |
| 17 | version | major_version(), 1 or 2 (UnsupportedVersion otherwise), and minor_version(), not checked |
| 18 | exchange_type | exchange() returns an Option<ExchangeType> |
| 19 | flags | read by the accessors below |
| 20–23 | message_id | |
| 24–27 | length | must equal the size of the message decoded (LengthMismatch) |
The flags byte is the same in both versions, its bits are not. Each accessor returns false for the other version: IKEv2 encrypts with a payload, not a flag.
| Accessor | Version | Bit | Meaning |
|---|---|---|---|
encryption_flag() | IKEv1 | E 0x01 | the payloads are encrypted |
commit_flag() | IKEv1 | C 0x02 | the peer must wait for the sender's CONNECTED notification before using the SA |
authentication_only_flag() | IKEv1 | A 0x04 | authentication only, no encryption |
initiator_flag() | IKEv2 | I 0x08 | sent by the initiator of the IKE SA |
version_flag() | IKEv2 | V 0x10 | the sender can speak a higher major version |
response_flag() | IKEv2 | R 0x20 | a response |
ExchangeType names the code according to the major version (RFC 2408, RFC 2409 for quick mode and new group mode, RFC 7296 and the IANA registry IKEv2 Exchange Types). Since 11.7.0 (#189), every IKEv2 code the registry assigns, 34 to 44, has a variant: GsaInbandRekey names 42, the GSA_INBAND_REKEY of G-IKEv2 (RFC 9838 §2.4.2), which tshark 4.6.6 still shows as "Unassigned". In IKEv1, Transaction names code 6, the Transaction exchange of mode-config (draft-dukes-ike-mode-cfg-02), as tshark does: the registry lists 6 to 31 as "ISAKMP Future Use", and the draft was never standardized, like payload 14 below. Any other code is None, and the message is decoded all the same.
ExchangeType | IKEv1 | IKEv2 |
|---|---|---|
Base | 1 | — |
IdentityProtection (main mode) | 2 | — |
AuthenticationOnly | 3 | — |
Aggressive | 4 | — |
Informational | 5 | 37 |
Transaction (mode-config, 11.7.0) | 6 | — |
QuickMode | 32 | — |
NewGroupMode | 33 | — |
IkeSaInit | — | 34 |
IkeAuth | — | 35 |
CreateChildSa | — | 36 |
IkeSessionResume | — | 38 |
GsaAuth, GsaRegistration, GsaRekey | — | 39, 40, 41 |
GsaInbandRekey (11.7.0) | — | 42 |
IkeIntermediate | — | 43 |
IkeFollowupKe | — | 44 |
The first message of the site-to-site VPN of the corpus, an IKE_SA_INIT on UDP 500 (tested):
#![allow(unused)] fn main() { #[test] fn an_ike_sa_init_on_udp_500() { let raw = hex::decode(IKEV2_SA_INIT_HEX).unwrap(); let flow = parse(LinkType::ETHERNET, &raw).unwrap(); // Port 500 and a message whose length covers the datagram: "IKE". assert_eq!( flow.application.as_ref().unwrap().protocol.label(), "IKE" ); let payload = flow.transport.as_ref().unwrap().payload.unwrap(); let ike = IkePacket::from_udp(payload).unwrap(); let header = ike.header; assert_eq!(header.initiator_spi, 0x62f9_4c98_8771_5a34); assert_eq!(header.responder_spi, 0); // not chosen yet assert_eq!((header.major_version(), header.minor_version()), (2, 0)); assert_eq!(header.exchange(), Some(ExchangeType::IkeSaInit)); assert!(header.initiator_flag() && !header.response_flag()); assert_eq!((header.message_id, header.length), (0, 374)); // The top-level chain: SA, KE, Nonce, two Vendor IDs, three // Notifications, a Vendor ID; the last one says "no next payload". assert_eq!( ike.payload_types().collect::<Vec<_>>(), [33, 34, 40, 43, 43, 41, 41, 41, 43] ); assert_eq!(ike.payloads[0].kind, Some(PayloadType::SecurityAssociation)); assert_eq!(ike.payloads[2].kind, Some(PayloadType::Nonce)); assert_eq!(ike.payloads[3].length, 23); // generic header included assert_eq!(ike.payloads[3].body, b"CISCO-DELETE-REASON"); assert_eq!(ike.payloads[8].next_payload, 0); assert!(ike.payloads.iter().all(|payload| !payload.critical)); assert_eq!(ike.encrypted_body, None); } }
The payload chain
After the header come the payloads, each with a 4-byte generic header (RFC 7296 §3.2, RFC 2408 §3.2):
#![allow(unused)] fn main() { #[non_exhaustive] pub struct IkePayload<'a> { pub payload_type: u8, // raw code, as the previous payload (or the header) names it pub kind: Option<PayloadType>, // the code named, by the version of the message pub next_payload: u8, // 0 for the last one; in an IKEv2 SK, the first payload under the encryption pub critical: bool, // IKEv2 only: always false in IKEv1, where the byte is reserved pub length: u16, // declared, generic header included pub body: &'a [u8], // the bytes after the generic header, borrowed } }
| Bytes | Field |
|---|---|
| 0 | next_payload |
| 1 | critical bit 0x80, then reserved |
| 2–3 | length |
4 to length − 1 | body |
A payload does not carry its own type: the header's next_payload names the first one, and each payload names the next. IkePacket::payloads keeps them in message order, and payload_types() iterates their raw codes. The walk checks each length, and the chain must end with the message:
- a length below the 4 bytes of the generic header is
InvalidPayloadLength { payload_type, length }, a length beyond what remains isPayloadOverflow { payload_type, needed, available }; - the chain ends on a
next_payloadof 0, and bytes left after it areUnexpectedTrailingBytes { trailing }; - the chain also ends with the message when the last payload announces another one, as tshark reads it: frame 192 of
ipsec_isakmp_esp.pcapis an IKE_AUTH whose only payload, of the unassigned type 127 and 784 bytes, announces a 35. One to three bytes left for an announced payload cannot hold its header, though:PayloadOverflowwithneeded: 4.
Only the top level is walked: Proposal and Transform live inside a Security Association, and no body is decoded. payloads is the decoder's one allocation; the bodies borrow the packet. PayloadType names the codes according to the version: for IKEv1, RFC 2408, RFC 3947 for NAT-T, RFC 3547 and RFC 6407 for GDOI, and the IANA registry Next Payload Types; for IKEv2, RFC 7296 and the IANA registry IKEv2 Payload Types. An unknown code, such as the unassigned 127, is None and its payload is kept like the others.
PayloadType | IKEv1 | IKEv2 |
|---|---|---|
SecurityAssociation | 1 | 33 |
Proposal, Transform | 2, 3 | — |
KeyExchange | 4 | 34 |
Identification | 5 | — |
IdentificationInitiator, IdentificationResponder | — | 35, 36 |
Certificate, CertificateRequest | 6, 7 | 37, 38 |
Hash, Signature | 8, 9 | — |
Authentication | — | 39 |
Nonce | 10 | 40 |
Notification | 11 | 41 |
Delete | 12 | 42 |
VendorId | 13 | 43 |
Attributes (mode-config) | 14 | — |
SaKek, SaTek (GDOI, 11.7.0) | 15, 16 | — |
KeyDownload | 17 (GDOI, 11.7.0) | 52 |
SequenceNumber, ProofOfPossession (GDOI, 11.7.0) | 18, 19 | — |
NatDiscovery (NatDetection until 12.0.0) | 20 (RFC 3947); 130 (drafts) | — |
NatOriginalAddress | 21 (RFC 3947); 131 (drafts) | — |
GroupAssociatedPolicy (GDOI, 11.7.0) | 22 | — |
TrafficSelectorInitiator, TrafficSelectorResponder | — | 44, 45 |
Encrypted (SK) | — | 46 |
Configuration | — | 47 |
ExtensibleAuthentication | — | 48 |
GenericSecurePasswordMethod | — | 49 |
GroupIdentification, GroupSecurityAssociation | — | 50, 51 |
EncryptedFragment (SKF, RFC 7383) | — | 53 |
PuzzleSolution | — | 54 |
Payload 14, the attributes of mode-config, comes from a draft that was never standardized: the IANA registry marks it "Reserved, not to be used". Codes 130 and 131 are those of the NAT-T drafts draft-ietf-ipsec-nat-t-ike-00 to -03.
In IKEv1, codes 15 and 16 changed meaning in 11.7.0 (#189).
| Code | 11.6.0 | Since 11.7.0 | Registered by |
|---|---|---|---|
| 15 | NatDetection, renamed NatDiscovery in 12.0.0 | SaKek, SA KEK (SAK) | RFC 3547, GDOI |
| 16 | NatOriginalAddress | SaTek, SA TEK (SAT) | RFC 3547, GDOI |
| 17 to 19, 22 | None | the other GDOI types | RFC 3547, GDOI |
11.6.0 followed the drafts draft-ietf-ipsec-nat-t-ike-04 to -08, which used 15 and 16 without registering them. The Next Payload Types registry gives them to GDOI since RFC 3547, and RFC 3947 took 20 and 21 for NAT-T; NatDiscovery is the name RFC 3947 uses. PayloadType::from_code(1, 15) now returns Some(SaKek) and from_code(1, 16) Some(SaTek), as tshark ("SA KEK Payload", "SA TEK Payload"), libreswan and strongSwan read them.
A caller that matches on NatDiscovery or NatOriginalAddress no longer sees 15 or 16, including from a peer that still follows those drafts.
None of the 1 254 ISAKMP frames of the crate's corpus carries these codes in clear. Apart from a peer that follows the drafts, a GDOI type appears in clear at the top level only in the header of an encrypted message, whose next_payload names the first payload under the encryption: a GROUPKEY-PUSH announces a Sequence Number.
The codes of both tables, as from_code reads them (tested):
#![allow(unused)] fn main() { #[test] fn exchange_and_payload_codes_follow_the_iana_registries() { // The first argument is the major version, 1 or 2. assert_eq!(ExchangeType::from_code(2, 42), Some(ExchangeType::GsaInbandRekey)); assert_eq!(ExchangeType::from_code(1, 6), Some(ExchangeType::Transaction)); assert_eq!(ExchangeType::from_code(1, 7), None); // ISAKMP Future Use assert_eq!(ExchangeType::from_code(2, 6), None); // IKEv1 only // IKEv1 15 and 16 are GDOI's SA KEK and SA TEK, no longer NAT-T. assert_eq!(PayloadType::from_code(1, 15), Some(PayloadType::SaKek)); assert_eq!(PayloadType::from_code(1, 16), Some(PayloadType::SaTek)); // NAT-D and NAT-OA: 20 and 21 of RFC 3947, 130 and 131 of the drafts. for code in [20, 130] { assert_eq!(PayloadType::from_code(1, code), Some(PayloadType::NatDiscovery)); } for code in [21, 131] { assert_eq!(PayloadType::from_code(1, code), Some(PayloadType::NatOriginalAddress)); } // The other GDOI types; Key Download has a code in each version. assert_eq!(PayloadType::from_code(1, 17), Some(PayloadType::KeyDownload)); assert_eq!(PayloadType::from_code(2, 52), Some(PayloadType::KeyDownload)); assert_eq!(PayloadType::from_code(1, 18), Some(PayloadType::SequenceNumber)); assert_eq!(PayloadType::from_code(1, 19), Some(PayloadType::ProofOfPossession)); assert_eq!(PayloadType::from_code(1, 22), Some(PayloadType::GroupAssociatedPolicy)); // A code is read by the version of the message: 15 means nothing in IKEv2. assert_eq!(PayloadType::from_code(2, 15), None); assert_eq!(PayloadType::from_code(2, 127), None); // unassigned } }
What is encrypted
#![allow(unused)] fn main() { #[non_exhaustive] pub struct IkePacket<'a> { pub header: IkeHeader, pub payloads: Vec<IkePayload<'a>>, // top level, in message order pub encrypted_body: Option<&'a [u8]>, // the protected bytes, as they are } }
The two versions encrypt differently, and encrypted_body covers both:
- IKEv1 sets the E flag, and everything after the header is encrypted.
payloadsis empty,encrypted_bodyis the rest of the message, all of it encrypted, andheader.next_payloadnames the first payload under the encryption. In the main mode capture of the corpus, the eight messages after the key exchange, frames 5 to 12, are sent that way. - IKEv2 encrypts in a payload, SK (46), or SKF (53) for a fragment, which must be the last of the message (RFC 7296 §3.14). The walk stops on it, so a byte after it is
UnexpectedTrailingBytes. It is the last entry ofpayloadsand its body isencrypted_body; itsnext_payloadnames the first payload under the encryption, not a top-level one. Not every byte of that body is encrypted: it holds the IV in clear, then the encrypted payloads with their padding, then the integrity checksum data, in clear too (RFC 7296 §3.14), and an SKF puts its fragment number and total fragments before the IV (RFC 7383 §2.5). The crate does not split them; their sizes depend on the negotiated algorithms. In the corpus, 241 IKEv2 messages end with an SK: every IKE_AUTH and every INFORMATIONAL, except frame 192 and its payload of type 127.
The IKE_AUTH response of the VPN, then the first and fifth messages of an IKEv1 main mode (tested):
#![allow(unused)] fn main() { #[test] fn what_is_encrypted_stays_bytes() { // IKEv2, frame 4: the IKE_AUTH response is a single SK payload. let raw = hex::decode(IKEV2_IKE_AUTH_RESPONSE_HEX).unwrap(); let flow = parse(LinkType::ETHERNET, &raw).unwrap(); let payload = flow.transport.as_ref().unwrap().payload.unwrap(); let auth = IkePacket::from_udp(payload).unwrap(); assert_eq!(auth.header.initiator_spi, 0x62f9_4c98_8771_5a34); // same IKE SA assert_eq!(auth.header.responder_spi, 0xf055_34ee_f373_dc1b); assert_eq!(auth.header.exchange(), Some(ExchangeType::IkeAuth)); assert!(auth.header.response_flag()); assert_eq!(auth.payload_types().collect::<Vec<_>>(), [46]); let sk = &auth.payloads[0]; assert_eq!(sk.kind, Some(PayloadType::Encrypted)); assert_eq!(sk.next_payload, 43); // the first payload under the encryption assert_eq!(sk.length, 201); assert_eq!(auth.encrypted_body, Some(sk.body)); assert_eq!(sk.body.len(), 197); // IKEv1, frames 1 and 5 of the main mode: in clear, then under the E flag. let raw = hex::decode(IKEV1_MAIN_MODE_HEX).unwrap(); let flow = parse(LinkType::ETHERNET, &raw).unwrap(); let payload = flow.transport.as_ref().unwrap().payload.unwrap(); let first = IkePacket::from_udp(payload).unwrap(); assert_eq!(first.header.major_version(), 1); assert_eq!( first.header.exchange(), Some(ExchangeType::IdentityProtection) ); assert_eq!(first.payload_types().collect::<Vec<_>>(), [1, 13, 13]); // SA, two VIDs let raw = hex::decode(IKEV1_ENCRYPTED_HEX).unwrap(); let flow = parse(LinkType::ETHERNET, &raw).unwrap(); let payload = flow.transport.as_ref().unwrap().payload.unwrap(); let fifth = IkePacket::from_udp(payload).unwrap(); assert!(fifth.header.encryption_flag()); assert_eq!(fifth.header.next_payload, 5); // Identification, under the encryption assert!(fifth.payloads.is_empty()); assert_eq!(fifth.encrypted_body.map(<[u8]>::len), Some(76 - 28)); } }
Validations
All of them are IkeParseError, checked in this order:
| Error | When |
|---|---|
Truncated { expected, actual } | fewer than the 28 bytes of the header |
UnsupportedVersion(u8) | a major version other than 1 or 2 |
ZeroInitiatorSpi | IKEv2 with an initiator SPI of zero |
LengthMismatch { declared, actual } | the header's length is not the size of the message |
InvalidPayloadLength { payload_type, length } | a payload declares less than its 4-byte generic header |
PayloadOverflow { payload_type, needed, available } | a payload runs past the message, or one to three bytes are left for an announced payload |
UnexpectedTrailingBytes { trailing } | bytes after the last payload, or after an IKEv2 SK or SKF |
InvalidUdpEncapsulation { length } | UdpEncapsulation::classify only: neither a keepalive, nor the marker with bytes after it, nor 8 bytes for an ESP header |
A failure is not a corruption. The port is a hint: when the probe fails, the datagram goes on to the rules that follow, and nothing is reported in corrupted.
Oracle: 535 messages, field by field
The golden test tests/ipsec_golden.rs runs the three captures of pcaps_exemple/protocols/ipsec/, 858 frames, and compares every one with tshark 4.6.6, frozen in tests/data/ipsec_tshark_oracle.tsv by tools/ipsec_oracle.sh.
- For each IKE message: both SPIs, the version, the exchange type, the flags, the message ID, the length, and the top-level chain with the length of each payload. tshark's Proposal and Transform, nested in a Security Association, are left out.
- For each ESP packet: the SPI and the sequence number (ESP).
No Decode As is needed: every IKE frame has 500 or 4500 on one side.
| IKE messages | Number | Of which |
|---|---|---|
| IKEv1 | 12 | 6 main mode, 3 quick mode, 3 informational |
| IKEv2 | 523 | 281 IKE_SA_INIT, 224 IKE_AUTH, 18 INFORMATIONAL |
| with an encrypted body | 249 | 8 IKEv1, 241 IKEv2 |
| all | 535 |
A second test moves frame 42 and frame 11 of the nDPI capture, IKE behind the marker and ESP, to port 4501, where they become "Unknown", and declares them back with Decode As.
| Capture | Frames | Content | Origin |
|---|---|---|---|
attachment_ikev1_main_mode.pcap | 12 | IKEv1 on UDP 500: main mode, quick mode, informational | Wireshark wiki |
ikev2_s2s_ipsec_vpn_aes_gcm.pcapng | 12 | a site-to-site VPN: IKEv2 on UDP 500 (4), then native ESP (8) | Wireshark wiki |
ipsec_isakmp_esp.pcap | 834 | a client behind a NAT: IKEv2 on UDP 500 (279), IKEv2 (240) and ESP (315) on UDP 4500 | nDPI test corpus |
In the golden histogram of pcaps_exemple/protocols/ (tests/golden_pcaps.rs), "IKE" went from 0 to 535 and "ESP" from 0 to 315 with 11.6.0, all 850 frames taken from "Unknown". The-Ultimate-PCAP.pcapng, at the root of pcaps_exemple/, is read by neither test; a run of 11.6.0 over it labels 719 frames "IKE", as many as the ISAKMP frames tshark counts there. The fuzz target parse_ipsec runs nightly on IkePacket, UdpEncapsulation::classify and EspPacket.
What is left out
The limits every protocol shares, reassembly and checksums among them, are on the Limits page. The ones below are this protocol's own.
- Payload contents: proposals and transforms, key exchange data, nonces, identities, certificates, notifications and vendor IDs are bytes in
body. A vendor ID is recognizable by its bytes, theCISCO-DELETE-REASONof the example, not named. - Decryption: none, in either version;
encrypted_bodyis the bytes as they are, with the clear IV and integrity data of an IKEv2 SK or SKF. - No state: no pairing of a request with its response, no SA table, no link between an IKE SA and the ESP SPIs it negotiates. One message at a time, like the rest of the crate.
- IKEv2 fragments (SKF) are decoded one message at a time, never reassembled; an IKE message split by IP fragmentation has no transport layer, as everywhere in the crate.
- IKE over TCP is not recognized: the rule is
Guard::Udp.