Skip to content

h2: HPACK encoder emits only the last table-size update, not the minimum (RFC 7541 §4.2) #1622

Description

@FlorentinDUBOIS

Found by the security review of #1620. The behaviour predates that PR: #1620 only swaps the integer encoder it calls.

Problem

The HPACK encoder keeps a single pending table-size update (pending_table_size_update, lib/src/protocol/mux/h2.rs and converter.rs). If the peer sends two SETTINGS_HEADER_TABLE_SIZE changes before sozu writes its next header block, for example 0 then 4096, only the last value (4096) is encoded as a dynamic-table-size update.

RFC 7541 §4.2 requires the encoder to signal the smallest value reached and the final value. The smallest value is what decides which entries the encoder evicted. After the 0, sozu's encoder table is empty. The peer's decoder only sees 4096, so it evicts nothing. The two tables diverge silently: a low index then resolves to the wrong header on the peer, and no error is raised.

Reachability (to verify)

This requires two table-size SETTINGS inside the window between two header blocks written by sozu, on a frontend or a backend H2 connection. It has not been reproduced empirically.

Suggested fix

Track the minimum pending size alongside the latest one, and emit up to two size updates at the start of the next block: the minimum, then the final value when it differs. Add a test that exchanges SETTINGS 0 then 4096 between blocks and checks, with a decoder, that both tables stay identical.

Activity

  1. added a commit that references this issue on Sep 27, 2026
    58550dd
  2. added a commit that references this issue on Sep 27, 2026
    0155d40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions