
A Junos router is two computers in one chassis. The routing engine runs the
daemons; the packet forwarding engine moves the traffic. kmd lives on the
routing engine, and its job begins where trust has not yet been established.
Two planes, one chassis
Junos separates the Routing Engine (RE) from the Packet Forwarding Engine
(PFE). The RE is a general-purpose computer running a FreeBSD-derived kernel
and the daemons: rpd (routing), mgd (management), dcd (device config),
chassisd, SNMP, event handling and kmd. The PFE is a separate subsystem — on
MX, a Trio-based ASIC complex with its own microkernel — forwarding packets
according to RE-programmed state.
The split is why a routing-process crash does not stop forwarding — and why
control-plane compromise is quiet: the attacker gets the configuration and keys
without causing a traffic outage.
The daemons that matter
mgd accepts CLI, NETCONF and J-Web sessions and owns the candidate
configuration. dcd translates committed configuration into kernel state. rpd
speaks BGP, OSPF, IS-IS, MPLS signalling and policy. chassisd manages hardware.
kmd handles IKE and IPsec key management.
Each is a separate process with its own privileges. kmd handles key material
and installs security associations, so a memory-safety defect in it is a root
defect.
The IKE packet
IKE runs over UDP. Port 500 carries IKE; port 4500 carries IKE with NAT
traversal and encapsulated ESP. An IKE message is a header followed by payloads:
IKE header (SPI, version, exchange type, flags, message ID, length)
├── SA payload proposals: encryption, hash, DH group, auth method
├── KE payload Diffie-Hellman public value
├── Nonce payload random data
├── Certificate payload DER-encoded X.509, possibly a chain
├── Certificate Request trusted CA names
├── ID payload identity of the sender
└── Signature payload over the exchange, verified with the cert key
With RSA-signature authentication the peer sends a certificate and signs the
exchange with the matching private key. kmd must parse it to extract subject,
issuer, public key and extensions; validate the chain against configured trust
anchors; check validity and key usage; then verify the signature.
Parsing happens before every trust decision, so the parser is reachable by an
unauthenticated sender and the data is attacker-controlled.
Why X.509 is hard to parse
A certificate is ASN.1 DER: nested tags, lengths and values, optional fields,
extensions and several string encodings. A distinguished name can hold dozens of
components; a chain many certificates.
Every one is a length or count the parser must validate against a destination.
The classic failures are a distinguished-name or SAN field longer than the stack
buffer it is copied into; a chain with more elements than a fixed array holds; or
an ASN.1 length that claims more bytes than the buffer has, and is trusted by the
copy.
The advisory documents the class but not which field overflows. Those three are
inferred, not published.
What "root" means here
kmd runs on the RE with the privileges needed to manage SAs and key material.
Control its instruction pointer and the code runs with those privileges —
effectively root: read the configuration and key material, add users, change
policy, open a management channel.
Why the design cannot "parse later"
A common reaction: why not verify the signature first, and parse only if it is
valid? Because the signature is verified with the key in the certificate — you
cannot check it without first reading that key out of the attacker-supplied
document. The ordering is forced by the protocol.
That makes the class structural. The defences are memory-safe parsing, strict
bounds checks on every length and count, and compartmentalisation so a parser bug
is not automatically a root bug. Junos chose a privileged daemon; the fix is a
bounds check inside it, not a redesign of IKE.
The takeaway
kmd has a large trust surface: it must parse untrusted data from anyone who can
reach UDP 500/4500, before it knows who they are. Part 6 looks at the other
October 2026 bugs — and at what the corpus got wrong about one.

Next: Part 6 — the smaller failures: four more ways to take an MX offline,
and the companion CVE the corpus mislabels.

Comments (0)