Skip to content

Cap TLS record length to RFC 8446 limit in ClientHello peeking#12638

Merged
traefiker merged 3 commits intotraefik:v2.11from
mmatur:fix/rfc8446
Feb 11, 2026
Merged

Cap TLS record length to RFC 8446 limit in ClientHello peeking#12638
traefiker merged 3 commits intotraefik:v2.11from
mmatur:fix/rfc8446

Conversation

@mmatur
Copy link
Member

@mmatur mmatur commented Feb 9, 2026

What does this PR do?

  • Validate recLen against the RFC 8446 Section 5.1 maximum (16,384 bytes) before allocating the bufio.Reader in clientHelloInfo
  • Reject TLS records advertising a payload length exceeding this limit, preventing oversized per-connection buffer allocations

Motivation

A malicious client can send a crafted TLS record header with an inflated length field (up to 0xFFFF) and then stall, forcing Traefik to allocate an oversized buffer (~65 KiB instead of ~4 KiB) per connection. With enough concurrent connections against a memory-constrained instance, this can cause
resource strain. Capping at the RFC-mandated bound eliminates this amplification vector.

More

  • Added/updated tests
  • [ ] Added/updated documentation

Additional Notes

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@rtribotte rtribotte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@traefiker traefiker merged commit 72e2454 into traefik:v2.11 Feb 11, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants