Chunked transfer encoding is one of those HTTP/1.1 features that quietly runs behind almost every modern web server, and when it’s implemented incorrectly, it becomes the root cause of some genuinely serious vulnerability classes — HTTP request smuggling, buffer overflows, and denial-of-service conditions among them. generic_chunked is the test module I associate with checking exactly this: whether a target server or intermediary handles chunked encoding safely.
What Is generic_chunked?
generic_chunked refers to a vulnerability check (most commonly recognized as a test category/plugin within scanners like Nikto, and as a concept tested manually with tools like curl and Burp Suite) that probes how a web server parses HTTP chunked transfer-encoded request and response bodies. The goal is to identify servers vulnerable to historic and recurring issues tied to chunked encoding parsing — including the class of bugs that led to CVE-2002-0392 (Apache chunked encoding memory disclosure/DoS) and the modern wave of HTTP request smuggling vulnerabilities caused by inconsistent chunked-encoding parsing between a front-end proxy and a back-end server.
How Chunked Encoding Works (and Why It’s Risky)
In chunked transfer encoding, instead of sending a Content-Length header, the sender breaks the body into a series of chunks, each prefixed with its size in hexadecimal:
4\r\n
Wiki\r\n
5\r\n
pedia\r\n
0\r\n
\r\n
That’s a valid chunked body spelling “Wikipedia,” terminated by a zero-length chunk. The parsing logic required to correctly interpret this — reading a hex size, reading exactly that many bytes, expecting a \r\n, repeating until a zero-size chunk — is more complex than simple Content-Length-based parsing, and that complexity is exactly where implementation bugs creep in:
- Integer parsing errors — malformed or oversized hex chunk-size values can trigger integer overflows or improper buffer allocation in poorly written parsers.
- Inconsistent interpretation between systems — if a front-end load balancer and a back-end origin server disagree about where one chunked message ends and the next begins, an attacker can smuggle a second, hidden request inside what the front-end thinks is a single request body — the foundation of HTTP request smuggling.
- Malformed terminator handling — servers that don’t strictly validate the final
0\r\n\r\nsequence can be tricked into treating the connection differently than intended.
How the Check Works
A generic_chunked style test typically works by sending a series of deliberately malformed chunked requests and observing the server’s behavior:
- Baseline valid chunked request — confirm the server correctly handles standard chunked encoding at all.
- Oversized chunk-size field — send a chunk-size header far larger than the actual data provided, checking whether the server hangs, errors gracefully, or crashes.
- Non-hex characters in the chunk-size field — malformed chunk-size values to see if input validation is missing.
- Missing terminating chunk — omit the final
0\r\n\r\nand observe connection-handling behavior (hang vs timeout vs graceful close). - Conflicting Content-Length and Transfer-Encoding headers — sending both headers with different framing information is the classic smuggling probe, since RFC-compliant behavior requires
Transfer-Encodingto take precedence, but not every implementation follows this correctly.
Running the Check via Nikto
If you’re using Nikto, chunked-encoding-related checks are included as part of its broader test database and are triggered automatically during a standard scan; you can narrow a scan toward misconfiguration/protocol-level tests with:
nikto -h http://192.168.56.101 -Tuning 2
Manual Testing with curl
To manually test a baseline valid chunked request:
curl -v -X POST http://192.168.56.101/ \
-H "Transfer-Encoding: chunked" \
--data-binary $'4\r\nWiki\r\n5\r\npedia\r\n0\r\n\r\n'
To test a conflicting Content-Length/Transfer-Encoding combination (a classic request smuggling probe), you’ll generally need raw socket control since curl normalizes headers — this is where Burp Suite’s Repeater (with “Update Content-Length” disabled) or a raw script using Python’s socket module becomes necessary:
import socket
payload = (
"POST / HT TP/1.1\r\n"
"Host: 192.168.56.101\r\n"
"Content-Length: 6\r\n"
"Transfer-Encoding: chunked\r\n"
"\r\n"
"0\r\n\r\n"
"G"
)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.56.101", 80))
s.sendall(payload.encode())
print(s.recv(4096).decode(errors="replace"))
s.close()
This kind of test needs to be run against the exact front-end/back-end topology you’re authorized to assess, since request smuggling is fundamentally about disagreement between two systems, not a single server’s behavior in isolation.
Real-World Use Case (Authorized Lab Only)
In a lab setup with an Nginx reverse proxy in front of an older Apache backend, I sent a request containing both a Content-Length and a Transfer-Encoding: chunked header with intentionally conflicting framing. The front-end Nginx proxy forwarded the request based on Content-Length, while the Apache backend parsed it based on Transfer-Encoding, causing the two systems to disagree about where the request ended — allowing a smuggled second request to be interpreted by the backend as belonging to the next legitimate user’s connection. This is a classic, well-documented HTTP request smuggling pattern (CL.TE), reproduced strictly in an isolated authorized lab to demonstrate the impact for a report.
Workflow Integration
- Nikto → automated baseline detection of chunked-encoding and protocol-level misconfigurations.
- Burp Suite (with the HTTP Request Smuggler extension) → deeper, more targeted smuggling detection across various desync patterns (CL.TE, TE.CL, TE.TE).
- Manual socket scripts → precise control over raw header framing that HTTP libraries normally sanitize or reject.
- Wireshark → packet-level inspection to confirm exactly how each hop (proxy vs backend) parsed the ambiguous request.
Troubleshooting & Common Mistakes
- Testing with
curlalone and seeing “normalized” behavior — most HTTP client libraries (curl included) will refuse to send genuinely malformed/conflicting framing headers by default; you need raw socket-level control to test the interesting edge cases. - False sense of security from a single server test — request smuggling specifically requires multiple systems in the request path; testing only the origin server in isolation won’t reveal a smuggling issue that only manifests when a front-end proxy is involved.
- Crashing a service during testing — some malformed chunked payloads can cause older/unpatched servers to crash or hang; only run these tests against systems where downtime is acceptable and explicitly authorized.
Best Practices
- Always confirm the exact request-routing topology (load balancer → proxy → backend) before testing, since that topology determines which smuggling patterns are even possible.
- Use a dedicated smuggling detection tool (like Burp’s HTTP Request Smuggler) for thorough, safer-by-design testing rather than hand-crafting every payload.
- Treat any confirmed chunked-encoding parsing inconsistency as high severity in reporting — request smuggling can lead to cache poisoning, session hijacking, and authentication bypass depending on the application.
FAQ
Is generic_chunked a specific standalone tool? It’s best understood as a test category/technique — implemented as a check within scanners like Nikto and manually reproducible with raw HTTP crafting — rather than a single standalone executable.
Does this only affect old servers? No — while the original 2002-era Apache chunked encoding bug is long patched, the broader class of chunked-encoding parsing inconsistencies (especially request smuggling between proxies and backends) remains a live, actively researched vulnerability area today.
Can this cause a denial of service? Yes — some malformed chunked payloads can cause resource exhaustion or hangs in vulnerable implementations, which is why testing should always be scoped and authorized carefully.
Summary
Chunked transfer encoding’s complexity, relative to simple Content-Length framing, makes it a recurring source of parsing bugs — from historic buffer overflows to today’s HTTP request smuggling attacks between proxies and backend servers. Understanding how generic_chunked-style checks work, and being able to reproduce them manually with raw sockets or tools like Burp Suite’s smuggling extension, is essential for accurately assessing modern multi-tier web architectures.
References
- RFC 7230, Section 4.1 (Chunked Transfer Coding): https://datatracker.ietf.org/doc/html/rfc7230#section-4.1
- PortSwigger Web Security Academy — HTTP Request Smuggling: https://portswigger.net/web-security/request-smuggling
- Nikto GitHub repository: https://github.com/sullo/nikto
- CVE-2002-0392 (Apache chunked encoding vulnerability): https://nvd.nist.gov/vuln/detail/CVE-2002-0392
