Bug 864417 (CVE-2012-4504)

Summary: CVE-2012-4504 libproxy: long proxy.pac file handling buffer overflow
Product: [Other] Security Response Reporter: Tomas Hoger <thoger>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: security-response-team, tmraz
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libproxy 0.4.9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-10 10:59:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 866991    
Bug Blocks: 864423    
Attachments:
Description Flags
Upstream patch none

Description Tomas Hoger 2012-10-09 11:53:33 UTC
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.

http://code.google.com/p/libproxy/source/browse/trunk/libproxy/url.cpp?r=846#462

This issue was introduced upstream with the addition of the chunked encoding support, which first appears in version 0.4.

http://code.google.com/p/libproxy/source/detail?r=489
http://code.google.com/p/libproxy/issues/detail?id=77

Comment 1 Tomas Hoger 2012-10-09 11:55:57 UTC
Created attachment 624045 [details]
Upstream patch

Patch from Nicolas Dufresne, moving the content length value check to appear on a non-chunked encoding code path.

Comment 3 Tomas Hoger 2012-10-09 12:00:35 UTC
Statement:

Not vulnerable. This issue did not affect the version of libproxy as shipped with Red Hat Enterprise Linux 6.

Comment 4 Tomas Hoger 2012-10-09 18:51:07 UTC
Acknowledgment:

This issue was discovered by Tomas Mraz of Red Hat.

Comment 6 Tomas Hoger 2012-10-11 20:02:53 UTC
Fixed now in upstream version 0.4.9.  Upstream commit, identical to the patch in comment #1:

https://code.google.com/p/libproxy/source/detail?r=853

Comment 7 Tomas Hoger 2012-10-12 08:43:10 UTC
Upstream announcement of 0.4.9, also mentioning CVE-2012-4505 (bug 864612):

https://groups.google.com/forum/?fromgroups=#!topic/libproxy/VxZ8No7mT0E

Comment 8 Tomas Hoger 2012-10-16 13:45:20 UTC
Upstream 0.4.10 is now released too, which also fixes an infinite loop flaw that can be triggered by a server serving proxy.pac file.

https://groups.google.com/forum/?fromgroups=#!topic/libproxy/DsXENAx6LT8

Relevant change:

https://code.google.com/p/libproxy/source/detail?r=859

which fixes previous incorrect fix for the issue included in 0.4.9:

https://code.google.com/p/libproxy/source/detail?r=854

Comment 9 Tomas Hoger 2012-10-16 13:46:35 UTC
Created libproxy tracking bugs for this issue

Affects: fedora-all [bug 866991]

Comment 10 Fedora Update System 2012-11-19 02:19:29 UTC
libproxy-0.4.10-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.