Summary
Ruby's WEBrick HTTP server up to version 1.9.2 reparses the Content-Length value found in HTTP trailers into the canonical request state.
When deployed behind or alongside other HTTP components that interpret message boundaries differently, this mismatch can enable HTTP request smuggling and desynchronization attacks.
Affected context
This vulnerability appears in Ruby applications that use WEBrick (through v1.9.2) as an HTTP server, especially when WEBrick is part of a multi-hop architecture with reverse proxies, load balancers, API gateways, or TLS terminators in front of it.
The issue arises when upstream components and WEBrick disagree on which Content-Length value defines the request body, particularly when trailers are allowed or not fully normalized.
The risk is higher in deployments that accept HTTP/1.1 requests with chunked transfer-encoding or non-standard use of trailers.
Exploit preconditions
- Attack surface: The HTTP endpoint exposed by WEBrick, often via public-facing web applications or APIs.
- Required access: Ability to send crafted HTTP requests to a WEBrick-backed service (typically unauthenticated network access to the HTTP port).
- Trigger point: Submission of a specially crafted HTTP/1.1 request that uses
Content-Lengthin both headers and trailers (or interacts with trailer parsing) to cause WEBrick and any upstream component to disagree on request boundaries. - Why exploitation is possible: WEBrick reparses trailer
Content-Lengthinto its canonical request state, while other HTTP intermediaries may rely only on the initial headers or handle trailers differently. This parsing discrepancy allows an attacker to smuggle additional HTTP requests that are interpreted inconsistently across components.
Why this happens
The root cause is inconsistent handling of HTTP message delimitation, mapping to CWE-444: Inconsistent Interpretation of Input.
WEBrick processes Content-Length values found in HTTP trailers and promotes them to the canonical request metadata, treating them as authoritative for body length.
Other components (such as proxies) often make routing and buffering decisions solely based on header Content-Length or transfer-encoding without re-evaluating trailers.
This divergence creates a desynchronization window where a single physical TCP stream is interpreted as different logical request sequences by different participants in the request path.
Potential impact
- Request smuggling that can cause one logical request to be split or merged across multiple backend requests.
- Bypassing security controls implemented at the proxy or gateway layer, such as authentication, rate limiting, or WAF rules.
- Poisoning of HTTP request queues, causing victim users' requests to inherit attacker-controlled headers or bodies.
- Exposure of sensitive data if responses intended for one client are misrouted to another due to request desynchronization.
- Potential cache poisoning or cache deception attacks where shared caches store attacker-shaped responses under victim-visible keys.
General mitigation guidance
Effective mitigation focuses on eliminating ambiguous request parsing and enforcing consistent HTTP message framing across the stack.
Common defensive patterns include:
- Normalizing HTTP request handling so that only one authoritative source of
Content-Lengthis used, ignoring or strictly validating conflicting information in trailers. - Disallowing or tightly constraining the use of HTTP trailers for incoming requests, especially in public-facing endpoints.
- Enforcing strict HTTP parsing rules that reject requests with conflicting
Content-Lengthor suspicious transfer-encoding combinations. - Aligning parsing behavior between WEBrick and fronting components (reverse proxies, load balancers) through harmonized configuration and policy.
- Applying least-privilege principles at the HTTP layer by isolating administrative or sensitive endpoints from potentially smuggled traffic.
How teams detect issues like this
Detection usually combines code-level review and traffic analysis:
- Static analysis and manual review for HTTP server code paths that reinterpret or overwrite canonical request metadata based on trailers or duplicate
Content-Lengthfields. - Configuration review of reverse proxies and gateways to identify mismatches in HTTP parsing rules versus WEBrick's behavior, focusing on transfer-encoding and trailer processing.
- Network-level monitoring for anomalous HTTP patterns (e.g., multiple
Content-Lengthindicators, unusual use of trailers, or inconsistent body sizes). - Security testing using automated HTTP desynchronization and smuggling test suites to probe for divergent interpretations between components.

