Skip to content
Memory corruption Disclosed report Advanced

Curl parse_connect_to_string Heap-Overread Leading to Denial of Service via CURLOPT_CONNECT_TO

A heap buffer over-read exists in curl's parse_connect_to_string function when the CURLOPT_CONNECT_TO option is given a malformed host string containing unexpected characters such as a newline. An attacker who can influence that option value could crash the application, causing a denial of service.

irene1hacker Follow

Originally disclosed on HackerOne

  • Disclosed after under an hour

Summary:

A heap-buffer-overread occurs in Curl's parse_connect_to_string function when using the CURLOPT_CONNECT_TO option with crafted input. This can lead to a segmentation fault and crash of the application, resulting in a denial-of-service. The issue is triggered by malformed host strings containing unexpected characters, such as newline (\n), that are not properly validated before dereferencing.

Affected version

curl 8.16.0-DEV (Linux) libcurl/8.16.0-DEV

Steps To Reproduce:

[add details for how we can reproduce the issue]

1.Compile libcurl with sanitizers enabled:

mkdir build && cd build
CC=clang CXX=clang++ cmake ..   -DCMAKE_BUILD_TYPE=Debug   -DCMAKE_C_FLAGS="-g -O1 -fsanitize=address"   -DBUILD_SHARED_LIBS=OFF   -DBUILD_STATIC_LIBS=ON   -DBUILD_TESTING=OFF   -DBUILD_EXAMPLES=OFF   -DENABLE_MANUAL=OFF
cmake --build . --config Debug
  1. Build the test target
clang++ -g -O1 -fsanitize=address     -I../include -I../src/include     minimal_curl_connect_crash.cpp ./lib/libcurl-d.a     -o minimal_curl_connect_crash     -lpsl -ldl -lpthread -lssl -lcrypto -lz
  1. Run the test target
./minimal_curl_connect_crash

Supporting Material/References:

image.png
image.png From the original on HackerOne

(Attachment on the original report: minimal_curl_connect_crash.cpp)

Impact

Summary:

An attacker can cause a denial-of-service (DoS) by crashing the application using a specially crafted CURLOPT_CONNECT_TO string. No code execution or data leakage is known; the primary risk is service disruption.

The original report as published on HackerOne, by irene1hacker. 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 the parser for the connect-to string does not validate or bound-check the host portion before dereferencing it, so malformed characters lead to reading past the allocated buffer.

Impact

An attacker can cause a denial-of-service (DoS) by crashing the application using a specially crafted CURLOPT_CONNECT_TO string; no code execution or data leakage is known.

What the attacker needed

Attacker controls the connect-to option value

How it was found

  1. Build libcurl with AddressSanitizer enabled.
  2. Compile a small test program that sets the connect-to option against the static library.
  3. Run the test program and observe the crash.

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.

curl is a library and tool for fetching things over the network. One of its settings lets a program redirect a connection to a different host and port, and the code that reads that setting did not check the input carefully enough. With a badly formed value it reads past the end of a memory buffer, which usually makes the program crash rather than leak or run anything.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by irene1hacker

View all

1 more disclosed report, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.