← Blog

Claude MCP skill HTTP request desynchronization in reverse proxy deployments — SA-SKL-DESYNC2

HTTP request desynchronization attacks exploit disagreements between how a reverse proxy and its backend parse request boundaries — specifically, how they handle requests that contain both Content-Length and Transfer-Encoding headers, or malformed Transfer-Encoding values. When the proxy and backend disagree about where one request ends and the next begins, an attacker can inject a prefix into the connection's read buffer that is prepended to the next legitimate user's request. SA-SKL-DESYNC2 covers four patterns specific to MCP skill deployments: Caddy-to-Node.js CL.TE splits, Nginx Transfer-Encoding whitespace confusion, keep-alive buffer poisoning, and HTTP/2 to HTTP/1.1 TE header bypass.

By SkillAudit  |  9 Nov 2026
SA-SKL-DESYNC2 findings at a glance
HIGHDESYNC2-001 — Caddy reverse proxy forwards HTTP/1.1 to backend; request with both Content-Length and Transfer-Encoding: chunked causes CL.TE split; body bytes beyond CL value poisoned as prefix of next user's request
HIGHDESYNC2-002 — Express behind Nginx without HTTP/2; Transfer-Encoding header with extra whitespace (Transfer-Encoding : chunked) is accepted by Nginx but rejected by Express http parser; frontend/backend read different bytes as the request body
HIGHDESYNC2-003 — proxy_pass to Node.js with keep-alive connection pooling; smuggled request bytes remain in socket buffer; prepended to next user's request on the reused connection; different-user data exposed
HIGHDESYNC2-004 — H2.TE desync: HTTP/2 frontend, HTTP/1.1 backend; HTTP/2 spec forbids Transfer-Encoding header but some proxies forward it raw to HTTP/1.1 backend; backend applies chunked parsing to a request the frontend parsed differently

DESYNC2-001 — Caddy HTTP/1.1 to backend CL.TE desync

Caddy processes incoming HTTP/1.1 connections and forwards them to a backend over a persistent HTTP/1.1 or HTTP/2 connection. When Caddy encounters a request with both Content-Length and Transfer-Encoding: chunked, its behavior and the backend's behavior may differ on which header takes precedence. RFC 9112 specifies that if both are present, Transfer-Encoding takes precedence and Content-Length must be ignored. If Caddy follows RFC 9112 but the Node.js backend has a configuration or version that reads Content-Length bytes first, the bytes beyond the Content-Length remain in the connection buffer. The next request received on that connection includes the leftover bytes as a prefix — effectively prefixing an attacker-controlled string to a legitimate user's request headers.

# VULNERABLE DESYNC2-001 — Caddy Caddyfile
# No normalization of conflicting Content-Length + Transfer-Encoding headers.
# Caddy forwards the ambiguous request to Node.js; CL/TE disagreement splits the body.

skillaudit.dev {
    reverse_proxy localhost:3000
    # VULNERABLE: no header_up directives to strip conflicting headers
    # An attacker can craft: Content-Length: 4 + Transfer-Encoding: chunked
    # with body: 4\r\nGET /\r\n0\r\n\r\n
    # Caddy reads full chunked body; Node.js reads 4 bytes; "GET /..." poisons buffer
}
# FIXED DESYNC2-001 — Normalize conflicting headers at Caddy layer
skillaudit.dev {
    reverse_proxy localhost:3000 {
        # Strip Transfer-Encoding before forwarding — forces CL-only parsing on backend
        header_up Transfer-Encoding ""

        # Set upstream connection timeout to prevent slow-read socket holding
        transport http {
            read_timeout 10s
            write_timeout 10s
            dial_timeout 5s
        }
    }

    # Reject requests presenting both headers simultaneously
    @desync_attempt {
        header Content-Length *
        header Transfer-Encoding *chunked*
    }
    respond @desync_attempt 400 {
        body "Bad Request"
        close
    }
}

DESYNC2-002 — Nginx Transfer-Encoding whitespace confusion

HTTP header field names are case-insensitive per RFC 9110, but header field names with extraneous whitespace (a space before the colon: Transfer-Encoding : chunked) are technically malformed. Nginx's parser tolerates this form in some versions and treats it as a valid Transfer-Encoding: chunked header. The Node.js HTTP parser is strict and rejects the malformed header, treating the request as having no Transfer-Encoding header. When Nginx reads chunked body bytes from the attacker's request and forwards them all to Node.js, but Node.js uses Content-Length to bound the body it reads, the excess bytes remain in the buffer for the next request on the shared connection. This technique was first documented in PortSwigger's HTTP desync research and is specific to Nginx + strict backend combinations.

# VULNERABLE DESYNC2-002 — Nginx proxy_pass without header sanitization
# nginx tolerates "Transfer-Encoding : chunked" (space before colon)
# Node.js http module rejects it; uses Content-Length instead
# Attacker crafts: Content-Length: 6 + "Transfer-Encoding : chunked"
# nginx reads full chunked body; Node.js reads 6 bytes; remainder poisons buffer

upstream skillaudit_backend {
    server 127.0.0.1:3000;
    keepalive 32;  # keep-alive amplifies the poisoning window
}

server {
    listen 443 ssl;
    location / {
        proxy_pass http://skillaudit_backend;
        # VULNERABLE: no proxy_set_header to normalize TE headers
    }
}
# FIXED DESYNC2-002 — Normalize Transfer-Encoding at Nginx layer
upstream skillaudit_backend {
    server 127.0.0.1:3000;
    keepalive 32;
}

server {
    listen 443 ssl http2;  # Also enable HTTP/2 — avoids most HTTP/1.1 smuggling

    location / {
        proxy_pass http://skillaudit_backend;

        # FIX: explicitly clear Transfer-Encoding before forwarding
        # Forces backend to use Content-Length only — consistent parsing
        proxy_set_header Transfer-Encoding "";

        # Also set timeouts to prevent slow-read connection holding
        proxy_read_timeout 10s;
        proxy_send_timeout 10s;

        # Reject requests with both Content-Length and Transfer-Encoding
        # (requires nginx_http_map_module or lua module for header inspection)
    }
}

DESYNC2-003 — proxy_pass keep-alive buffer poisoning across users

When a reverse proxy maintains a keep-alive connection pool to the backend, multiple sequential user requests travel over the same TCP connection. A successful CL.TE or TE.CL desync attack that leaves bytes in the connection's read buffer means that the next request handled on that connection — from a completely different user — will have those bytes prepended to it at the backend. The backend sees the smuggled prefix as the beginning of the second user's request. This can cause the second user's session cookie or Authorization header to be appended to what the backend interprets as a continuation of the attacker's request body, effectively exfiltrating the second user's credentials to the attacker's endpoint if the attacker's injected prefix pointed to an attacker-controlled URL.

# VULNERABLE DESYNC2-003 — keep-alive connection pooling amplifies smuggling
# Smuggled prefix persists in socket buffer; prepended to next user's request

upstream skillaudit_backend {
    server 127.0.0.1:3000;
    keepalive 64;      # large pool — more connections stay alive longer
    keepalive_timeout 60;
}

server {
    location /api/ {
        proxy_pass http://skillaudit_backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "";  # keep-alive to backend
        # VULNERABLE: no timeout or size limits that would close poisoned connections
    }
}
# FIXED DESYNC2-003 — Close connections on error; set aggressive timeouts
upstream skillaudit_backend {
    server 127.0.0.1:3000;
    keepalive 32;
    keepalive_timeout 15;  # Shorter keepalive window reduces poisoning exposure
}

server {
    location /api/ {
        proxy_pass http://skillaudit_backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        # FIX: short timeouts force connection closure before poisoned bytes matter
        proxy_read_timeout 10s;
        proxy_send_timeout 5s;
        proxy_connect_timeout 3s;

        # FIX: limit request body size — prevents large smuggled prefixes
        client_max_body_size 10m;

        # FIX: on upstream error, force connection closure rather than reuse
        proxy_next_upstream error timeout;
    }
}

DESYNC2-004 — H2.TE desync: HTTP/2 frontend to HTTP/1.1 backend

HTTP/2 explicitly forbids connection-specific headers including Transfer-Encoding. A well-behaved HTTP/2 proxy should strip the Transfer-Encoding header when downgrading requests from HTTP/2 to HTTP/1.1 for the backend. Some proxy configurations forward the TE header as-is to the backend. The backend, running HTTP/1.1, reads the Transfer-Encoding: chunked header and applies chunked body parsing to a request whose actual body bytes were framed by HTTP/2 DATA frames at the proxy layer. This creates a CL/TE or TE/TE discrepancy at the boundary, with the backend reading different bytes as the body than the proxy forwarded. The fix is to use HTTP/2 end-to-end (gRPC or h2c to backend) or to explicitly strip TE headers at the proxy before forwarding to HTTP/1.1 upstreams.

# VULNERABLE DESYNC2-004 — HTTP/2 frontend forwards TE header to HTTP/1.1 backend
# Backend sees Transfer-Encoding: chunked on a request that was HTTP/2 framed
# Causes body boundary disagreement on the downgrade leg

server {
    listen 443 ssl http2;

    location / {
        proxy_pass http://localhost:3000;         # HTTP/1.1 to backend
        proxy_http_version 1.1;
        # VULNERABLE: does not strip Transfer-Encoding before forwarding
        # An HTTP/2 request with TE: chunked header passes TE to backend
        # Backend applies chunked parsing to HTTP/2-framed body — mismatch
    }
}
# FIXED DESYNC2-004 — Strip TE header before downgrade; or use HTTP/2 end-to-end
server {
    listen 443 ssl http2;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;

        # FIX A: explicitly strip Transfer-Encoding before forwarding to HTTP/1.1 backend
        proxy_set_header Transfer-Encoding "";

        # FIX B (preferred for new deployments): use HTTP/2 or h2c end-to-end
        # proxy_pass http://localhost:3000;
        # proxy_http_version 2.0;  # keeps HTTP/2 all the way to backend — no TE issue

        # FIX C: reject any incoming request with TE header present on HTTP/2 connection
        # (nginx map module required)
    }
}

SkillAudit detection: SA-SKL-DESYNC2 inspects Caddyfile and nginx.conf files for missing header_up Transfer-Encoding "" / proxy_set_header Transfer-Encoding "" directives, keep-alive configurations without timeouts, and reverse proxy setups that mix HTTP/2 frontend with HTTP/1.1 backend without TE header stripping. Run a free audit at skillaudit.dev.

PatternCVSSImpactFix
DESYNC2-001 Caddy CL.TE split8.1 HighAttacker prefix injected into next user's requestheader_up Transfer-Encoding "" in Caddy; reject conflicting headers
DESYNC2-002 Nginx TE whitespace7.5 HighFrontend/backend body boundary disagreementproxy_set_header Transfer-Encoding "" in Nginx
DESYNC2-003 keep-alive buffer poison7.5 HighSecond user's credentials exposed to attackerShort proxy_read_timeout; close connection on upstream error
DESYNC2-004 H2.TE downgrade7.5 HighHTTP/2 TE header causes HTTP/1.1 backend misparseStrip TE at proxy; or use HTTP/2 end-to-end