← Blog

Claude MCP skill HTTP request smuggling via reverse proxy desync — SA-SKL-DESYNC1

HTTP request smuggling exploits the gap between how a reverse proxy and its upstream backend parse request boundaries. When the proxy and backend disagree about where one request ends and the next begins, an attacker can smuggle a prefix of their choosing into the socket buffer — where it is prepended to the next legitimate user's request, potentially overwriting their request method, URL, or headers. MCP skills deployed behind Caddy, nginx, or a CDN edge layer are exposed to four distinct desync mechanisms: Content-Length vs Transfer-Encoding disagreement, unlimited body size enabling chunked extension abuse, slow-read socket contamination on keep-alive connections, and HTTP/2 CONTINUATION frame reassembly errors during h2-to-h1 downgrade.

By SkillAudit  |  8 Nov 2026

Request smuggling mechanics in MCP skill proxy deployments

A reverse proxy and its upstream backend maintain a shared TCP connection (or pool of connections) for performance. Each HTTP/1.1 request on a persistent connection is delimited by either a Content-Length header declaring the exact byte count of the body, or a Transfer-Encoding: chunked header declaring that the body is split into length-prefixed chunks terminated by a zero-length chunk. RFC 7230 specifies that if both headers are present, Transfer-Encoding takes precedence and Content-Length must be ignored. Not all implementations follow this rule identically, and the resulting ambiguity is the root cause of CL.TE and TE.CL smuggling attacks.

In an MCP skill deployment, the practical risk is that an attacker can inject a fake HTTP request start line into the socket buffer that is then prepended to a legitimate user's subsequent request. This can be used to hijack the user's request to an attacker-controlled URL, to inject arbitrary headers including Authorization or Cookie overrides, or to poison the reverse proxy's routing cache. The four SA-SKL-DESYNC1 patterns cover the most common configurations seen in MCP skill repositories.

SA-SKL-DESYNC1 findings at a glance
HIGHDESYNC1-001 — Caddy + Node.js upstream: request with both Content-Length and Transfer-Encoding: chunked causes CL.TE desync; body prefix injected as the start of the next user's request at the Node.js layer
HIGHDESYNC1-002 — nginx proxy_pass with client_max_body_size 0 (unlimited); no body size enforcement at proxy; chunked extension abuse allows nginx to forward more bytes than Content-Length specifies
MEDIUMDESYNC1-003 — HTTP/1.1 keep-alive connection with slow-read attack; leftover partial request bytes in socket buffer prepended to next connection's read; fix: upstream timeout + close connection on read error
HIGHDESYNC1-004 — HTTP/2 to HTTP/1.1 downgrade: h2 request with headers split across CONTINUATION frames reassembled incorrectly by proxy into two separate h1 requests; second fragment treated as new attacker-controlled request

DESYNC1-001 — Caddy + Node.js CL.TE desync via conflicting length headers

Caddy processes incoming HTTP/1.1 requests and forwards them to the Node.js upstream. When a request arrives with both Content-Length: 6 and Transfer-Encoding: chunked, Caddy follows RFC 7230 and uses the Transfer-Encoding value to determine the request boundary — reading the chunked body until the zero-length terminator. The Node.js http module, by default in some configurations and older versions, reads Content-Length bytes and considers the request complete after those 6 bytes. Any bytes beyond the first 6 — the attacker's injected content — remain in the connection's read buffer and are prefixed to the next request that arrives on the same persistent connection.

The fix has two parts: normalize conflicting headers at the proxy layer (Caddy can strip Transfer-Encoding when Content-Length is also present, forcing consistent chunked or length-delimited parsing), and configure the backend to reject any request that presents both headers simultaneously.

# VULNERABLE Caddyfile — no normalization of conflicting length headers
# A request with both Content-Length and Transfer-Encoding: chunked
# is forwarded as-is; Caddy and Node.js may parse it differently

skillaudit.dev {
    reverse_proxy localhost:3000
    # VULNERABLE: no header normalization before forwarding
    # An attacker can send: Content-Length: 6 + Transfer-Encoding: chunked
    # Caddy reads chunked body; Node.js reads 6 bytes; remainder poisons socket
}
# FIXED Caddyfile — normalize conflicting headers at proxy layer
skillaudit.dev {
    reverse_proxy localhost:3000 {
        # When both Content-Length and Transfer-Encoding are present, strip Transfer-Encoding
        # This forces both proxy and backend to use Content-Length — consistent parsing
        header_up Transfer-Encoding ""

        # Alternatively, strip Content-Length when Transfer-Encoding is present:
        # Uncomment ONE of these blocks (not both):
        # header_up Content-Length ""
    }

    # Reject requests with both headers before they reach reverse_proxy
    @conflicting_length {
        header Content-Length *
        header Transfer-Encoding *chunked*
    }
    respond @conflicting_length 400 {
        body "Bad Request: conflicting Content-Length and Transfer-Encoding"
        close
    }
}
// Node.js backend — explicit rejection of requests with both length headers
import http from 'http';

const server = http.createServer((req, res) => {
  const hasContentLength   = req.headers['content-length'] !== undefined;
  const hasTransferEncoding = req.headers['transfer-encoding'] !== undefined;

  // Reject ambiguous requests — should have been normalized by Caddy but defense in depth
  if (hasContentLength && hasTransferEncoding) {
    res.writeHead(400, { 'Content-Type': 'application/json', 'Connection': 'close' });
    res.end(JSON.stringify({ error: 'Ambiguous Content-Length and Transfer-Encoding' }));
    return;
  }

  // Normal request handling...
  app(req, res);
});

server.listen(3000);

DESYNC1-002 — nginx unlimited body size enables chunked extension abuse

nginx's client_max_body_size directive, when set to 0 (unlimited), disables body size enforcement at the proxy. This is sometimes done for MCP skill endpoints that accept large file uploads. Without a size limit, an attacker can craft a chunked request with a chunk size extension that causes nginx to forward more bytes than the total body the backend expects. The discrepancy causes the extra bytes to be left in the backend's socket buffer, where they prefix the next request routed over the same persistent connection. Setting an explicit client_max_body_size limit prevents this by bounding the total body size nginx will accept and forward.

# VULNERABLE nginx config — unlimited body size; chunked extension abuse possible
server {
    listen 443 ssl;
    server_name api.skillaudit.dev;

    location /api/ {
        # VULNERABLE: client_max_body_size 0 disables body size enforcement
        # Combined with chunked extension abuse, allows forwarding more bytes than expected
        client_max_body_size 0;
        proxy_pass http://node_backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }
}
# FIXED nginx config — explicit body size limits; chunked normalization
server {
    listen 443 ssl;
    server_name api.skillaudit.dev;

    # Default body size limit: 10MB for all locations
    client_max_body_size 10m;

    location /api/ {
        # Explicit limit per route — only upload endpoints get a larger limit
        proxy_pass http://node_backend;
        proxy_http_version 1.1;

        # Disable keep-alive to backend (use connection pool instead, managed by nginx)
        proxy_set_header Connection "";

        # Validate Content-Length vs actual body size before forwarding
        # nginx does this automatically when client_max_body_size is set
    }

    # Upload endpoint — larger limit, still bounded
    location /api/upload {
        client_max_body_size 50m; # explicit, not unlimited
        proxy_pass http://node_backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        # Strip chunked Transfer-Encoding extensions (nginx does not forward extensions
        # but set this explicitly for clarity)
        proxy_request_buffering on;
    }
}

DESYNC1-003 — Keep-alive slow-read leaves socket buffer contaminated

HTTP/1.1 persistent (keep-alive) connections allow the proxy to reuse a backend socket for multiple consecutive requests. If a client opens a connection and reads the response slowly — deliberately, in a slow-read attack — the server keeps the connection open and continues to process incoming data. When the client sends a partial request body and then stops sending (without closing the connection), some of those bytes remain in the kernel socket buffer. If the connection is reused for the next request from a different user (the proxy's connection pool behavior), the new user's request reads those leftover bytes as a prefix to their response — either corrupting the response or, in the worst case, returning another user's data.

The correct configuration combines an aggressive upstream read timeout that closes the connection if no data arrives within N seconds, and explicit close-on-error semantics in the backend so that any read error on a persistent connection causes the socket to be discarded rather than returned to the pool.

# VULNERABLE nginx config — no upstream read timeout; slow-read socket contamination possible
server {
    listen 443 ssl;
    server_name api.skillaudit.dev;

    location /api/ {
        proxy_pass http://node_backend;
        proxy_http_version 1.1;
        # VULNERABLE: no proxy_read_timeout; server waits indefinitely for client to send body
        # Partial body bytes persist in socket buffer; socket may be reused for next user
        proxy_set_header Connection "keep-alive";
    }
}
# FIXED nginx config — explicit timeouts; connection closed on read error
server {
    listen 443 ssl;
    server_name api.skillaudit.dev;

    location /api/ {
        proxy_pass http://node_backend;
        proxy_http_version 1.1;

        # Close backend connection after each request rather than pooling
        # (trade some performance for socket isolation between users)
        proxy_set_header Connection "close";

        # Read timeout: close connection if no data from upstream in 30 seconds
        proxy_read_timeout 30s;

        # Send timeout: close connection if no data sent to upstream in 30 seconds
        proxy_send_timeout 30s;

        # Connect timeout: fail fast if backend is unresponsive
        proxy_connect_timeout 5s;

        # If upstream returns 5xx, do not reuse that socket
        proxy_next_upstream error timeout http_500 http_502 http_503;
    }
}
// Node.js backend — close connections on any read error; set socket timeout
import http from 'http';

const server = http.createServer((req, res) => {
  // Close the underlying socket on any error rather than letting it sit in the pool
  req.socket.on('error', (err) => {
    logger.warn('Socket read error — closing connection', { err: err.message });
    req.socket.destroy();
  });

  app(req, res);
});

// Server-level keep-alive and header timeout
server.keepAliveTimeout = 30000;  // 30 seconds
server.headersTimeout   = 35000;  // slightly longer than keepAliveTimeout
server.requestTimeout   = 60000;  // 60 seconds for the full request
server.listen(3000);

DESYNC1-004 — HTTP/2 CONTINUATION frame downgrade produces two HTTP/1.1 requests

When a reverse proxy accepts HTTP/2 from clients and downgrades to HTTP/1.1 for the backend, it must fully reassemble the h2 request — including any header data split across HEADER and CONTINUATION frames — before constructing the equivalent HTTP/1.1 request. Some proxy implementations have bugs or incomplete handling for requests where the HEADERS frame does not set the END_HEADERS flag and relies on CONTINUATION frames to complete the header block. If the proxy incorrectly treats the HEADERS frame as a complete request and forwards it to the backend before CONTINUATION frames arrive, the backend receives an incomplete first request followed by what appears to be a second request (the CONTINUATION frame data). The attacker controls the CONTINUATION content and can craft the second apparent request to target any URL with any headers.

The correct remediation is to either use HTTP/2 end-to-end (h2c between proxy and backend, eliminating the downgrade entirely) or to ensure the proxy rigorously validates that the END_HEADERS flag is set before forwarding any h2 request to the backend.

# VULNERABLE nginx config — HTTP/2 frontend to HTTP/1.1 backend
# without explicit validation of CONTINUATION frame reassembly
server {
    listen 443 ssl http2;
    server_name api.skillaudit.dev;

    location /api/ {
        # VULNERABLE: h2 to h1.1 downgrade
        # nginx may forward incomplete h2 request if CONTINUATION frames not properly handled
        # Older nginx versions had bugs in CONTINUATION frame reassembly (CVE-2024-24989)
        proxy_pass http://node_backend;  # HTTP/1.1 to backend
        proxy_http_version 1.1;
    }
}

# node_backend: upstream using HTTP/1.1
upstream node_backend {
    server localhost:3000;
    keepalive 32;
}
# FIXED option A — HTTP/2 end-to-end (h2c) eliminates the downgrade entirely
# Requires the Node.js backend to support h2c (HTTP/2 cleartext)
server {
    listen 443 ssl http2;
    server_name api.skillaudit.dev;

    location /api/ {
        proxy_pass https://node_backend_h2;
        proxy_http_version 2.0;  # nginx 1.25.3+ supports HTTP/2 upstream
    }
}

# node_backend_h2: upstream using HTTP/2
upstream node_backend_h2 {
    server localhost:3000;
    keepalive 32;
}
# FIXED option B — upgrade nginx to a patched version and add CONTINUATION frame validation
# Keep h2 frontend to h1.1 backend downgrade, but ensure nginx is patched
# Minimum versions: nginx 1.25.3+ (CONTINUATION flood fix), 1.26.1+ (h2 upstream)

server {
    listen 443 ssl http2;
    server_name api.skillaudit.dev;

    # Reject requests where HEADERS frame is suspiciously large (may indicate CONTINUATION abuse)
    # nginx limit_req and large_client_header_buffers provide some protection
    large_client_header_buffers 4 16k;

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

        # Explicitly buffer the full request before forwarding to backend
        # This ensures nginx has fully reassembled the h2 request before downgrade
        proxy_request_buffering on;

        proxy_read_timeout 30s;
        proxy_send_timeout 30s;
    }
}
// Node.js backend — explicit HTTP/2 support with h2c using the http2 module
import http2 from 'http2';
import express from 'express';

const app = express();
// ... routes defined on app ...

// h2c (cleartext HTTP/2) server for the backend — nginx proxy sends h2 directly
const server = http2.createServer(app);

server.on('error', (err) => {
  logger.error('h2c server error', { err: err.message });
});

server.listen(3000, () => {
  logger.info('HTTP/2 cleartext backend listening on :3000');
});

// With h2c end-to-end, there is no h2→h1 downgrade and no CONTINUATION frame reassembly
// issue — the entire request arrives as a single h2 stream with guaranteed header integrity.

Detection with SkillAudit

SkillAudit's SA-SKL-DESYNC1 rule set detects request smuggling vulnerabilities through a combination of static configuration analysis and active probing against a sandboxed deployment. The static pass reads Caddyfiles, nginx configs, and docker-compose definitions to identify client_max_body_size 0, missing proxy_read_timeout directives, missing header_up normalization, and h2-to-h1 downgrade configurations. The active probe sends a crafted CL.TE request to the sandboxed deployment and measures whether the backend processes it as one request or two — a definitive test for the DESYNC1-001 and DESYNC1-004 patterns that static analysis cannot fully confirm alone.

Run SA-SKL-DESYNC1 on your skill: Paste your MCP skill's GitHub URL at skillaudit.dev to get a full scan. The free tier covers public repositories and returns a shareable security badge.

FindingSeverityVulnerable patternFix
DESYNC1-001HighCaddy + Node.js: CL.TE conflict; body suffix poisons next request socketCaddy header_up Transfer-Encoding ""; backend rejects requests with both headers
DESYNC1-002Highnginx client_max_body_size 0; chunked extension abuse forwards extra bytesExplicit client_max_body_size 10m (or bounded per-route); enable proxy_request_buffering on
DESYNC1-003MediumKeep-alive no timeout; slow-read leaves partial bytes in reused socketproxy_read_timeout 30s; proxy_set_header Connection "close"; server.keepAliveTimeout = 30000
DESYNC1-004Highh2 to h1.1 downgrade; CONTINUATION frames reassembled as two h1 requestsUse h2c end-to-end (proxy_http_version 2.0); upgrade nginx; proxy_request_buffering on