HTTP compression denial of service
Project curl Security Advisory, June 27th 2022 - Permalink
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 unbounded, allowing a malicious server to insert a virtually unlimited number of compression steps.
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.
Automatic content decompression of content needs to be enabled per transfer but the way Transfer-Encoding works in curl this code path and problem can be reached with default options.
This flaw exists with just one of the compression algorithms built-in (gzip, brotli or zstd), but the individual algorithms have different "exploding" powers.
Transfer-Encoding: are affected. The vulnerability is more emphasized over HTTP/1 than HTTP/2 due to different curl internal header limits.
CWE-770: Allocation of Resources Without Limits or Throttling
- Affected versions: curl 7.57.0 to and including 7.83.1
- Not affected versions: curl < 7.57.0 and curl >= 7.84.0
- Introduced-in: https://github.com/curl/curl/commit/dbcced8e32b50c06
libcurl is used by many applications, but not always advertised as such!
The amount of accepted "chained" algorithms is now capped to 5.
A - Upgrade curl to version 7.84.0
B - Apply the patch to your local version
This issue was reported to the curl project on May 15, 2022. We contacted distros@openwall on June 20.
libcurl 7.84.0 was released on June 27 2022, coordinated with the publication of this advisory.
- Reported-by: Harry Sintonen
- Patched-by: Daniel Stenberg
Thanks a lot!