Skip to content
Smuggling / CRLF Disclosed report Advanced CVE-2026-87864

libcurl RTSP `CURLOPT_CRLF` conversion allows a request body to become a second RTSP request

When libcurl sends an RTSP ANNOUNCE, SET_PARAMETER or GET_PARAMETER upload with CURLOPT_CRLF enabled, it advertises a Content-Length based on the raw body size but then expands bare LF bytes during transmission, so the body grows past the declared length. The extra bytes can form a complete second RTSP request on the same connection, which the server may process under the application's RTSP context.

revolik Follow

Originally disclosed on HackerOne

  • Disclosed after 3 days

AI WAS USED IN THE PROCESS OF IDENTIFYING THIS VULNERABILITY.

The vulnerability was tested manually and the report was carefully read.

Suggested severity

Low

Affected version

curl 8.23.0, tag curl-8_23_0, commit 3163ec065643ba20709f190111f42c3e1fe95273.

Affected interface

The issue is reachable through the libcurl API. It is not directly reachable through the curl command-line frontend because the tool does not expose CURLOPT_RTSP_REQUEST. In particular, -X ANNOUNCE sets CURLOPT_CUSTOMREQUEST; it does not select CURL_RTSPREQ_ANNOUNCE.

Summary

For RTSP ANNOUNCE, SET_PARAMETER, and GET_PARAMETER uploads, libcurl sends a Content-Length based on the raw input size. If CURLOPT_CRLF is enabled, libcurl then expands bare LF bytes while transmitting the body but does not update or reject the now-unknown length.

The server reads only the declared body length. The remaining bytes can form a second RTSP request on the same connection.

This appears to be the RTSP sibling of CVE-2026-87864. Its fix changed IMAP APPEND to consult Curl_creader_total_length() after the reader stack was created and reject CRLF conversion when the final size is unknown. The RTSP path still uses its pre-conversion req_clen.

Root cause

In lib/rtsp.c, rtsp_setup_body() does the following:

C
req_clen = data->state.infilesize;
result = Curl_creader_set_fread(data, req_clen);
...
curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T "\r\n", req_clen);

Curl_creader_set_fread() installs the generic CRLF conversion reader when data->set.crlf is true. That reader's cr_lc_total_length() correctly returns -1, but RTSP does not query it after reader construction.

Reproduction

I used the attached rtsp-crlf-framing.c with a one-shot loopback RTSP listener. The client constructs a body containing K bare LF bytes followed by a K-byte RTSP OPTIONS request. CRLF conversion expands the prefix from K to 2K bytes. The advertised raw body length is also 2K, so the body boundary lands exactly before the complete injected request.

Build the client against curl 8.23.0:

Shell
cc -O2 -DCURL_STATICLIB -I/path/to/curl/include \
  rtsp-crlf-framing.c /path/to/libcurl.a -o rtsp-crlf-framing \
  [the normal static libcurl dependency flags]

In terminal 1:

Shell
python3 rtsp_capture_server.py

In terminal 2:

Shell
./rtsp-crlf-framing rtsp://127.0.0.1:21031/test

Observed client result:

Text
raw_body=126 injected=63 result=0 (No error)

Observed by the server:

Text
Content-Length: 126
advertised=126
actual_body=189
overflow=63
overflow_bytes=b'OPTIONS rtsp://127.0.0.1:21031/injected RTSP/1.0\r\nCSeq: 999\r\n\r\n'

The overflow is an intact second request, and curl reports success.

Public disclosure

I have not opened a public issue or otherwise disclosed this report.

Impact

Impact

If an application enables CURLOPT_CRLF and sends attacker-influenced RTSP body content, the attacker can escape the declared body and append RTSP methods on the application's persistent connection. Depending on the server's connection, authentication, and session behavior, this can allow actions under the application's RTSP context.

This is not ordinary user-selected CRLF header injection: these bytes are provided as framed body content, and curl's conversion moves them outside that boundary. That is the same distinction as CVE-2026-87864.

The prerequisites are uncommon, so I suggest Low severity.

Suggested fix

After installing the RTSP body reader, use Curl_creader_total_length(data) for Content-Length. If it returns a negative value, reject the upload with CURLE_UPLOAD_FAILED, as RTSP cannot switch these requests to chunked framing.

A regression test can extend RTSP test568 with a known-size ANNOUNCE body that contains bare LF bytes and enables CURLOPT_CRLF. It should assert CURLE_UPLOAD_FAILED and no transmitted overflow.

The original report as published on HackerOne, by revolik. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely rtsp_setup_body() records the pre-conversion input size as Content-Length and never re-checks the reader's total length after the CRLF conversion reader is installed, so the declared length no longer matches the transmitted body.

Impact

If an application enables CURLOPT_CRLF and sends attacker-influenced RTSP body content, the attacker could escape the declared body and append RTSP methods on the application's persistent connection, potentially performing actions under the application's RTSP context; the prerequisites are uncommon, so severity is suggested as Low.

What the attacker needed

Libcurl API use, not the curl CLI; CURLOPT_CRLF enabled; attacker-influenced RTSP body; persistent RTSP connection

The fix

After installing the RTSP body reader, Content-Length should come from Curl_creader_total_length(data), and a negative result should reject the upload with CURLE_UPLOAD_FAILED since RTSP cannot switch to chunked framing.

How it was found

  1. Build the client against curl 8.23.0 with the supplied test program.
  2. Start a one-shot loopback RTSP listener.
  3. Run the client against the listener with an RTSP URL.
  4. Observe the server receiving a Content-Length larger than the declared body boundary, with an intact second RTSP request in the overflow.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

RTSP is a protocol used to control streaming media, and each message starts with a method name and a length header saying how many body bytes follow. libcurl can be told to convert line endings in an upload, which makes the body longer than the length it announced, so the leftover bytes look like a brand new RTSP command to the server.

What is Smuggling / CRLF?

A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Request smuggling and header injection

The lesson behind this report.

A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.