Skip to main content

h2_last_byte_sync_frames

Function h2_last_byte_sync_frames 

Source
pub fn h2_last_byte_sync_frames(
    stream_ids: &[u32],
    final_bytes: &[u8],
) -> Option<Vec<u8>>
Expand description

Build the N partial-bodies for the HTTP/2 last-byte-sync attack.

Per Kettle 2023:

  1. Open one HTTP/2 connection.
  2. For each of the N target streams, send the request frames + ALL body bytes EXCEPT the last byte. The server now has N stalled streams.
  3. Send one packet containing the final-byte DATA frame for every stream. The kernel delivers all N final bytes in the same epoch.

This function builds STEP 3’s payload: n final-byte DATA frames, each one byte of payload, all in the same buffer.

stream_ids is the list of stream IDs the operator pre-allocated in step 2. final_bytes is one byte per stream — the byte that completes each request body.

Returns None if stream_ids.len() != final_bytes.len() or if any stream id is even (per RFC 7540 §5.1.1 client streams must be odd).