HexBrain

curl · Report #3484431

HTTP Request Smuggling and SSRF via CRLF Injection in Curl_add_custom_headers

N/Astatus
highseverity
9upvotes
2 Jan 2026disclosed

How it was found

Summary:

A lack of CRLF validation in Curl_add_custom_headers at lib/http.c:1761 allows users to inject arbitrary HTTP headers. This violation of RFC 7230 §3.2.4 leads to HTTP Request Smuggling and potential SSRF bypass. AI Disclosure: I utilized an AI assistant to aid in the initial code analysis and patch generation, but I have manually verified all claims using hex dumps and proxy simulations to ensure technical accuracy.

Affected version

  • curl/libcurl version: 8.18.0-DEV and 8.15.0
  • Platform: Linux (Kali Linux)
  • curl -V output: curl 8.18.0-DEV (x86_64-pc-linux-gnu) libcurl/8.18.0-DEV OpenSSL/3.5.4

Steps To Reproduce:

  1. Start a listener to capture raw traffic: nc -l -p 8080 > raw_http.txt.
  2. Execute a libcurl application (or curl CLI) that appends a custom header containing CRLF: curl -H "X-Injected: Value\r\nInjected-Header: Malicious" http://localhost:8080.
  3. Inspect the captured output: hexdump -C raw_http.txt.
  4. Observe that the CRLF bytes (0d 0a) are transmitted unsanitized, causing the receiver to interpret the injected string as a separate, valid HTTP header.

Supporting Material/References:

  • Hexdump Proof: The hex dump shows 0d 0a at offset 0x49, confirming request splitting at the protocol level.
  • Suggested Patch: A verification patch using strchr to reject \r and \n in lib/http.c successfully mitigates the issue.

Impact

The lack of CRLF validation in libcurl's header handling allows for HTTP Request Smuggling, enabling an attacker to bypass security boundaries and perform Server-Side Request Forgery (SSRF). As libcurl is a foundational library used by countless applications and backends, this vulnerability poses a systemic risk. Specifically, injected headers persist across redirects (-L), which significantly increases the attack surface and allows for the potential exposure of isolated internal services or cache poisoning.


This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original