Hi all,

I think there is an unresolved gap in the specification of the associated
data (AD) boundary when an AEAD algorithm protects an Encrypted Fragment
Payload (SKF). Implementations appear to agree on one answer; as far as I
can tell, no document states it.

RFC 7383 Section 2.5 delegates the cryptographic processing of the
Encrypted Fragment Payload. It "is identical to that described in Section
3.14 of [RFC7296], as well as documents updating such processing for
particular algorithms or modes, such as [RFC5282]."

RFC 5282 Section 5.1 fixes the AD as ending at "the last octet of the
Payload Header of the Encrypted Payload (i.e., the fourth octet of the
Encrypted Payload)". Section 5.2 repeats that parenthetical.

For an Encrypted Payload (SK) the two formulations agree. The generic
payload header is four octets (RFC 7296 Section 3.2), so AD = 28 octets of
fixed IKE header + 4 = 32.

For an Encrypted Fragment Payload they do not agree. Its header carries
two-octet Fragment Number and Total Fragments fields ahead of the IV. The
rule -- through the last octet of the payload header -- gives 36 octets and
places both counters under AEAD integrity protection. The parenthetical
gloss -- "the fourth octet" -- gives 32 and leaves them unprotected.

Both readings are self-consistent and I cannot find a document that
resolves which governs. RFC 7383 Section 2.5 lists the counters among the
fragment payload's own fields, which makes 36 natural; RFC 7296 Section 3.2
fixes the generic payload header at four octets, which makes 32 literal.
The conflict is invisible for the Encrypted Payload, which is presumably
why it has gone unremarked: RFC 5282 predates IKEv2 fragmentation, and its
Figure 3 draws the boundary on an Encrypted Payload, which has no counters.

RFC 9242 Section 3.3.2 looks as though it settles this, and I want to say
why I do not think it does. It defines IntAuth*A over a range ending at the
last octet of the generic header of the Encrypted payload, and states that
this scope "is identical to the scope of Associated Data defined for the
use of AEAD algorithms in IKEv2 (see Section 5.1 of [RFC5282])". But the
same section requires that a fragmented message "MUST be reconstructed
before calculating the prf as if it were received unfragmented". The
payload it equates is therefore a reconstructed Encrypted payload, which
has no fragment counters -- the payload whose boundary is in question never
exists for that mechanism. It also writes the constant out, "the Encrypted
payload header (four octets)", for a header the fragment payload extends to
eight.

I checked the errata. RFC 7383 has none. Of RFC 5282's three, none concerns
Section 5.1. RFC 9242 has two, both in Section 3.3.2 and both editorial.
Neither RFC 7383 nor RFC 5282 has an updating or obsoleting document.

The two readings are not equally safe. RFC 7296 Section 3.14 scopes the
Integrity Checksum Data over "the entire message starting with the Fixed
IKE header through the Pad Length", which for a fragment includes the
counters, so a non-AEAD SA authenticates them. Choosing 32 would leave an
AEAD SA weaker than a non-AEAD one at exactly the fields reassembly depends
on: RFC 7383 Section 2.5.2 uses Total Fragments to separate fragment sets
across PMTU probes.

Empirically, 36 is what is deployed. I tested an IKEv2 implementation of my
own against strongSwan 6.0.7 and libreswan built from upstream commit
9f4191bd, and all three use 36. The two kinds of evidence differ and I
would rather separate them than average over them. strongSwan logs its
derived keys, so its messages can be opened and the boundary checked
directly. libreswan exposes only symkey handles, so its agreement is
established by interoperation rather than cryptographically: its fragments
verify at 36 and it accepts fragments built there.

Across 21 captures for which strongSwan logged its keys, 78 encrypted
messages were recovered and 76 opened at the boundary above -- 19 Encrypted
Fragment payloads at 36 and 57 Encrypted payloads at 32 -with no
counterexample. The two that did not open fail at every AD length from 0 to
63 with every logged key, so their keys are absent from the log rather than
their boundary in dispute.

The captures, the sweep that produced those counts, and a pair of AES-GCM
test vectors pinning both boundaries to published bytes are archived at
https://doi.org/10.5281/zenodo.23932948. The vectors need none of my code
to check: any AES-GCM implementation will do, and each opens at the stated
length and no other. This work is to appear at CSET '26.

Two questions for the working group.

First, is the 36-octet reading agreed? I would value being told I have
misread something, and that is the cheaper outcome.

Second, if it is agreed, is it worth recording somewhere normative? An
erratum against RFC 5282 looks like the wrong instrument to me -- the text
is not in error, it is silent about a payload that did not exist when it
was written -- but the gap has a cost. An implementer who reads the
parenthetical literally, chooses 32, and tests against nothing but itself
will interoperate with no one, and will not be able to name the sentence it
violated.

Thanks,

Venkata Karunakar Uppalapati
Independent Researcher
_______________________________________________
IPsec mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to