dissector: stop reporting ciphertext bytes as verb on encrypted frames
The dissector tested only the pre-1.0.3 0x80 "encrypted" bit, which a modern AES-GCM packet never sets — the cipher suite lives in flags bits 3-5 (Packet.hpp:1319). Every AES-GCM frame therefore had byte 27 shown as zt.verb, so a PQ capture produced a histogram of garbage (values up to 254) that looked like protocol traffic and none of it was. Cipher suite is now read from bits 3-5, zt.verb is only added on unencrypted frames, and encrypted frames are labelled as such. This also invalidates a claim in both docs: VERB_PQ_KEYS is armored with encryptPayload=true (Peer.cpp:628), so its verb was never actually readable. The earlier "zt.verb == 23 matches 1" result was ciphertext that happened to equal 23. PQ_KEYS must be identified by size and fragmentation (4257 B, ~13 fragments at 1480 B), which is what §7 now says. Verified on a live hybrid capture: verb histogram collapses to the single real value 1, all 127 frames still match zt, the capability bit and fragment headers still parse. Adds docs §6.3 covering the data-channel question: the session key cannot be read from the wire, but pqcHybridActive reports Peer::hybridSessionKeyInstalled(), which does assert the installed key. Confirmed true on both hosts.
This commit is contained in:
1 parent
bb1e5c20f1
commit
727e31b33d
3 files changed
+78
-16
No files matched your search
@@ -377,14 +377,16 @@ would produce a *different observable*:
|
||||
|---|---|---|---|
|
||||
| HELLO size / fragment count | 137 B / 1 | 137 B / 1 — **unchanged** | no — HELLO carries the classic projection only |
|
||||
| HELLO capability bit | 0 | 1 | yes |
|
||||
| `VERB_PQ_KEYS` frames on wire | none | present, carrying the 1088 B ct | yes |
|
||||
| `VERB_PQ_KEYS` exchange on wire | none | ~13 fragments of one 4257 B packet | yes — but **encrypted**: match on size/fragmentation, not `zt.verb` |
|
||||
| Identity type byte | 0 | 1 | yes |
|
||||
| COM type byte | 1 | 2 | yes |
|
||||
| `_key` value | n/a off-wire | n/a off-wire | **no** — must be inferred from the above |
|
||||
| Session key actually installed | `false` | `true` (`pqcHybridActive`) | yes — the only data-channel assertion |
|
||||
|
||||
Nothing about the negotiated symmetric key is directly observable. A test that
|
||||
only does "ping works" passes trivially under M2 (classical fallback) and must not
|
||||
be counted.
|
||||
The session key is not readable from the wire — data frames are armored, so no
|
||||
filter can reveal it. But its *installation* is directly observable via
|
||||
`pqcHybridActive` (`Peer::hybridSessionKeyInstalled()`), which is a real
|
||||
data-channel assertion. A test that only does "ping works" still passes trivially
|
||||
under M2 (classical fallback) and must not be counted.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -295,6 +295,47 @@ for p in json.load(sys.stdin):
|
||||
> The *identity file* is 6415 B because it holds the full type-1 record
|
||||
> (ML-KEM-768 + ML-DSA-65 public keys); the *HELLO packet* is not.
|
||||
|
||||
### 6.3 Data-channel gate — proving the *data* key is PQ-derived
|
||||
|
||||
§6.2 proves the handshake advertises and exchanges PQ material. It does **not**
|
||||
prove the session key protecting your frames came from it. Those are different
|
||||
claims, and the gap matters: `pqcHybridActive` is the closest thing to a direct
|
||||
answer, but read what it actually reports.
|
||||
|
||||
```sh
|
||||
A=$(sudo -n cat /var/lib/backone/authtoken.secret)
|
||||
curl -s -m 8 -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/peer | python3 -c "
|
||||
import json,sys
|
||||
for p in json.load(sys.stdin):
|
||||
if p.get('role') != 'PLANET':
|
||||
print(p['address'], 'capable=', p.get('pqcCapable'), 'hybrid=', p.get('pqcHybridActive'))"
|
||||
```
|
||||
|
||||
| Field | What it actually means |
|
||||
|---|---|
|
||||
| `pqcCapable` | Peer set the capability bit. Advertised support only. |
|
||||
| `pqcHybridActive` | `Peer::hybridSessionKeyInstalled()` — the derived key is **installed into `_key`**, the buffer every data frame is armored with. |
|
||||
|
||||
`pqcHybridActive: true` is a genuine assertion about the data channel, and it is
|
||||
deliberately stricter than "eligible": the code comment at `node/Peer.hpp:710`
|
||||
says eligibility "is true a full round trip before the key exists, so reporting
|
||||
it as 'hybrid active' claims protection that is not in use."
|
||||
|
||||
**Why tcpdump/tshark cannot answer this directly.** Data frames are armored with
|
||||
the session key (`Peer.cpp:645`), so the payload — and the verb byte — is
|
||||
ciphertext. No filter can distinguish a PQ-derived key from a classical one,
|
||||
because that property is not visible in the output of a cipher. Any "the data
|
||||
frames look post-quantum" check is vacuous.
|
||||
|
||||
**The one wire artifact that does bear on it.** `Peer::pqConfirmTag`
|
||||
(`node/Peer.hpp:67`) is `HMAC-SHA384(installed session key, min(addr) ‖
|
||||
max(addr))` truncated to `ZT_PQ_KEYS_CONFIRM_LEN` = 4 bytes, appended **last**
|
||||
in `VERB_PQ_KEYS` so its position is unambiguous. Recomputing it offline under a
|
||||
candidate key and comparing proves which key both peers derived — but it is a
|
||||
verifier requiring the session key, not a passive observation, so it must be
|
||||
run on one of the hosts. Treat it as a lab tool for the key-confirmation path
|
||||
(`IncomingPacket.cpp:1613`), not as a routine capture check.
|
||||
|
||||
---
|
||||
|
||||
## 7. Capture and dissection
|
||||
@@ -322,24 +363,31 @@ tshark -X lua_script:tools/zt-dissector.lua -r /tmp/pq.pcap \
|
||||
| Filter | Shows |
|
||||
|---|---|
|
||||
| `zt` | any BackOne frame |
|
||||
| `zt.verb` | **only on unencrypted frames** — absent on encrypted ones |
|
||||
| `zt.verb == 1` | HELLO only (`Packet.hpp:617`) |
|
||||
| `zt.hello.cap` | capability bit — `0` classical, `1` hybrid |
|
||||
| `zt.hello.idtype` | identity type **in HELLO** — `0` even in hybrid (classic projection only) |
|
||||
| `zt.hello.idsize` | serialized classic identity size (39 B) |
|
||||
| `zt.flags` | cipher suite in bits 3-5; `0x80` is the pre-1.0.3 legacy bit |
|
||||
| `zt.frag` / `zt.fragno` / `zt.fragtot` | fragment header — only for large frames |
|
||||
| `zt.verb == 23` | `VERB_PQ_KEYS` (`0x17`), carries the PQ keys + 1088 B ML-KEM ct |
|
||||
|
||||
**Verified live 2026-10-07** on a hybrid↔hybrid link:
|
||||
|
||||
```
|
||||
ZT HELLO type=0 DBFA939D58 cap=1 # 185 B, single fragment
|
||||
ZT ... Len=1432 # VERB_PQ_KEYS, well over one MTU
|
||||
ZT HELLO type=0 DBFA939D58 cap=1 185 B # unencrypted, cap bit set
|
||||
ZT ... Len=1480 flags=0x58 # PQ_KEYS fragments, cipher 3 (AES-GCM)
|
||||
```
|
||||
|
||||
Expect `cap=1` on HELLO **and** at least one `VERB_PQ_KEYS` frame. The
|
||||
capability bit alone proves only that the peer *advertises* support; the
|
||||
`VERB_PQ_KEYS` frame is what actually carries the material, and a missing one is
|
||||
the signature of bug B7.
|
||||
> **`VERB_PQ_KEYS` is encrypted and its verb is NOT visible.** It is armored
|
||||
> with the *classical* key and `encryptPayload=true` (`Peer.cpp:628`), so byte 27
|
||||
> is ciphertext like any other data packet — that is what lets the peer read it
|
||||
> before it has switched to the hybrid session key. A 4257 B PQ_KEYS arrives as
|
||||
> ~13 fragments at 1480 B each; identify it by **size and fragmentation**, not by
|
||||
> `zt.verb`. The capture above shows 13 such frames.
|
||||
>
|
||||
> The capability bit proves only that the peer *advertises* support. That the
|
||||
> PQ exchange actually happened is a **state** question, answered in §6.3 —
|
||||
> not something a dissector can show.
|
||||
|
||||
**Run tshark as your normal user, not root.** As superuser, Wireshark silently
|
||||
skips user Lua scripts and the dissector appears to be broken. If the pcap lives
|
||||
|
||||
+16
-4
@@ -10,6 +10,10 @@ local IDENTITY_SIZE_CLASSIC = 39 -- 5 addr + 1 type + 32 pub + 1 privlen
|
||||
local IDENTITY_SIZE_PQ = 3175 -- classic + 1184 ML-KEM-768 pk + 1952 ML-DSA-65 pk
|
||||
local HELLO_IDENTITY_OFF = 13 -- payload + (pv1+maj1+min1+rev2+timestamp8)
|
||||
|
||||
local CIPHER_NONE = 0 -- C25519_POLY1305_NONE, payload left in the clear
|
||||
local CIPHER_SALSA20 = 1 -- C25519_POLY1305_SALSA2012
|
||||
local CIPHER_AES_GCM = 3 -- AES_GMAC_SIV
|
||||
|
||||
local f = {
|
||||
iv = ProtoField.bytes("zt.iv", "Packet ID / IV"),
|
||||
dest = ProtoField.string("zt.dest", "Destination"),
|
||||
@@ -83,14 +87,22 @@ function zt.dissector(buf, pinfo, tree)
|
||||
|
||||
if buf:len() < 28 then return end
|
||||
|
||||
local verb = buf(27, 1):uint()
|
||||
local encrypted = bit.band(buf(18, 1):uint(), 0x80) ~= 0
|
||||
local t = tree:add(zt, buf(), "BackOne, verb " .. verb)
|
||||
-- Cipher suite lives in flags bits 3-5 (FFCCCHHH, Packet.hpp:1319). Suite 0
|
||||
-- (C25519_POLY1305_NONE) leaves the payload in the clear; suites 1 and 3
|
||||
-- encrypt from ZT_PACKET_IDX_VERB (27) onward, so byte 27 is ciphertext and
|
||||
-- must not be presented as a verb. Checking only the pre-1.0.3 0x80 bit
|
||||
-- misreads every AES-GCM frame, which is what a PQ link uses.
|
||||
local cipher = bit.band(bit.rshift(buf(18, 1):uint(), 3), 0x07)
|
||||
local encrypted = (cipher ~= CIPHER_NONE) and (cipher == CIPHER_SALSA20 or cipher == CIPHER_AES_GCM)
|
||||
local verb = encrypted and 0 or buf(27, 1):uint()
|
||||
local t = tree:add(zt, buf(), encrypted and "BackOne, encrypted" or ("BackOne, verb " .. verb))
|
||||
t:add(f.iv, buf(0, 8))
|
||||
t:add(f.dest, addr(buf, 8))
|
||||
t:add(f.src, addr(buf, 13))
|
||||
t:add(f.flags, buf(18, 1))
|
||||
t:add(f.verb, buf(27, 1))
|
||||
if not encrypted then
|
||||
t:add(f.verb, buf(27, 1))
|
||||
end
|
||||
|
||||
-- Head of a fragmented packet still carries the original header, so the
|
||||
-- verb and the leading payload bytes are parseable.
|
||||
|
||||
Reference in new issue
Block a user