CVE-2026-12413 · libreswan · IKEv2

One character, one dead IKE daemon

CVSS 7.5 · High CWE-193 · CWE-617 disclosed 2026-07-02 fixed in 5.3.1

TL;DR — In libreswan 4.6 through 5.3, an unauthenticated attacker who can reach UDP 500 can crash the pluto IKE daemon by sending a single malformed IKEv2 fragment. The bug is an off-by-one in an assertion; the fix is one character. No remote code execution — availability only.

This page accompanies the first public proof-of-concept, validated A/B against source builds of 5.3 (crashes) and 5.3.1 (survives).

01The bug

reassemble_v2_incoming_fragments() in programs/pluto/ikev2_message.c contains this invariant:

passert(md->digest_roof < elemsof(md->digest));   /* PAYLIMIT == 30 */

md->digest is a fixed array of PAYLIMIT (30) payload descriptors; digest_roof is the number of entries in use. A message carrying exactly 30 well-formed payloads is a legal state — the parser caps at 30 — but the assertion demands strictly less. The fix changes < to <=:

-	passert(md->digest_roof < elemsof(md->digest));
+	passert(md->digest_roof <= elemsof(md->digest));

Because the assertion lives in the fragment-reassembly path, the trigger is not simply “send 30 payloads”. It has to be an IKE fragment message that completes:

  1. complete an ordinary, unauthenticated IKE_SA_INIT (Diffie-Hellman only),
  2. negotiate IKE fragmentation (Notify 16430),
  3. send one IKE_AUTH message that is a single fragment (SKF, number 1 of 1) whose outer chain carries 29 Notify payloads plus the SKF — 30 known payloads in total.

The single fragment completes immediately, reassembly runs, and the assertion fires. pluto aborts. A repeated stream keeps it down.

02Why a handshake, but no credentials

The SKF payload has to decrypt and pass ICV verification, which is why the attacker performs the IKE_SA_INIT exchange and derives SKEYSEED, SK_ei and SK_ai per RFC 7296. No credentials are involved: IKE_AUTH authentication happens after the crash point.

ParameterValue used by the PoC
EncryptionAES-CBC-128
PRF / integrityHMAC-SHA2-256 / HMAC-SHA2-256-128
DH groupMODP2048 (group 14)
Key scheduleSKEYSEED = prf(Ni|Nr, g^ir), then prf+ over Ni|Nr|SPIi|SPIr
Quirklibreswan’s prf+ appends the counter after the seed — match the implementation, not the RFC text

03Reproducing it

The lab is two network namespaces joined by a veth pair — nothing touches the host’s real interfaces. Build libreswan 5.3 (vulnerable) and 5.3.1 (fixed) from source, start pluto in one namespace, run the PoC from the other.

./lab/pluto-start.sh 5.3
sudo ip netns exec atk ./venv/bin/python poc/ikev2_frag_dos.py 10.99.0.1
./lab/pluto-alive.sh        # -> DEAD

Observed on 5.3:

received IKE_AUTH request fragment 1 (1 of 1), computing DH in the background
FATAL: ASSERTION FAILED: md->digest_roof < (sizeof(md->digest) / sizeof(*(md->digest)))
       (reassemble_v2_incoming_fragments() +977 programs/pluto/ikev2_message.c)
libreswan 5.3 (vulnerable) SIGABRT — daemon dead (3/3 runs)
libreswan 5.3.1 (fixed) reassembled, rejected, daemon alive

On 5.3.1 the same packet is reassembled, the bogus inner payload is rejected with INVALID_SYNTAX, the IKE SA is deleted — and the daemon stays up.

04Impact and mitigation

CVSS 3.1 7.5 (High): AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. Availability only; the vendor states no RCE is possible. Any IKEv2 responder with fragmentation enabled (the default) is exposed. IKEv1 is not affected.

05Credits

The vulnerability was reserved as CVE-2026-12413 on 2026-06-16 and disclosed on 2026-07-02. It was found by Hu Xinyao and fixed by the libreswan project (commit 5c4369afcfe95a924ee0a96a0b29a7204dc40504, released in 5.3.1). This writeup and the PoC are a post-disclosure reproduction: the bug is patched, and the goal is to give defenders a concrete test case and researchers a starting point for fragment-handling audits in other IKE stacks.

06Resources