Skip to content

Packet tag specification, version 1

Identifierdebuglet-tag-v1
StatusCurrent. The only version this release tags with and verifies.
ScopeIPv4 packets of a tagged run. IPv6 and SCION are not specified.
Implementationskernel tagger tagger.c, Go tag functions tagspec.HashInput, tagspec.PacketTag, tagspec.DeriveAK used by the pure-Go tagger (tesla) and the Go capture verifier (client.Verify, dbl verify), reference capture verifier tools/verify_pcap.py
Known-answer vectorstestdata/tag-vectors-v1.json, generated by the independent reference tools/tag_vectors.py

An executor tags the packets of a run with a 16-bit value in the IPv4 Identification field. A receiver that captured the packet can, once the executor has disclosed the epoch’s key, recompute the value and check which recent run on that executor sent the packet. This document defines exactly which bytes are authenticated, how the key is derived, how the tag is computed and placed, and what a match does and does not establish.

The key words MUST, SHOULD and MAY are used as in RFC 2119.

A tag that verifies under measurement ID M and epoch t shows that the authenticated bytes of the packet (§3) were tagged by a party that held the epoch key kt before it was disclosed, with the per-measurement key of M. In the supported profile that party is the executor’s tagger.

It does not show:

  • Non-repudiation. The executor’s key is a shared secret between the executor and, after disclosure, everyone. A tag is evidence for a verifier that trusts its own capture time; it is not a signature a third party can check without that trust. After disclosure anyone can compute valid tags, so a verifier MUST only accept packets it captured (by its own clock) before the key of their epoch was disclosed. Receiver clock and capture integrity are the verifier’s responsibility.
  • Payload authenticity beyond the first 64 bytes. Only the tag input (§3) is authenticated. Bytes after it, and the fields zeroed in it, can change without affecting the tag.
  • Correctness of a measurement conclusion, or destination consent. A tag attributes a packet to a run; it says nothing about what the run measured.
  • Freshness. A tagged packet can be recorded and replayed while its key is still secret, and the copy verifies; the tag carries no sequence number.
  • Uniqueness. A 16-bit tag collides by chance (§7). A single matching packet is weak evidence; a verifier SHOULD aggregate over several packets.

The executor holds a TESLA hash chain kL, …, k0 with ki = SHA-256(ki+1); k0 is the public anchor. Epoch t covers [anchor_timestamp + t·I, anchor_timestamp + (t+1)·I) for the published epoch length I. Epoch 0 has no signing key, since k0 is public, and nothing is tagged in it; kL is never disclosed, so nothing is tagged from epoch L on. Key schedule and disclosure timing are specified by the key schedule (schedule.go); this document relies only on the chain relation and the epoch mapping.

The per-measurement key of measurement M in epoch t is

ak = HKDF-SHA256(IKM = k_t, salt = absent, info = M, L = 32)

per RFC 5869, where an absent salt is 32 zero bytes, k_t is the 32-byte chain key and M is the measurement (debuglet) ID as the ASCII bytes of its canonical lowercase UUID string, exactly as the dispatcher lists it. The SipHash key is ak[0:16], used with the standard SipHash key encoding (k0 = little-endian ak[0:8], k1 = little-endian ak[8:16]), which is how the kernel map entry stores it. ak[16:32] is unused in v1.

The input is derived from the IPv4 packet as it leaves the sender, starting at the first byte of the IPv4 header.

  1. Coverage. A packet is covered only if all of the following hold; otherwise it has no v1 tag, the tagger leaves it unchanged and a verifier reports it unsupported with the reason in brackets:

    • the version nibble is 4 (ipv6 for 6, not_ipv4 otherwise);
    • at least 20 bytes are present (too_short);
    • IHL ≥ 5 and Total Length ≥ IHL·4 (malformed);
    • MF is clear and the fragment offset is zero (fragment);
    • at least n bytes are present, where n = min(64, Total Length) (too_short; a capture needs a snap length of at least 64 bytes).
  2. Length. The input is the first n bytes, n = min(64, Total Length). Total Length, not the frame or capture length, decides n, so link-layer padding never enters the input. A packet shorter than 64 bytes is hashed whole; nothing is padded.

  3. Canonicalization. In those n bytes the following are set to zero:

    OffsetFieldWhy it is excluded
    1TOS: DSCP and ECNrewritten by routers (remarking, ECN CE)
    4–5Identificationcarries the tag
    6–7Flags and fragment offsetthe tagger sets DF after hashing; middleboxes clear DF
    8TTLdecremented at every hop
    10–11Header checksumfollows every change above
    20 … IHL·4−1IP optionsrecord-route and timestamp options are filled in transit; the IHL itself stays authenticated
    IHL·4 + 2, +3ICMP checksum (protocol 1)see below
    IHL·4 + 16, +17TCP checksum (protocol 6)see below
    IHL·4 + 6, +7UDP checksum (protocol 17)see below

    Each listed byte is zeroed only where it lies inside the n bytes. With IP options, the transport checksum can fall outside the input (for IHL 15 the TCP checksum is at offset 76), in which case nothing is zeroed for it. Other protocols keep all their bytes.

    Transport checksums are excluded. With checksum offload the kernel tagger at TC egress sees a partial (pseudo-header) checksum that the NIC completes later, so the value on the wire differs from the value hashed. NAT and some middleboxes also rewrite it. Since the checksum is a function of bytes that are either authenticated (ports, payload prefix) or known to be mutable (addresses under NAT), hashing it adds no authentication and makes tags fail on ordinary offload paths.

    Addresses, protocol, Total Length and ports stay authenticated. They bind the tag to its flow and length, so a tag cannot be moved onto another flow. The consequence is that NAT and NAPT are unsupported: a translated packet does not verify (and the verifier looks the executor up by source address anyway).

out = SipHash-2-4(key = ak[0:16], message = input) 64-bit result
tag = out mod 2^16 the low 16 bits

SipHash-2-4 is the standard function of Aumasson and Bernstein (2012), including the final block: the last word carries the trailing len mod 8 bytes of the message in its low bytes and len mod 256 in its top byte. It MUST reproduce the 64 reference outputs published with SipHash, which the vector file repeats. In the little-endian 8-byte encoding of out, the tag is out[0] | out[1] << 8.

The tagger writes the tag into the Identification field in network byte order (byte 4 = tag >> 8, byte 5 = tag & 0xff), sets DF (bit 0x4000 of bytes 6–7), leaves every other bit of bytes 6–7 unchanged, and updates the header checksum. The kernel tagger updates it incrementally for the 4-byte word at offset 4; the pure-Go tagger recomputes it; both yield the RFC 791 checksum of the tagged header. Setting DF keeps a tagged packet from being fragmented in the network, which would destroy the tag (fragments are not covered, §3). The cost is that a tagged packet larger than the path MTU is dropped by the router with an ICMP “fragmentation needed” instead of being fragmented; the sender’s later packets to that destination are then fragmented locally, before the tagger, and go out untagged. The input is computed before DF is set and does not contain bytes 6–7, so a middlebox that clears DF does not break the tag.

A packet that is not covered is forwarded unchanged: in particular a fragment keeps its Identification, which reassembly needs.

Segmentation offload. The kernel tagger sees a GSO/TSO packet before it is segmented. The segments on the wire have other Total Length and payload bytes (and, typically, incremented Identification), so they do not verify. v1 does not specify tagging of offloaded segments; for full coverage an operator disables GSO and TSO on the tagged interface, and a receiver captures with GRO and LRO disabled so that it records packets as sent.

For a captured IPv4 packet with receive time r (by the verifier’s clock):

  1. Compute the input (§3). An uncovered packet is reported unsupported with its reason, never as a failed match.
  2. Let t = ⌊(r − anchor_timestamp) / I⌋. The candidate epochs are t and t − 1, excluding epoch 0, any epoch whose key is not yet disclosed, and any epoch e whose key may already have been public at r: with the executor’s disclosure delay d (at least 2 epochs; a verifier MUST refuse an executor that reports less or none), that is when r plus the verifier’s bound on its own clock lag reaches anchor_timestamp + (e + d)·I less the dispatcher’s allowance for executor clock lead. t − 1 is needed because a packet sent at the end of epoch t − 1 arrives in t, and because the kernel tagger switches keys at a refresh shortly after the boundary. A verifier MAY add further epochs to tolerate a bounded clock offset between sender and receiver; each one raises the false-match bound (§7) proportionally and SHOULD be reported.
  3. For each candidate epoch e with disclosed key kτ (τ ≥ e), derive ke = SHA-256τ−e(kτ) and check SHA-256e(ke) = k0.
  4. For each candidate measurement M (the executor’s recent runs), derive ak (§2) and compare the tag (§4) with the received Identification.
  5. Report every (M, e) that matches. More than one match is ambiguous and MUST be reported as such, not resolved silently.

The verifier’s input MUST be computed exactly as the tagger’s; the three implementations share the vector file (§9) to guarantee it.

For a packet that was not tagged by a candidate (for example another host’s traffic, or a packet of a different run), each (M, e) pair matches with probability 2−16, assuming SipHash behaves as a PRF. With N candidate measurements and E candidate epochs, the probability that the packet matches at least one is

P_false = 1 − (1 − 2^−16)^(N·E) ≤ N·E / 65536
N candidatesE = 2 (t, t−1)E = 3 (with one skew epoch)
13.1 × 10−54.6 × 10−5
103.1 × 10−44.6 × 10−4
1003.1 × 10−34.6 × 10−3

Over a capture of many unrelated packets a few false matches are expected. The same arithmetic applies to an attacker: sending one packet with each of the 216 Identification values makes one of them verify with certainty, so a count of matching packets from a source is only meaningful together with the number of non-matching packets from it. The probability that k independent unrelated packets all match the same candidate M is at most (E · 2−16)k, times N over all candidates: for N = 10, E = 2 and k = 3 that is below 3 × 10−13. Attribution of a flow SHOULD therefore rest on several matching packets of that flow, not on one.

An attacker without the key forges a tag for a chosen packet with probability 2−16 per attempt; the delayed disclosure and the receiver’s capture time (§1) bound the window in which that matters.

The identifier of this specification is debuglet-tag-v1. An executor reports it as capabilities.tagging.tag_spec (GET /executors, additive within API 1.9 and capability schema 1), and the admission snapshot of a result records it in provenance.vantage_point.capabilities.value.tagging, so a result names the algorithm of its run’s tags. The Go constant is tesla.TagSpec.

A fleet runs one version: mixed-version fleets are not supported, and a verifier implements the versions it names. A verifier MUST report packets of an executor that announces another tag_spec as unsupported. An executor that reports no tag_spec predates this document and used the unversioned pre-v1 tag, which differs from v1 in that it dropped the final partial SipHash block, hashed TTL, TOS, flags and the transport checksum, zeroed only the Identification and header checksum, and did not set DF; a v1 verifier does not reproduce those tags, and evidence recorded without tag_spec should be treated as pre-v1.

Any change to §2–§5 is a new version with a new identifier and a new vector file; released versions are not changed in place.

IPv6 is not specified in v1. Neither tagger tags IPv6, and a run whose IPv4 packets are kernel-tagged refuses IPv6 destinations. A future version is planned to carry the tag in an IPv6 Destination Options header.

testdata/tag-vectors-v1.json is generated by tools/tag_vectors.py, an implementation written from this document that shares no code with the taggers or the capture verifier and first checks its SipHash-2-4 against the 64 published reference outputs. It contains a four-epoch chain, the derived keys, and for each packet the raw bytes, the canonical input, the SipHash output, the tag and the exact tagged packet, or the unsupported reason. The set covers:

  • Total Lengths around the 8-byte block and the 64-byte input boundary (20, 21, 27–29, 35, 36, 55–57, 63–65, 72, 100, 576, 1400) for UDP, and TCP, ICMP and a protocol without a zeroed checksum;
  • changes the input absorbs (TTL, TOS, Identification, header and transport checksum, DF, bytes after the input, a rewritten record-route option) and changes it authenticates (a payload byte inside the input, a port, the source address), each tied to a reference vector by same_tag_as or tag_differs_from;
  • IP options, including IHL 15 where the TCP checksum lies outside the input;
  • unsupported packets: first and later fragments, IPv6, a capture shorter than the input, a header-only capture and IHL 4;
  • the first signing epoch: the anchor k0 never signs, and the tag the anchor would produce (anchor_tag) differs from the accepted tag.

Consumers: TestSipHashReferenceVectors, TestTagVectorsV1 and TestTagVectorsFirstSigningEpoch (Go verifier and key schedule), TestTagPacketVectorsV1 (pure-Go tagger), TestKernelTagVectorsV1 (the committed tagger.c object, required by scripts/ci-kernel.sh), TestVerifyVectorsThroughCaptures and TestVerifyMatchesVerifyPcap (the Go capture verifier in pkg/client, through every supported capture format and link type, and against verify_pcap.py) and tools/test_verify_pcap.py (capture verifier and generator drift). After a deliberate change of the generator, run python3 tools/tag_vectors.py; the Python tests fail on a stale file.

The epoch mapping of §2 and §6 holds only if the executor’s epochs and the verifier’s clock agree. The executor’s contract:

  • Epochs advance on the executor’s monotonic clock from the announced origin (anchor_timestamp), which is the wall-clock reading at chain start. The origin is trusted only if the host clock’s readiness (adjtimex state and estimated error against clock.max_error_ms) was ready at chain start; otherwise no key signs for the chain’s life and attribution is reported unavailable with clock_unready.
  • The executor measures drift as the wall time elapsed since the origin less the monotonic time elapsed. A wall-clock step or a suspend that the monotonic clock does not count changes it. While |drift| exceeds min(I / 2, 1 s), where 1 s is the default verifier clock tolerance, no key signs and attribution is unavailable with clock_drift. The bound is a safety threshold beyond which capture times are taken to map to the wrong epoch, not a measured bound on clock uncertainty. The pure-Go tagger stops at once; a kernel tagger stops at its next key refresh, at most one epoch later assuming that refresh runs as scheduled and removes the slot (a failed removal keeps disclosure of that key held back and is retried).
  • A drift that returns within the bound resumes signing by itself. A persistent drift, such as after a suspend, or an unready origin needs an executor restart with a ready clock, which starts a new chain. Nothing re-anchors a running chain.
  • Local epochs never decrease, so a disclosed key never regains signing authority whatever the wall clock does, and the executor never signs with the key of an epoch below one it has already signed with.

A verifier still applies §6 with its own clock tolerance; the executor’s contract only stops it from tagging while its own clocks disagree.