<?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/"
	>

<channel>
	<title>Muffin Research Labs &#187; security</title>
	<atom:link href="http://muffinresearch.co.uk/archives/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://muffinresearch.co.uk</link>
	<description>the personal blog of Stuart Colville covering modern web development techniques and best practices</description>
	<lastBuildDate>Thu, 15 Mar 2012 10:10:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Web Application Security &#8211; LugRadio Live 2009</title>
		<link>http://muffinresearch.co.uk/archives/2009/11/01/web-application-security-lugradio-live-2009/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/11/01/web-application-security-lugradio-live-2009/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 11:04:32 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[Slides]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=745</guid>
		<description><![CDATA[These are my slides from the presentation I gave at LugRadio Live 2009 at Wolverhampton. The presentation was a brief tour of some common security issues you might come across developing web applications. I also covered ReDOS which is a lot less well known but an interesting vulnerability. The notes are available on slideshare.net View [...]]]></description>
			<content:encoded><![CDATA[<p>These are my slides from the presentation I gave at LugRadio Live 2009 at Wolverhampton. The presentation was a brief tour of some common security issues you might come across developing web applications. I also covered ReDOS which is a lot less well known but an interesting vulnerability.</p>
<p>The <a href="http://www.slideshare.net/muffinresearch/security-presentation-2437395">notes are available on slideshare.net</a></p>
<div style="width:425px;text-align:left" id="__ss_2437395"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=security-presentation-091106061759-phpapp02&#038;stripped_title=security-presentation-2437395" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=security-presentation-091106061759-phpapp02&#038;stripped_title=security-presentation-2437395" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/muffinresearch">Stuart  Colville</a>.</div>
</div>
<p><del datetime="2009-11-06T12:23:17+00:00">I&#8217;ve had to pull the presentation from slideshare.net temporarily &#8211; I&#8217;ll re-upload as soon as possible</del> <ins datetime="2009-11-06T12:23:17+00:00">The problem at slideshare has now been resolved.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/11/01/web-application-security-lugradio-live-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Redirects and Phishing Vectors</title>
		<link>http://muffinresearch.co.uk/archives/2009/09/30/open-redirects-and-phishing-vectors/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/09/30/open-redirects-and-phishing-vectors/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 22:43:52 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=471</guid>
		<description><![CDATA[There was an interesting article on the Google Webmaster Central blog back in Jan talking about open redirects being abused by spammers. One point they didn&#8217;t go into too much detail on is that of phishing vectors. If you&#8217;re running a site with any kind of user registration and you have a redirect script that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://muffinresearch.co.uk/i/redirect-attack2.png"><img class="bord" src="http://muffinresearch.co.uk/i/open-redirect.jpg" alt="Open Redirect Phishing Vector Diagram" height="291" width="540" /></a></p>
<p>There was an interesting article on the <a href="http://googlewebmastercentral.blogspot.com/2009/01/open-redirect-urls-is-your-site-being.html">Google Webmaster Central blog</a> back in Jan talking about open redirects being abused by spammers.</p>
<p>One point they didn&#8217;t go into too much detail on is that of phishing vectors. If you&#8217;re running a site with any kind of user registration and you have a redirect script that allows redirects to any arbitrary urls. Then it&#8217;s fairly likely that you&#8217;ve straight away made it possible for a 3rd party to phish your registration form.</p>
<p>Let&#8217;s see an example of how something like this would work, first a standard redirection script:</p>
<dl class='tb'>
<dt>Target Site</dt>
<dd>buyeverythingawesome.com</dd>
<dt>Attack URL</dt>
<dd>http://buyeverythingawesome.com/redirect?url=http://buyeverythingawesome<strong>e</strong>.com/login/</dd>
<dt>Attacker&#8217;s Bogus Domain</dt>
<dd>buyeverythingawesome<strong>e</strong>.com</dd>
</dl>
<p>The target site has a script which blindly redirects to anything passed to it.</p>
<p>All the attacker has to do is send a victim an email telling them to login to their account to view the latest offers. The link they send is <code>http://buyeverythingawesome.com/redirect?url=http://buyeverythingawesomee.com/login/</code></p>
<p>On the bogus domain the attacker will have prepared a copy of the site&#8217;s login screen. All they need to do is get the user to login and then redirect the user back to the original site and if possible directly to the failed login page of the original site.</p>
<p>The way to mitigate this is to only allow redirects to your internal site or provide a whitelist of external urls that are allowed to be redirected to. </p>
<h3>Open Redirect Login Script</h3>
<p>Open Redirects in a login script are even worse in a way as the attacker will send the user to  the real site&#8217;s login script.</p>
<p>The symptoms of this kind of problem are visible with a setup like so:</p>
<dl class="tb">
<dt>Target Site</dt>
<dd>buyeverythingawesome.com</dd>
<dt>Attack URL</dt>
<dd>http://someawesomsite.com/login?after=http//:some<strong>w</strong>awesomsite.com/loginfailed/</dd>
<dt>Attacker&#8217;s Bogus Domain</dt>
<dd>some<strong>w</strong>awesomsite.com</dd>
</dl>
<p>All the attacker needs to do is to get the unwitting victim to visit <code>http://someawesomsite.com/login?after=http://some<strong>w</strong>awesomsite.com/loginfailed/</code></p>
<p>The user will be presented with the login screen for the genuine site. Once they login they are redirected to a bogus site with a &#8220;Your login has failed message &#8211; please try again&#8221; simply copied from the real site. The second time the user logs in they are logging-in to a bogus copy of the real site. Once the credentials are stolen the user can be redirected back to the real site where they are successfully logged in (This is because they aren&#8217;t redirected until they sucessfully login).</p>
<p>This is particularly nasty because the start and end points of this hack <em>are</em> the genuine site and as a result this kind of attack is much more likely to slip by unnoticed.</p>
<p>As a picture speaks a thousand words see this diagram of the flow: <a href="http://muffinresearch.co.uk/i/redirect-attack2.png">Open Redirect Phishing Vector (.png)</a></p>
<h3>Preventing these kind of attacks</h3>
<p>Firstly make absolutely sure you only allow redirects to internal links or whitelisted sites. If you need to redirect to arbitrary sites an interstitial page might be necessary to make it absolutely clear that the user is being redirected to a third party.</p>
<p>You might think that your site is already checking that links redirected are only internal ones. However it&#8217;s crucial that you take care to check more than just validating that the url starts with a slash.</p>
<h4>Check you&#8217;ve covered all eventualities</h4>
<p>It&#8217;s possible to write a link as  <code>//foo.com</code> and the scheme (http/https etc) will be inherited from the base <acronym title="Uniform Resource Identifier">URI</acronym>. So if you&#8217;re on <code>http://baz.com</code> and there&#8217;s a link with an  href attribute of <code>//google.com</code> this will resolve to <code>http://google.com</code>. It&#8217;s therefore important that any validation of redirect URLs covers this case or you could be caught out. </p>
<p>Note: If you&#8217;re interested this aspect of how URIs work is covered by <a href="http://labs.apache.org/webarch/uri/rfc/rfc3986.html#reference-examples">examples given in rfc 3986</a></p>
<p>As an example<code> http://has-open-redirect.com/login/?done=//google.com</code> would redirect to <code>http://google.com</code> after login if vulnerable.</p>
<h3>Why is any of this important?</h3>
<p>Right now you&#8217;re probably thinking that there&#8217;s nothing behind the login to your site that a hacker would want.</p>
<p>However, have you stopped to consider that your users might also use the same username and password to login to their amazon account for example?</p>
<p>Lot&#8217;s of people will only have one username and password for every site they use (<a href="http://www.infosecurity-magazine.com/view/3779/many-people-use-same-password-on-all-websites-says-cpp/">this infosecurity magazine article claims 46% of all UK adults us the same password</a>). If it&#8217;s possible to phish accounts on a low profile site &#8211; the chances are there will come a point when the attacker will hit the jackpot and get access to every site that user frequents with same username and password. </p>
<p class="update">Update: The GMail team has a nice post detailing some good <a href="http://gmailblog.blogspot.com/2009/10/choosing-smart-password.html">tips for choosing a good password</a>. Tip number one is don&#8217;t use the same password for all sites</p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/09/30/open-redirects-and-phishing-vectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

