<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>WebstersProdigy &#187; firefox</title>
	<atom:link href="http://webstersprodigy.net/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://webstersprodigy.net</link>
	<description>Updates every other Friday... usually</description>
	<lastBuildDate>Sat, 26 May 2012 06:58:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='webstersprodigy.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>WebstersProdigy &#187; firefox</title>
		<link>http://webstersprodigy.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://webstersprodigy.net/osd.xml" title="WebstersProdigy" />
	<atom:link rel='hub' href='http://webstersprodigy.net/?pushpress=hub'/>
		<item>
		<title>Some Interesting URI Parsing Quirks and Open Redirects</title>
		<link>http://webstersprodigy.net/2012/03/16/some-interesting-uri-parsing-quirks-and-open-redirects/</link>
		<comments>http://webstersprodigy.net/2012/03/16/some-interesting-uri-parsing-quirks-and-open-redirects/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 21:36:50 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[uri]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=979</guid>
		<description><![CDATA[Parsing the &#8220;relativeness&#8221; of a URI seems to be a pretty browser specific thing, and doing some quick tests there are several quirks that might be useful/dangerous. The Tangled Web (which is an awesome book) aludes to some of these. Some URI Quirks Let&#8217;s look at some tests with the URIs grabbed from the location [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=979&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Parsing the &#8220;relativeness&#8221; of a URI seems to be a pretty browser specific thing, and doing some quick tests there are several quirks that might be useful/dangerous. The Tangled Web (which is an awesome book) aludes to some of these.</p>
<h3>Some URI Quirks</h3>
<p>Let&#8217;s look at some tests with the URIs grabbed from the location header. The browsers I&#8217;m testing right now are IE9, Chrome 17 something, and Firefox 11.</p>
<p>All browsers are happy with this, and go to google.com</p>
<blockquote><p>header(&#8220;Location: //google.com&#8221;);</p></blockquote>
<p>Both Firefox and chrome truncate extra slashes<br />
So</p>
<blockquote><p>header(&#8220;Location: <a href="http://google.com">http:///////////////////////google.com</a>&#8220;);</p></blockquote>
<p>is completely happy.</p>
<p>IE is interesting, as it will be equally happy with and /</p>
<blockquote><p>header(&#8220;Location: <a href="https://google.com/">https:\\google.com\</a>&#8220;); &lt;&#8211; this works</p></blockquote>
<p>The spacing doesn&#8217;t seem to matter, so all browsers are happy with:</p>
<blockquote><p>header(&#8220;Location:                        <a href="http://google.com">http://google.com</a>&#8220;);</p></blockquote>
<p>as well as</p>
<blockquote><p>header(&#8220;Location:http://google.com&#8221;);</p></blockquote>
<p>My favorite is this. In chrome and Firefox</p>
<blockquote><p>header(&#8220;Location: http:google.com&#8221;);</p></blockquote>
<p>will redirect to a relative URI, but for whatever reason</p>
<blockquote><p>header(&#8220;Location: <a href="https://google.com">https:google.com</a>&#8220;);</p></blockquote>
<p>will redirect to google.com. wtf?</p>
<h3>Same Domain Redirect</h3>
<p>These parsing quirks can be useful for several attacks, and the first thing that came to mind for me was open redirects.  It&#8217;s a pretty common scenario to want to allow sites  redirecting based on the parameter as long as it&#8217;s in the same domain. It can be expensive to whitelist every URI (which would be ideal), so although that&#8217;s a great solution, I also think allowing redirects to your own domain is sometimes better than nothing &#8230;despite there being some risks associated with it, like giving an attacker a way to bypass the IE8 XSS filter <a href="http://packetstorm.wowhacker.com/papers/general/msie-xssbypass.pdf">http://packetstorm.wowhacker.com/papers/general/msie-xssbypass.pdf</a>.</p>
<p>So, below are some (broken) examples of websites trying to accomplish this, allowing a redirect but only to their own site.</p>
<p><strong>Broken Example 1 &#8211; startswith /</strong></p>
<p>One naive way to try to perform arbitrary on-site local redirects would be something like the following, which takes the redir query parameter and make sure it starts with a slash:</p>
<p><pre class="brush: php;">
$redir = $_GET['redir'];
#if redir starts with /
if (strpos($redir, &quot;/&quot;, 0) === 0)
header(&quot;Location: &quot; . $redir);
</pre></p>
<p>Obviously, this can be bypassed in all browsers with //google.com</p>
<p><strong>Broken Example 2 - No Semicolons, Can&#8217;t start with /, and in fact, don&#8217;t start with // either</strong></p>
<p>This PHP tries to prevent off-site redirects with the following snippet</p>
<p><pre class="brush: php;">
$redir = $_GET['redir'];
#make sure redir doesn't have slashes, and doesn't have semicolons
if ((strpos($redir, &quot;/&quot;, 0) != 0) and (strpos($redir, &quot;/&quot;, 1) != 1) and (strpos($redir, &quot;:&quot;) === false))
{
header(&quot;Location: &quot; . $redir);
}
</pre></p>
<p>Because you can prepend spaces, one way to bypass this is to send the following:</p>
<blockquote><p>redir=%20%20//google.com</p></blockquote>
<p><strong>Broken Example 3 &#8211; No Slashes at all</strong></p>
<p>Ok, what if there are no slashes are allowed at all? You can&#8217;t very well have <a href="http://blah.com">http://blah.com</a> without a slash, after all, so this intuitively might make sense. The code for this might look something like:</p>
<p><pre class="brush: php;">
$redir = $_GET['redir'];
#if no / in the string
if (strpos($redir, &quot;/&quot;) === false)
  header(&quot;Location: &quot; . $redir);
</pre></p>
<p>However, using the quirks above, this can be bypassed by using redir=https:google.com in FF and chrome, and it can be bypassed in IE with redir=\google.com</p>
<p><strong>Broken Example 4 &#8211; Built in Libraries:</strong></p>
<p>Surely there are libraries that solve this problem. Well, maybe there are, but there are certainly libraries people use to <em>try</em> to solve this problem, but they don&#8217;t do it as people expect (e.g. a library might call a URI relative when a browser treats it as absolute). Making a library that works well is a fundamentally tough problem because all these browsers have quirks and the library has to match all browsers. So is a library supposed to call <a href="https://google.com">https:google.com</a> a relative or a full uri? (it&#8217;s relative in IE but full in chrome and FF)</p>
<p>Here&#8217;s one C# example where someone might try to figure out if a URI is relative URI using the IsAbsoluteUri property in .net system.Uri.</p>
<p><pre class="brush: cpp;">
        static void Main(string[] args)
        {

            String[] uriArray = new String[] {
                &quot;//google.com/test.html&quot;,                 //relative
                &quot;\\google.com\test.html&quot;,              //relative
                &quot;/////////google.com/test.html&quot;,          //relative
                &quot;https:google.com&quot;,                       //relative
                &quot;http://google.com&quot;,                      //absolute
                &quot;http:///////////////////google.com&quot;,     //absolute
                &quot;           http://google.com&quot;            //absolute
            };

            foreach (String uriString in uriArray)
            {
                try
                {
                    Uri uri = new Uri(uriString, UriKind.Relative); //works
                    if (!uri.IsAbsoluteUri)
                    {
                        Console.WriteLine(&quot;is a relative URI: {0}&quot;, uriString);
                    }
                }
                catch (UriFormatException e)
                {
                    Console.WriteLine(&quot;not a relative URI: {0}&quot;, uriString);
                }
            }
        }
</pre></p>
<p><strong>Broken Example 5 &#8211; startswith Whitelisted Domain</strong></p>
<p>This is a classic example. Even though it doesn&#8217;t have much do do with parsing quirks, it can be subtle and illustrates an important point.  So say an application does the following to make sure the redirect is on the correct domain.</p>
<p><pre class="brush: cpp;">
String redir = Request[&quot;redir&quot;];
if (redir.StartsWith(&quot;http://goodsite.com&quot;))
{
	Response.Redirect(redir);
}
</pre></p>
<p>Can an attacker still exploit this? The answer is yes, by setting redir=http://goodsite.com.badsite.com/</p>
<h3>What&#8217;s the Right Way to do on-domain Redirects?</h3>
<p>So open redirects are in the owasp top ten, and they have some guidance here: <a href="https://www.owasp.org/index.php/Top_10_2010-A10-Unvalidated_Redirects_and_Forwards">https://www.owasp.org/index.php/Top_10_2010-A10-Unvalidated_Redirects_and_Forwards</a>. However, to summarize, it basically says to whitelist and don&#8217;t redirect. I do agree, but again, what if you want to do on-domain redirects? The best I can think of is to do something like this:</p>
<blockquote><p>startswith(http://goodsite.com/ || <a href="https://google.com/">https://goodsite.com/</a>)</p></blockquote>
<p>Note the trailing slash, which prevents broken example #5.  I don&#8217;t think it&#8217;s possible to redirect off-site with this type of code&#8230; but if someone knows otherwise, I&#8217;d definitely be interested in how to do it :)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/979/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=979&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2012/03/16/some-interesting-uri-parsing-quirks-and-open-redirects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>
	</item>
		<item>
		<title>browsing with firefox, tor, refcontrol, and noscript on ubuntu</title>
		<link>http://webstersprodigy.net/2009/05/08/browsing-with-firefox-tor-refcontrol-and-noscript-on-ubuntu/</link>
		<comments>http://webstersprodigy.net/2009/05/08/browsing-with-firefox-tor-refcontrol-and-noscript-on-ubuntu/#comments</comments>
		<pubDate>Fri, 08 May 2009 20:54:43 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[referer]]></category>
		<category><![CDATA[tor]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=534</guid>
		<description><![CDATA[I am doing some research that involves a *lot* of google searches. Because this research involves a significant number of directed queries, it seems logical to hide this information as much as practical. If there is a web host who notices sequential names in a Google referer URL repeatedly, this might raise suspicion or alter behavior which could skew results. Similarly, it is desirable to hide IP information from both the web host (for similar reasons) and possibly even search engines.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=534&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a topic that&#8217;s been covered a lot. However, it took a bit of research to find a solution that worked for me, so I thought I&#8217;d write about it here.</p>
<p>I am doing some research that involves a *lot* of google searches. Because this research involves a significant number of directed queries, it seems logical to hide this information as much as practical. If there is a web host who notices sequential names in a Google  referer URL repeatedly, this might raise suspicion or alter behavior which could skew results. Similarly, it is desirable to hide IP information from both the web host (for similar reasons) and possibly even search engines.</p>
<p>First, to  avoid any changes to usual browsing, a new firefox profile was created using:</p>
<blockquote><p>firefox -ProfileManager</p></blockquote>
<p>Additionally, to run both firefox profiles at once, the first was run as normal, which the second has the additional options:</p>
<blockquote><p>firefox -P &lt;new-profile&gt; -no-remote</p></blockquote>
<p>I add this to my taskbar alongside the regular old firefox %u so I can choose a profile with a click.</p>
<p>To hide the HTTP referer, a firefox extension called RefControl was selected  <a href="https://addons.mozilla.org/en-US/firefox/addon/953">https://addons.mozilla.org/en-US/firefox/addon/953</a>. This simply replaces the referer for every query with one that is configurable. Although this is certainly possible with a more traditional proxy (like paros), RefControl&#8217;s ease of use is essential with the shear number of queries that were performed for this research. For this research, I changed the referer passed several times from names like “yahoo.com”, “cnn.com”, etc. Although the traffic patterns may still seem suspicious to an administrator who carefully monitors his logs, it reveals virtually no information about what it is that is being searched for.</p>
<p>To obfuscate the IP address, tor and privoxy were used. Tor bounces the HTTP requests around a distributed network of relays all around the world. An in depth discussion of Tor is out of the context here, but in a nutshell “it prevents somebody watching your Internet connection from learning what sites you visit, and it prevents the sites you visit from learning your physical location” http://www.torproject.org/. Privoxy is additionally used to prevent applications like flash or dns from leaking information. Since both privoxy and tor are required, you need to install these:</p>
<blockquote><p>apt-get install tor privoxy</p></blockquote>
<p>and to get privoxy to work with tor, I uncommented the following line (if it&#8217;s not there just add it):</p>
<blockquote><p>forward-socks4a / localhost:9050 .</p></blockquote>
<p>Despite the advantages, this did make browsing for names quite slow. I really like torbutton. In the not so distant future I remember having to modify proxy settings every time I wanted to go back and forth using tor. With tor</p>
<p>Lastly, the noscript firefox plugin was used to mitigate all javascript based attacks that might be used to obtain IP information http://noscript.net/.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/534/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=534&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2009/05/08/browsing-with-firefox-tor-refcontrol-and-noscript-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>
	</item>
		<item>
		<title>HTTP over SSH</title>
		<link>http://webstersprodigy.net/2008/11/01/http-over-ssh/</link>
		<comments>http://webstersprodigy.net/2008/11/01/http-over-ssh/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 19:38:19 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=411</guid>
		<description><![CDATA[It's easier than you might think. socks is actually built into openSSH, so its really a trivial matter to setup a local proxy.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=411&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easier than you might think.</p>
<p>socks is actually built into openSSH, so its really a trivial matter to setup a local proxy.</p>
<blockquote><p>
$ ssh -D 12345 myuser@remote_ssh_server
</p></blockquote>
<p>will open up the port 12345 on localhost as a socks proxy and all your traffic can be specified to go through the tunnel and out of remote_ssh_server</p>
<p>For firefox 3, go to Edit-&gt;Prefrences-&gt;Advanced-&gt;Network-&gt;Settings</p>
<p>and set it to use a Manual Proxy, localhost, port 12345 socksv5</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/411/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=411&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2008/11/01/http-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>
	</item>
	</channel>
</rss>
