]> git.ipfire.org Git - thirdparty/squid.git/commit
Improve handling of expanding HTTP header values (#1536)
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 25 Oct 2023 11:47:19 +0000 (11:47 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 27 Oct 2023 11:57:17 +0000 (00:57 +1300)
commit72a3bbd5e431597c3fdb56d752bc56b010ba3817
treed964289137d766dd06a77b745118dc761b6ea94e
parentca2b652a94713dd14300a3cb5521845ee1fa918a
Improve handling of expanding HTTP header values (#1536)

Squid manipulations often increase HTTP header value length compared to
the corresponding raw value received by Squid. Raw header length is
checked against request_header_max_size and reply_header_max_size that
default to 64KB, making the raw value safe to store in a String object
(by default). However, when the increased length of a manipulated value
exceeds String class limits, Squid leaks memory, asserts, or possibly
stalls affected transactions. The long-term fix for this problem is a
complete String elimination from Squid sources, but that takes time.

Known manipulations may effectively concatenate headers and/or increase
header value length by 50%. This workaround makes such known increases
safe by essentially tripling String class limits:

    (64KB + 64KB) * 150% = 3 * 64KB

This bug was discovered and detailed by Joshua Rogers at
https://megamansec.github.io/Squid-Security-Audit/response-memleaks.html
where it was filed as "Memory Leak in HTTP Response Parsing".
src/SquidString.h
src/cache_cf.cc
src/cf.data.pre
src/http.cc