Repository navigation
Description
Missing fixed-bit discard before pre-routing
Summary
RFC 9000 requires any non-Version-Negotiation packet with 0x40 == 0 to be discarded. quiche does not check this in its public header parser, so a fixed-bit-zero packet can still be parsed as Initial and drive Retry or Version Negotiation in pre-routing code. The core conn.recv() path later drops protected packets because AEAD authentication fails, so the bug is real but scoped: it is an early-parse / pre-routing compliance issue, not full end-to-end acceptance of the packet.
Standard Requirement
RFC 9000 Section 17.2:
Fixed Bit: The next bit (0x40) of byte 0 is set to 1, unless the
packet is a Version Negotiation packet. Packets containing a zero
value for this bit are not valid packets in this version and MUST
be discarded.
RFC 9000 Section 17.3:
Fixed Bit: The next bit (0x40) of byte 0 is set to 1. Packets
containing a zero value for this bit are not valid packets in this
version and MUST be discarded.
RFC 9001 Section 5.4 says header protection covers only the low 4 bits of a long header and the low 5 bits of a short header, so the fixed bit is not header-protected. RFC 9001 Section 5.3 says the QUIC header is AEAD associated data, which explains why changing the fixed bit can later produce CryptoFail, but that is not a substitute for the RFC 9000 discard rule.
Relevant Source Code
quiche/src/packet.rs:355-402 parses the public header without checking first & 0x40:
let first = b.get_u8()?;
if !Header::is_long(first) {
let dcid = b.get_bytes(dcid_len)?;
return Ok(Header { ty: Type::Short, ... });
}
let version = b.get_u32()?;
let ty = if version == 0 {
Type::VersionNegotiation
} else {
match (first & TYPE_MASK) >> 4 {
0x00 => Type::Initial,
0x01 => Type::ZeroRTT,
0x02 => Type::Handshake,
0x03 => Type::Retry,
_ => return Err(Error::InvalidPacket),
}
};apps/src/bin/quiche-server.rs:245-323 uses that unchecked header to route new packets:
let hdr = match quiche::Header::from_slice(pkt_buf, quiche::MAX_CONN_ID_LEN) {
Ok(v) => v,
Err(e) => { ... }
};
if hdr.ty != quiche::Type::Initial {
continue 'read;
}
if !quiche::version_is_supported(hdr.version) {
let len = quiche::negotiate_version(&hdr.scid, &hdr.dcid, &mut out).unwrap();
continue 'read;
}
if token.is_empty() {
let len = quiche::retry(&hdr.scid, &hdr.dcid, &scid, &new_token, hdr.version, &mut out).unwrap();
continue 'read;
}quiche/src/packet.rs:654-670 later authenticates the whole header as AEAD associated data:
let (header, mut payload) = b.split_at(payload_offset)?;
let payload_len =
aead.open_with_u64_counter(pn, header.as_ref(), ciphertext.as_mut())?;Runtime Evidence
Probe source: recheck_runtime/fixed_bit_receive_recheck/src/main.rs
Command run from recheck_runtime/fixed_bit_receive_recheck:
$env:CARGO_TARGET_DIR='..\..\..\..\..\..\..\implementions\quiche\target'; cargo run --quietOutput saved in recheck_runtime/fixed_bit_receive_recheck/run.log:
case=v1_initial_fixed_zero_pre_route first_before=0xc2 first_after=0x82 parse_ty=Initial parse_version=1 token_len=0 action=retry out_len=78
case=unsupported_initial_fixed_zero_pre_route first_before=0xce first_after=0x8e parse_ty=Initial parse_version=0x0a0a0a0a version_supported=false action=version_negotiation out_len=43
case=fresh_server_conn_recv_v1_initial_fixed_zero first_before=0xca first_after=0x8a recv_res=Err(CryptoFail) server_closed=true recv_delta=0 send_after=Err(Done)
case=established_server_conn_recv_short_fixed_zero first_before=0x41 first_after=0x01 is_short=true recv_res=Ok(49) server_closed=false recv_delta=0 send_after=Err(Done)
What this proves:
- A QUIC v1
Initialwithfixed bit = 0is still parsed asInitialand can triggerRetry. - An unsupported-version
Initialwithfixed bit = 0is still parsed asInitialand can triggerVersion Negotiation. - On a fresh server connection,
conn.recv()does not accept the packet; it fails later withCryptoFail. - On an established short-header path,
conn.recv()consumes the datagram butrecv_delta=0andsend_after=Err(Done), so the packet is effectively ignored rather than processed.
Conclusion
The issue is real because the implementation does not discard fixed-bit-zero packets before public header parsing and pre-routing. That violates RFC 9000 for non-VN packets and allows incorrect Retry / Version Negotiation behavior. The later AEAD failure in conn.recv() reduces the scope, but it does not remove the compliance gap.
Fix Direction
Add an explicit fixed-bit check before returning Header for any non-VN packet:
- Short header: reject when
(first & 0x40) == 0. - Long header: if
version != 0, reject when(first & 0x40) == 0. - Keep Version Negotiation as the only exception.
Activity
ghedo commentedon Nov 25, 2026
Closing as a duplicate of #2557, which covers the same missing fixed-bit check. The fix proposed in #2574 adds the check to
Header::from_bytes(), so it also coversHeader::from_slice()and pre-routing.