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

HTTP multi-header compression denial of service

curl capped the number of chained compression algorithms per header, not across all headers, so a malicious server could send many headers to create a huge decompression chain. This could exhaust heap memory and cause a denial of service.

monnerat Follow

Originally disclosed on HackerOne

Medium 5.3 View original
  • Triaged in under an hour
  • Fixed in 2 hours
  • Paid in 2 hours
  • Disclosed after 8 hours

Summary by the program

CVE-2023-23916: HTTP multi-header compression denial of service Project curl Security Advisory, February 15th 2023

VULNERABILITY curl supports "chained" HTTP compression algorithms, meaning that a server response can be compressed multiple times and potentially with different algorithms. The number of acceptable "links" in this "decompression chain" was capped, but the cap was implemented on a per-header basis allowing a malicious server to insert a virtually unlimited number of compression steps simply by using many headers.

The use of such a decompression chain could result in a "malloc bomb", making curl end up spending enormous amounts of allocated heap memory, or trying to and returning out of memory errors.

We are not aware of any exploit of this flaw.

INFO CVE-2023-23916 was introduced in commit dbcced8e32b50c06, shipped in curl 7.57.0.

Automatic decompression of content needs to be enabled per transfer. It is disabled by default and then nothing bad happens. This flaw exists with one or more of the compression algorithms built-in (gzip, brotli or zstd), but the individual algorithms have different "exploding" powers. Both Content-Encoding: and Transfer-Encoding: are affected over all HTTP versions. This flaw is almost identical to the previous CVE-2022-32206: HTTP compression denial of service, as the fix for that earlier flaw was incomplete. CWE-770: Allocation of Resources Without Limits or Throttling Severity: Medium

AFFECTED VERSIONS Affected versions: curl 7.57.0 to and including 7.87.0 Not affected versions: curl < 7.57.0 and curl > 7.87.0 libcurl is used by many applications, but not always advertised as such!

THE SOLUTION The amount of accepted "chained" algorithms is now capped to 5 in total, independently of the number of headers. A fix for CVE-2023-23916

RECOMMENDATIONS A - Upgrade curl to version 7.88.0 B - Apply the patch to your local version C - Do not enable automatic decompression

CREDITS Reported-by: Patrick Monnerat Patched-by: Patrick Monnerat Thanks a lot!

Full Security Advisory: https://curl.se/docs/CVE-2023-23916.html

The report

A server can send an HTTP response with many occurrences of Transfer-Encoding and/or Content-Encoding headers. Each listed encoding allocates a buffer. The number of encodings listed within each header is already limited but the number of headers is not, allowing an HTTP response to consume all available memory.

Impact

Consumes all available memory, resulting in a DoS.

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

The limit on the number of decompression steps was enforced per header rather than across all headers in a response.

Impact

A malicious server could cause curl to allocate enormous amounts of heap memory, potentially leading to out-of-memory errors or a denial of service; automatic decompression must be enabled for this to happen.

What the attacker needed

Automatic decompression enabled; malicious server; curl 7.57.0 to 7.87.0

The fix

The total number of accepted chained algorithms was capped at 5, regardless of the number of headers.

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.

When a server compresses a response, curl can decompress it. If the server says it compressed the data many times, curl has to undo each step, using memory for each. The limit on how many steps curl would accept was applied to each header separately, so a server could just send lots of headers to get around it and use up all the memory.

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 monnerat

View all

5 more disclosed reports, best first.

More from Internet Bug Bounty

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.