HTTP Request Smuggling

circle-exclamation

Understanding HTTP Request Smuggling

What is HTTP Request Smuggling?

HTTP Request Smuggling is a critical web vulnerability that exploits differences in how front-end servers (load balancers, reverse proxies, CDNs) and back-end servers parse HTTP requests. When these components disagree about where one request ends and another begins, attackers can "smuggle" requests that bypass security controls, hijack other users' requests, and perform unauthorized actions.

Vulnerable Scenario Example

POST /search HTTP/1.1
Host: vulnerable-app.com
Content-Length: 13
Transfer-Encoding: chunked

0

SMUGGLED

Different Technology Handling:

  • Front-end Server: Processes based on Transfer-Encoding: chunked → Sees request ending after "0\r\n\r\n"

  • Back-end Server: Processes based on Content-Length: 13 → Treats "SMUGGLED" as part of next request

  • Result: "SMUGGLED" gets prepended to the next user's request

How HTTP Request Smuggling Works

Request smuggling exploits the HTTP/1.1 specification ambiguity when both Content-Length and Transfer-Encoding headers are present. RFC 7230 states that Transfer-Encoding should take precedence, but implementations vary.

Request Processing Flow

  1. Client Request - Sends HTTP request with conflicting headers

  2. Front-end Server - Parses request using one method (CL or TE)

  3. Back-end Server - Parses the same request using different method

  4. Desynchronization - Servers disagree on request boundaries

  5. Request Queue Poisoning - Smuggled content affects subsequent requests

Impact and Consequences

  • Authentication Bypass - Hijacking authenticated sessions

  • Authorization Bypass - Accessing restricted endpoints

  • Request Hijacking - Stealing sensitive data from other users

  • Cache Poisoning - Poisoning web caches with malicious content

  • Security Control Bypass - Evading WAFs, rate limiting, and logging

  • Privilege Escalation - Accessing administrative functions


HTTP Request Boundary Fundamentals

Content-Length (CL) Method

Specifies the exact number of bytes in the request body:

Transfer-Encoding: chunked (TE) Method

Uses chunked encoding with size indicators:

Conflicting Headers - The Root Cause

When both headers are present, different servers may prioritize differently:


Technology-Specific Parsing Behavior

Front-end Technologies

HAProxy:

  • Default: Prioritizes Transfer-Encoding

  • Behavior: Processes chunked encoding when present

  • Configuration dependent on option http-server-close

Nginx:

  • Default: Prioritizes Transfer-Encoding

  • Behavior: Rejects requests with both headers by default

  • Can be configured to allow conflicting headers

Apache HTTP Server:

  • Default: Prioritizes Content-Length

  • mod_proxy behavior: May forward conflicting headers

  • Version-dependent processing differences

Cloudflare:

  • Default: Normalizes requests, removes conflicting headers

  • Edge cases: May pass through certain malformed requests

  • Geographic variation in processing

AWS Application Load Balancer:

  • Default: Prioritizes Transfer-Encoding

  • Behavior: Validates chunked encoding format

  • May reject malformed chunk sizes

Back-end Technologies

Apache Tomcat:

Node.js (Express):

Python (Gunicorn/uWSGI):

IIS (Internet Information Services):

  • Default: Prioritizes Content-Length

  • ASP.NET Core: Different behavior than IIS

  • Version-specific parsing differences

Jetty:


Basic Request Smuggling Techniques

CL.TE (Content-Length.Transfer-Encoding) Attacks

Attack Vector:

  • Front-end uses Content-Length

  • Back-end uses Transfer-Encoding

Basic CL.TE Attack:

Analysis:

  • Front-end: Reads 6 bytes ("0\r\n\r\nX") → Forwards entire payload

  • Back-end: Processes chunked encoding → Sees "0\r\n\r\n" as complete request

  • Result: "X" remains in buffer for next request

Advanced CL.TE Exploitation:

TE.CL (Transfer-Encoding.Content-Length) Attacks

Attack Vector:

  • Front-end uses Transfer-Encoding

  • Back-end uses Content-Length

Basic TE.CL Attack:

Analysis:

  • Front-end: Processes chunked → Reads "8\r\nSMUGGLED\r\n0\r\n\r\n"

  • Back-end: Uses Content-Length: 3 → Only reads "8\r\n"

  • Result: "SMUGGLED\r\n0\r\n\r\n" prepended to next request

Advanced TE.CL Exploitation:

TE.TE (Transfer-Encoding.Transfer-Encoding) Attacks

Attack Vector:

  • Both servers support Transfer-Encoding but parse it differently

  • Exploits header obfuscation and processing differences

Header Obfuscation Techniques:

Basic TE.TE Attack:

Advanced TE.TE with Header Splitting:


Authentication and Authorization Bypass

Session Hijacking

Basic Session Hijacking:

When the next user makes a request:

The back-end processes:

Advanced Session Hijacking with Response Capture:

Admin Panel Access

Direct Admin Bypass:

Administrative Function Execution:

JWT Token Smuggling

JWT Bypass Attack:

JWT Injection via Smuggling:


Business Logic Exploitation

E-commerce Price Manipulation

Price Override Attack:

Inventory Bypass:

Payment System Manipulation

Payment Amount Tampering:

Currency Manipulation:


Cache Poisoning via Request Smuggling

Web Cache Deception

Basic Cache Poisoning:

CDN Cache Poisoning:

Response Queue Poisoning

Multi-Stage Cache Poisoning:

Stage 1 - Poison the cache:

Stage 2 - Victim requests:

Result: Victim receives malicious response from cache

Advanced Cache Poisoning Techniques

Cache Key Manipulation:

JSONP Hijacking via Cache:


Framework-Specific Vulnerabilities

Node.js/Express Applications

Express Body Parser Bypass:

Fastify Plugin Bypass:

Python Web Applications

Django Request Smuggling:

Attack against Django:

Flask Application Vulnerability:

Java Spring Applications

Spring Boot Request Smuggling:

Attack payload:

Spring Security Bypass:

PHP Applications

PHP-FPM Request Smuggling:

WordPress Plugin Vulnerability:


Advanced Attack Scenarios

Multi-Stage Request Smuggling

Stage 1: Reconnaissance

Stage 2: Privilege Escalation

Stage 3: Data Exfiltration

Cross-Site Request Smuggling (CSRS)

Traditional CSRF + Request Smuggling:

Microservices Request Smuggling

Service Mesh Exploitation:

API Gateway Bypass:

Last updated

Was this helpful?