SpiderLabs Blog

Bypass Vulnerabilities in Squid and McAfee Web Access Gateway

Written by Jonathan Claudius | May 8, 2012 12:58:00 PM

About two weeks ago, a Brazilian security researcher by the name of Gabriel Menezes Nunes released two URL filter bypass vulnerabilities for both Squid 3.1.9 and McAfee Web Gateway 7.0 (CVE-2012-2213 and CVE-2012-2212 respectively). At a high level, these vulnerabilities suggested that an unauthenticated user could successfully bypass URL restrictions and access unauthorized sites.

When these vulnerabilities were initially released, the community met them with quite a bit of skepticism. Although the technique for actually exploiting the vulnerability was pretty straight forward, many (including myself) were having difficulty replicating a Squid configuration that demonstrated this vulnerability.

After reaching out to Gabriel for the context in which he found the vulnerability and after a couple emails back and forth, I was able to get a working configuration that emulated the vulnerability as he noted in his original release. A configuration scenario, which demonstrates this, is a proxy that allows access to only sub-domains of google.com via SSL, but prohibits access to anything else.

Configuring Squid with the following three directives achieves the desired effect:

Once these rules are implemented, a remote user, configured to use this proxy, could only access sub-domains of google.com via HTTPS. All other sites would be restricted.

Taking a closer look at what happens behind the scenes in a normal scenario, when a user goes to an authorized site, we would see something like this:

When the user goes to an unauthorized site, we would see something like this:

However, what Gabriel discovered in his research was that you can bypass filter restrictions like this by simply forging the host header to be that of a white-listed domain like so:

Gabriel also provided a python script in his release, which acts as an intermediate proxy, which will make the necessary adjustments to the Host header on the fly to make browsing of restricted sites seamless to a prospective user. I am sure there is room for some sort of "yo dawg" exhibit meme here, but I have also confirmed that his proxy tool, when used with the above-mentioned configuration, works as expected to bypass filter controls.

At the time of this writing, both vulnerabilities (Squid and McAfee Web Gateway) are listed as "***DISPUTED***" in the National Vulnerability Database (NVD). This generally means that the community and/or the vendor have not been able to confirm the vulnerability and that it is still under review. Based on my testing, I consider this vulnerability to have real impact, but as a matter of classification it seems to me more a configuration/implementation vulnerability than a Squid vulnerability. However, with that said, that does not preclude other vendors that deploy Squid as a subsystem in their solution from using the above-mentioned conventions as a form of CONNECT-based access control.

It is important to note here that in testing, I was not successful in getting my hands on a McAfee Web Gateway 7.0 to validate CVE-2012-2212. However, after performing successful testing on Squid, I can say that if McAfee were to use a configuration as I describe above, it is certainly plausible that the implementation is affected in a similar fashion.

In testing this vulnerability, I also wrote a little ruby-based proxy scanner to help speed the evaluation process up. Here is a preview of the output when running it on a proxy Squid instance configured as mentioned above:

I have made this code available on GitHub (project link here) for anyone who would like to download the code and evaluate proxies for these configuration vulnerabilities. I would be interested, but not necessarily surprised, if it helps discover additional proxies that are vulnerable to the bypass condition identified by Gabriel.

Lastly, I'd like to point out how the "CONNECT" verb is essentially a method of obtaining an unobstructed TCP proxy to a desired location and is available on most proxy server implementations for proxying SSL traffic. Although this functionality in many cases is desired for functionality purposes, it can be and is often used for malicious purposes such as propagating malware, data exfiltration, port scanning, DMZ traversal and many more. Perhaps in a future blog post I will share one or more of these techniques in greater depth.