Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Security

http-request-smuggling

Detect HTTP request smuggling by desynchronising front-end and back-end request parsing, using raw-socket timing and differential probes. Use when testing for HTTP desync (CL.TE, TE.CL).

forefy · AI review on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add forefy/.context --skill http-request-smuggling

About this skill


name: http-request-smuggling description: Detect HTTP request smuggling by desynchronising front-end and back-end request parsing, using raw-socket timing and differential probes. Use when testing for HTTP desync (CL.TE, TE.CL).

Contents

  • Scope & authorization
  • Why raw sockets
  • Methodology (timing probes then differential confirmation)
  • Payloads (CL.TE and TE.CL, exact bytes)
  • Runnable snippet
  • Output

Scope & authorization

Request smuggling is an ACTIVE, potentially disruptive check. A successful desync poisons the shared front-end-to-back-end connection: the smuggled prefix can attach to the next request on that socket, which in a real deployment may belong to another user. Run this only against hosts you own or are contractually engaged to test, and prefer a low-traffic window. The timing probes (Steps 2-3) are the safest first pass because they never leave a dangling prefix; the differential confirmations (Steps 4-5) do smuggle a real prefix and should follow only once timing suggests a desync.

The vulnerability exists when a request traverses two servers (CDN/load-balancer/reverse-proxy front-end, then an origin back-end) that disagree on where one request ends and the next begins. That disagreement comes from sending both a Content-Length (CL) and a Transfer-Encoding: chunked (TE) header: if the front-end honors one and the back-end the other, the leftover bytes are "smuggled." A single server with no proxy in front cannot desync, so a negative result on a direct-to-origin host is expected, not a clean bill.

Everything below sends bytes on a raw socket - you cannot craft these requests with curl, because clients and libraries normalize the conflicting headers and fix the framing. Send the exact bytes, including CRLF line endings.

Why raw sockets

  • The two framing headers (Content-Length and Transfer-Encoding) must both be present and must reach the server unmodified. HTTP libraries strip or reconcile them.
  • Line endings must be real CRLF (\r\n). Author the payload with plain \n for readability, then convert every \n to \r\n before sending - matching the source templates exactly.
  • Detection is per-connection and stateful: you open a fresh TLS socket, send one crafted request, read the response, and compare across two identical sends. The desync shows up on the second request.

Methodology (run in order; each step is a check with a done/result state)

  1. Confirm a proxy chain exists. Look for Via, X-Cache, Server, X-Served-By, or CDN fingerprints in a normal curl -I. A fronted host (Cloudflare/Akamai/Fastly/ALB/nginx) is the interesting case. Note the target and confirm port 443.
  2. CL.TE timing probe. Send a request the front-end frames by Content-Length and the back-end by Transfer-Encoding, arranged so the back-end waits for a chunk that never completes. A response delay near the socket timeout indicates the back-end is stuck reading chunked data - i.e. CL.TE.
  3. TE.CL timing probe. Mirror image: front-end frames by TE and finishes early on the 0 chunk, back-end frames by CL and waits for bytes that never arrive. A delay indicates TE.CL. (Send these against / with a method the app accepts; a normal fast baseline request first tells you what "no delay" looks like.)
  4. CL.TE differential confirmation. Send the CL.TE smuggle payload below twice on two fresh connections. The front-end (CL) forwards the whole body; the back-end (TE) stops at the 0 chunk, leaving GET /404 ... buffered as the prefix of the next request. Report a finding when the SECOND response's status line is 404 Not Found while the FIRST is not - the smuggled prefix rewrote the follow-up request's path.
  5. TE.CL differential confirmation. Send the TE.CL smuggle payload below twice. The front-end (TE) reads the 5c-sized chunk and terminates on 0; the back-end (CL: 4) consumes only 5c\r\n and leaves the GPOST / HTTP/1.1 ... block buffered as the next request's prefix. Report a finding when the SECOND response's status line is 403 Forbidden while the FIRST is not - the smuggled invalid method poisoned the follow-up.
  6. Attribute and stop. As soon as one variant confirms, record which one (CL.TE vs TE.CL) and the exact payload. Do not keep smuggling; each confirmed send may have poisoned one real connection. Re-run once to verify reproducibility, then report.

Payloads (exact bytes; author with \n, send as \r\n)

CL.TE timing probe (Step 2) - back-end blocks waiting for the next chunk:

POST / HTTP/1.1
Host: TARGET
Content-Type: application/x-www-form-urlencoded
Transfer-Encoding: chunked
Content-Length: 4

1
A
X

TE.CL timing probe (Step 3) - back-end blocks waiting for Content-Length bytes past the 0 chunk:

POST / HTTP/1.1
Host: TARGET
Content-Type: application/x-www-form-urlencoded
Transfer-Encoding: chunked
Content-Length: 6

0

X

CL.TE differential smuggle (Step 4) - Content-Length: 35 spans the whole body; the 0 chunk ends the request for a TE back-end, leaving the GET /404 prefix:

POST / HTTP/1.1
Host: TARGET
Content-Type: application/x-www-form-urlencoded
Content-Length: 35
Transfer-Encoding: chunked

0

GET /404 HTTP/1.1
X-Ignore: X

TE.CL differential smuggle (Step 5) - Content-length: 4 stops the CL back-end after 5c\r\n, leaving the GPOST block; the 5c (92-byte) chunk keeps a TE front-end happy through to the 0 terminator:

POST / HTTP/1.1
Host: TARGET
Content-Type: application/x-www-form-urlencoded
Content-length: 4
Transfer-Encoding: chunked

5c
GPOST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 15

x=1
0

Runnable snippet

Self-contained; no third-party libraries. Set TARGET, run once per variant. It opens a fresh TLS socket per send, normalizes line endings to CRLF, sends twice, and applies the differential test on the response status line.

import socket, ssl, time

TARGET = 
Read the complete source ↗