An insufficient input validation flaw, leading to a heap-based buffer overflow was found in libproxy 0.3.x in the px_pac_reload() function. libproxy allocates a memory to store downloaded proxy.pac proxy auto-configuration file content using the Content-Length size from the remote server's HTTP response header. Allocation size is content length + 1. A malicious host hosting proxy.pac, or a man in the middle attacker, could use this flaw to make libproxy allocate insufficient amount of memory and subsequently overflow a heap-based buffer.
165 self->cache = px_malloc0(content_length+1);
166 for (int recvd=0 ; recvd != content_length ; )
167 recvd += recv(sock, self->cache + recvd, content_length - recvd, 0);
This issue was confirmed with libproxy 0.3.x. Earlier 0.2.x versions seems to be affected too. It does not affect 0.4.x versions, where fixed size buffer is used.
A buffer overflow flaw was discovered in the libproxy's url::get_pac() used to download proxy.pac proxy auto-configuration file. A malicious host hosting proxy.pac, or a man in the middle attacker, could use this flaw to trigger a stack-based buffer overflow in an application using libproxy, if proxy configuration instructed it to download proxy.pac file from a remote HTTP server.
url::get_pac() uses a fixed size buffer buffer to store content of the proxy.pac file downloaded from a remote server. When filling the buffer, it uses server-supplied content length value, rather than size buffer, as a limit for the size of the input copied into the buffer. Overflow occurs when server provides sufficiently large file and does not use chunked content encoding. The buffer size is checked when using chunked encoding.
This issue was introduced upstream with the addition of the chunked encoding support, which first appears in version 0.4.
> (In reply to comment #0)
> This issue was confirmed with libproxy 0.3.x. Earlier 0.2.x versions seems
> to be affected too. It does not affect 0.4.x versions, where fixed size
> buffer is used.
This one doesn't affect us, libproxy-0.4.6 is the earliest we have in the tree.
(In reply to comment #0)
Thanks, fixed in libproxy-0.4.10
>*libproxy-0.4.10 (16 Oct 2012)
> 16 Oct 2012; Alexandre Rostovtsev <email@example.com>
> libproxy-0.4.6-r3.ebuild, libproxy-0.4.7.ebuild, +libproxy-0.4.10.ebuild,
> +files/libproxy-0.4.10-mozjs185.pc.patch, metadata.xml:
> Version bump; fixes buffer overflow (bug #438146, CVE-2012-4504, thanks to
> Agostino Sarubbo). Re-add USE=webkit since it now works correctly (bug
> #412573, thanks to Lucian Muresan) and it enable by default to provide PAC
> and WPAD support. Alternatively, spidermonkey could be used for PAC instead
> (but might lead to firefox crashes, see bug #373397). Update license.
(In reply to comment #1)
> This one doesn't affect us, libproxy-0.4.6 is the earliest we have in the
Arches, please test and mark stable:
Target keywords : "alpha amd64 arm hppa ia64 ppc ppc64 sh sparc x86"
stable ppc ppc64
Stable for HPPA.
Would it be possible to switch to stabilizing 0.4.10-r1? Just added it, it fixes a DEPEND problem (bug 438714). If not, no problem, just wanted to ask.
(In reply to comment #9)
> Would it be possible to switch to stabilizing 0.4.10-r1? Just added it, it
> fixes a DEPEND problem (bug 438714). If not, no problem, just wanted to ask.
Chris, thanks for fixing 438714. I've merged your change into the 0.4.10 ebuild and removed 0.4.10-r1; there is no need to make a revision bump when you are only adding a necessary dependency to an ebuild and that new dependency does not break any of the ebuild's keywords.
(In reply to comment #10)
As pointed out by Chris on IRC, adding the automoc build dependency can change the set of installed files, since the kde plugin will no longer silently fail to build/install. So the 0.4.10-r1 revision bump was indeed correct.
Please reset the stabilization target to =net-libs/libproxy-0.4.10-r1
I have opened a separate bug #439122 for stabilization of 0.4.10-r1 on those arches who had already finished stabilizing 0.4.10.
Stable on alpha. (took =dev-lang/spidermonkey-1.8.5-r1 along for the ride).
Stack-based buffer overflow in the url::get_pac function in url.cpp in
libproxy 0.4.x before 0.4.9 allows remote servers to have an unspecified
impact via a large proxy.pac file.
New GLSA request filed.
This issue was resolved and addressed in
GLSA 201404-02 at http://security.gentoo.org/glsa/glsa-201404-02.xml
by GLSA coordinator Mikle Kolyada (Zlogene).