
Reject Malformed Chunked Trailers in Rust to Stop Request Smuggling
RUSTSEC-2026-0446 affects actix-http: its HTTP/1 chunked decoder accepts a bare line feed after the final chunk where strict parsing should reject the malformed request. In a connection-reuse or pipelining scenario, that permissiveness can make the backend consume a subsequent request’s headers as trailers and then parse its body as another request.
Upgrade to actix-http 3.20.2 or later, ensure the version actually selected by your application is patched, and test the real HTTP/1 boundary with malformed bytes. A proxy or Web Application Firewall (WAF) is not a substitute for fixing the backend parser: disagreement between their interpretations is the condition that makes request smuggling possible.
The vulnerability: permissive parsing after the final chunk
In HTTP/1 chunked transfer coding, a zero-size chunk ends the message body. A trailer section, if present, follows using HTTP line framing; the terminating empty line ends the trailers. The framing matters: accepting a bare line feed (LF, \n) where a carriage-return-plus-line-feed (CRLF, \r\n) is expected can change how a parser determines where one message ends and the next begins.
RUSTSEC-2026-0446 describes this specific defect in actix-http. Its decoder accepts a bare line feed after the final chunk as the start of a trailer instead of rejecting the malformed request. If a front-end proxy and the Actix backend parse the same reused, pipelined connection differently, bytes that one component treats as the next request can be consumed by the other as trailer data. That discrepancy can allow an attacker to bypass proxy or WAF access controls.
The advisory identifies the affected crate as actix-http, the alias as GHSA-2q7f-mf9f-5qhr, and the patched version as 3.20.2. Treat this as a parser-boundary vulnerability, not as an application-level validation problem: checking a parsed route or request body cannot restore framing bytes already consumed by the HTTP decoder.
The unsafe dependency pattern
An application may use actix-web and never mention actix-http in its own source code. That does not mean it is unaffected: actix-http may be selected transitively, and the version resolved in Cargo.lock is what matters.
A risky maintenance pattern is to leave dependency resolution unreviewed or to assume that updating the top-level framework necessarily selected the patched parser:
# Cargo.toml — does not by itself establish which actix-http is resolved
[dependencies]
actix-web = "4"
Cargo resolves a compatible dependency graph and records exact versions in Cargo.lock. An existing lockfile, an older framework constraint, or a different dependency path can leave a vulnerable actix-http version in the deployed binary. Conversely, a clean build may resolve a different version than the one tested locally if the application does not preserve and deploy its lockfile.
Production fix: upgrade, lock, and verify the resolved crate
First update the dependency graph, then inspect the result:
cargo update -p actix-http --precise 3.20.2
cargo tree -i actix-http
Commit the updated Cargo.lock for an application. Confirm that every resolved actix-http instance is 3.20.2 or later and that the production build uses that lockfile. If Cargo cannot select 3.20.2 because a parent dependency constrains it, update the parent dependency to a release that permits the patched version; do not try to work around the constraint by assuming an application-level middleware fix is equivalent.
Use CI checks to make the dependency state visible:
cargo tree -i actix-http
cargo audit
cargo test --locked
cargo audit is useful for surfacing advisory matches, but it does not replace checking the resolved dependency graph or updating the lockfile. For deployments that build in a container or release pipeline, run these checks against the same manifest, lockfile, target, and features used for the artifact.
If your service sits behind a proxy, also verify the proxy’s HTTP/1 parsing and connection-reuse behavior. That is defense in depth; the essential remediation for this advisory is using patched actix-http.
Why a proxy/backend parsing difference becomes exploitable
Request smuggling depends on inconsistent message boundaries. A front end may decide that a request ended at one byte offset, while a backend decides it ended elsewhere. On a persistent connection, bytes left over under one interpretation can be treated as a separate request under another.
For this advisory, the key condition is not merely “a malformed trailer exists.” It is the combination of:
- A chunked request whose final-chunk framing contains the bare-LF condition described by
RUSTSEC-2026-0446. - A decoder that accepts that malformed framing rather than rejecting the request.
- A connection that is reused or carries pipelined request bytes.
- A front end that does not reject the same stream at the same boundary.
This explains why a handler-level test that constructs an already-parsed request is insufficient. The relevant behavior occurs while decoding raw HTTP/1 bytes, before the application handler receives a request. Likewise, testing only that a normal request succeeds does not establish that malformed framing is rejected.
For related boundary-hardening practices, see Preventing HTTP Request Smuggling in Rust: Building Safer Proxy and Gateway Services and Preventing Unsafe HTTP Header Handling in Rust: Building Requests That Resist Injection and Smuggling. If your service also processes redirect responses, Preventing Unsafe HTTP Redirect Handling in Rust: Validating Locations, Preserving Method Semantics, and Avoiding Open Redirects covers a separate but related boundary between HTTP components.
Regression testing at the raw HTTP boundary
Build a regression test around a real HTTP/1 listener and send bytes over a TCP connection. The test should exercise the exact parser deployed by the service, not a hand-written model of how it should behave. Include a malformed chunked request whose final-chunk sequence uses the bare LF described in the advisory, followed by bytes shaped like another request on the same connection.
A safe expected result is that the malformed stream is rejected and is not delivered to application handlers as a valid request followed by an attacker-controlled second request. Assert the observable outcome at the boundary: for example, that the server closes or rejects the connection and that a handler recording received requests never observes the smuggled request. The precise response or connection-close behavior can vary by server configuration, so test the security invariant rather than depending on one particular error response.
Keep a paired control case with valid CRLF framing and a properly terminated trailer section. The valid request should be processed according to your service’s intended behavior. This helps ensure that a fix or parser upgrade rejects malformed framing without accidentally breaking valid chunked requests.
A useful test corpus has at least these cases:
- A valid chunked request ending with the required CRLF framing.
- A request with the advisory’s bare-LF-after-final-chunk condition and no following request.
- The same malformed condition followed by a second request on the same connection.
- A valid trailer followed by the terminating empty line, then a second request.
- A malformed trailer terminator followed by request-like bytes.
Do not paste a malformed byte sequence into a normal request builder and assume the test covers the issue: high-level HTTP clients typically encode valid framing or reject malformed input themselves. Use a raw TCP client so the test controls every byte, and run it against the actual server configuration used in production.
Differential verification and release checks
A practical verification workflow is to compare the vulnerable dependency against the patched one using the same raw-byte test harness. Run the corpus against the previously deployed version in an isolated environment, then against actix-http 3.20.2 or later. The goal is to confirm the security difference: the malformed input must not be interpreted as a valid request stream by the patched deployment. Do not expose a known-vulnerable service publicly for this comparison.
For a Rust application, use a locked build and retain the test output with the release evidence:
cargo tree -i actix-http
cargo test --locked
cargo clippy --all-targets --all-features -- -D warnings
cargo audit
cargo miri test is generally not the primary verification tool for this issue: it checks Rust code for certain classes of undefined behavior, whereas this defect concerns HTTP framing and parser interpretation. A raw-wire integration test and dependency verification are the relevant checks.
Also verify the deployed artifact, not just the source checkout. Record the lockfile used by CI, make production builds fail if the lockfile would change (--locked), and confirm the service image or release package contains the artifact built from that dependency graph. A green test against a patched local graph is not evidence that a separately built production image uses the same version.
Quantitative trade-offs
The security fix is a dependency upgrade, not a new per-request application-layer scan. The table distinguishes verifiable version and test facts from workload-dependent performance measurements; do not treat unknown latency or allocation costs as measured results.
| Approach | Dependency / test scope | Cost and security effect |
|---|---|---|
| Leave the resolved vulnerable version in place | actix-http version not verified or below 3.20.2 | No added application code; remains exposed to the advisory’s malformed-framing behavior |
| Upgrade and lock the patched parser | actix-http >= 3.20.2; verify with cargo tree -i actix-http | Parser fix is applied at the HTTP boundary; no extra per-request validation layer is required |
| Add only handler-level validation | Parsed requests, not raw framing bytes | Cannot reliably recover or validate bytes already consumed by the decoder |
| Add raw-wire regression tests | At least 1 malformed case, 1 pipelined follow-up case, and valid controls | Adds test and CI runtime; validates actual boundary behavior without adding production request-path work |
The advisory provides no benchmark figures for latency, allocations, or throughput. Measure those on your own representative workload if the upgrade changes your service’s performance, but do not delay remediation to establish a performance baseline for a parser vulnerability.
Production pitfalls and edge cases
Multiple resolved versions. cargo tree -i actix-http may reveal more than one dependency path. Check every occurrence in the graph; updating one direct dependency does not prove that all relevant resolutions are patched.
Lockfile drift. A lockfile update that is not committed, or a build that runs without --locked, can make CI and production use different dependency versions. Treat the lockfile as part of the release input.
Proxy assumptions. A proxy that rejects malformed input reduces exposure only if every route to the backend passes through it and its parsing behavior is consistent with the backend. Direct internal access, alternate listeners, and different proxy configurations can invalidate that assumption.
Connection reuse and pooling. Test with persistent HTTP/1 connections. A one-request-per-connection test can miss the conditions described by the advisory, because the dangerous discrepancy concerns bytes following the malformed message.
Test harness normalization. Libraries that generate requests may normalize line endings or disallow invalid framing. Send raw bytes and capture the server-side outcome to ensure the malformed sequence reaches the parser.
Protocol scope. The described issue concerns HTTP/1 chunked decoding. Do not infer from this advisory that every HTTP version or every Actix configuration is affected in the same way; verify which protocols and listeners your deployment actually enables.
Frequently Asked Questions (FAQ)
What version of actix-http fixes RUSTSEC-2026-0446?
The advisory lists actix-http 3.20.2 as the patched version, with versions at or above it fixed. Confirm the version selected by your application using cargo tree -i actix-http and keep the updated Cargo.lock in the deployed build.
How can a bare LF in chunked trailers cause HTTP request smuggling?
The vulnerable decoder accepts a bare line feed after the final chunk as the start of a trailer instead of rejecting the malformed request. On a reused or pipelined connection, that can cause the backend to consume bytes belonging to a following request as trailer data and parse later bytes at a different boundary from a proxy or WAF.
Is an Actix handler test enough to verify the fix?
No. The problem occurs during HTTP/1 decoding, before a handler receives a parsed request. Send crafted raw bytes over a TCP connection to the actual server and verify that the malformed stream is rejected and does not produce an unintended second handler invocation.