<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;A0cDQ3s7fip7ImA9WhBaEEU.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923</id><updated>2013-05-21T08:31:12.506+10:00</updated><category term="Windows Mobile" /><category term="Visual Studio" /><category term="Twitter" /><category term="Gootkit" /><category term="MVC" /><category term="Performance" /><category term="Personal Development" /><category term="China" /><category term="StillAlive" /><category term="Standards" /><category term="SQL Injection" /><category term="Design Utopia" /><category term="SQL Server" /><category term="StatSVN" /><category term="Career Development" /><category term="Windows" /><category term="Security" /><category term="Apple" /><category term="Scam" /><category term="Azure" /><category term="1Password" /><category term="NDepend" /><category term="5 Minute Wonder" /><category term="SQL Compare" /><category term="OWASP" /><category term="Backup" /><category term="SQL Prompt" /><category term="SQL Data Generator" /><category term="Travel" /><category term="LinkedIn" /><category term="FxCop" /><category term="Conference" /><category term="Netsparker" /><category term="Passwords" /><category term="SQL Test" /><category term="Product Review" /><category term="SSL" /><category term="Facebook" /><category term="SQL Source Control" /><category term="Cloud" /><category term="K2" /><category term="Mobile" /><category term="ASafaWeb" /><category term="Continuous Integration" /><category term="Subversion" /><category term="Red Gate" /><category term="Online Identity" /><category term="SharePoint" /><category term="UX" /><category term="Corporate" /><category term="MVP" /><category term="WCSA" /><category term="Code Quality" /><category term="Source Control Management" /><category term="MSBuild" /><category term="Blogger" /><category term="IIS" /><category term="AppHarbor" /><category term="SQL Search" /><category term="Bing" /><category term="ReSharper" /><category term="iPhone" /><category term="DotNetNuke" /><category term="Database" /><category term="TeamCity" /><category term="Enterprise Software Platform" /><category term="Mozy" /><category term="Web Deploy" /><category term="SQL Data Compare" /><category term="People Management" /><category term="Internet Explorer" /><category term="Software Quality" /><category term="XSS" /><category term="elmah" /><category term="Entity Framework" /><category term=".NET" /><category term="Speaking" /><category term="Media" /><category term="Silverlight" /><title type="text">Troy Hunt's Blog</title><subtitle type="html">Observations, musings and conjecture about the world of software and technology</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.troyhunt.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.troyhunt.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default?start-index=11&amp;max-results=10&amp;redirect=false&amp;v=2" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>190</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>10</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/TroyHunt" /><feedburner:info uri="troyhunt" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>-33.824008</geo:lat><geo:long>151.251244</geo:long><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by/3.0/" /><feedburner:emailServiceId>TroyHunt</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;AkEEQ307fCp7ImA9WhBaEEU.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-7400430161750349756</id><published>2013-05-20T21:46:00.001+10:00</published><updated>2013-05-21T08:23:22.304+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-21T08:23:22.304+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSL" /><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Your login form posts to HTTPS, but you blew it when you loaded it over HTTP</title><content type="html">&lt;p&gt;Here’s an often held conversation between concerned website user and site owner:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;User:&lt;/strong&gt; “Hey mate, your website isn’t using SSL when I enter my password, what gives?!”&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Owner:&lt;/strong&gt; “Ah, but it &lt;em&gt;posts&lt;/em&gt; to HTTPS so your password is secure! We take security seriously. Our measures are robust.” (and other random, unquantifiable claims)&lt;/p&gt; &lt;p&gt;Loading login forms over HTTP renders any downstream transport layer security almost entirely useless. Rather than just tell you what’s wrong with this, let me show precisely why this is with a site that implements this pattern:&lt;/p&gt;&lt;iframe width="100%" height="480" src="http://www.youtube.com/embed/nm-85-bDP6c?feature=player_embedded" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;p&gt;How’s that for simple?! What people forget about SSL is that &lt;a href="http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html"&gt;it’s not about encryption&lt;/a&gt;. Well that’s one feature of secure sockets, another really essential one is &lt;em&gt;integrity&lt;/em&gt; insofar as it gives us confidence that the website content hasn’t been manipulated. &lt;em&gt;Anything you load over an HTTP connection can be easily changed by a man in the middle&lt;/em&gt; which is why it’s absolutely essential to load those login forms over a secure connection. OWASP is very specific about this in &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;part 9 of their Top 10 web application security risks&lt;/a&gt; and summarise it well in the &lt;a href="https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet"&gt;transport layer protection cheat sheet&lt;/a&gt;:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;The initial login page, referred to as the "login landing page", must be served over TLS. Failure to utilize TLS for the login landing page allows an attacker to modify the login form action, causing the user's credentials to be posted to an arbitrary location.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;It’s not just Woolworths doing this, in fact it’s extremely common and you’ll see it on &lt;a href="http://www.godaddy.com/"&gt;GoDaddy&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;img width="742" height="412" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="GoDaddy login page loaded over HTTP" src="http://lh5.ggpht.com/-R3oO1habrgc/UZoNCGOyApI/AAAAAAAAFVk/f_oRmxXp2HE/image5.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;On &lt;a href="http://www.pandora.com/"&gt;Pandora&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;img width="742" height="412" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Pandora login page loaded over HTTP" src="http://lh6.ggpht.com/-j0-9eUp6Duo/UZoNC8NU1JI/AAAAAAAAFVs/htmQtMnpu04/image8.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;And even on the &lt;a href="http://www.ft.com/"&gt;Financial Times&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;img width="741" height="413" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Financial Times login page loaded over HTTP" src="http://lh5.ggpht.com/-XB1UNVWqNSA/UZoNDirIWgI/AAAAAAAAFV0/xi0Lb_lkJSE/image61.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;I’m calling out these simply because they’re high-profile sites yet they all load the login forms over HTTP and post to HTTPS. Why aren’t they implementing SSL correctly? Most likely convenience; customers can login direct from the homepage and they can have it delivered over HTTP. Mind you Pandora links off to a login page so why they couldn’t just serve that securely to begin with is a bit of a mystery.&lt;/p&gt; &lt;p&gt;So how should it be done? Load the login form over HTTPS, either by linking to a dedicated login page or popping it up in a separate window (although there’s a UX argument against this). Even better, just load the whole site over HTTPS! Yes, there are some barriers to HTTPS across the board (managing certs in web farms, dependencies on assets from third parties, impact on CDNs, etc) but it sure solves the login form issue. Check out &lt;a href="http://www.netflix.com"&gt;Netflix’s approach&lt;/a&gt; – straight into HTTPS, job done!&lt;/p&gt; &lt;p&gt;The other issue with the examples above is that potential manipulation of the content aside, missing HTTPS on the login form leads to exactly the discussion this post opened with – users not believing their credentials are protected. All the messaging we’ve been delivering to website users since the early days of the web about checking for the padlock in the browser address bar goes down the drain because it’s simply not there! There’s no assurance that their credentials will be protected and it’s a real shame to dilute such an important security message.&lt;/p&gt; &lt;p&gt;As for how the exploit in the video works, it’s just a simple &lt;a href="http://fiddler2.com/documentation/KnowledgeBase/FiddlerScript/ModifyRequestOrResponse"&gt;Fiddler script&lt;/a&gt; to inject the keylogger before the body tag closes off. The keylogger itself is &lt;a href="https://code.google.com/p/javascript-keylogger/"&gt;over on Google Code&lt;/a&gt;, the only code I wrote to incorporate it was the script tags you saw at the end of the video and the “Hack Yourself” website which receives the logged keys. It really is that simple.&lt;/p&gt; &lt;p&gt;Whilst Fiddler is good for demonstration purposes, clearly an actual weaponised attack would work differently but the principle is the same: When unencrypted traffic passes through a node on the network – NIC, ethernet cable, router, proxy, ISP, etc. – it may be observed or manipulated by an attacker. This isn’t theoretical, there are many precedents such as &lt;a href="http://www.thetechherald.com/articles/Tunisian-government-harvesting-usernames-and-passwords/12429/"&gt;the Tunisian government harvesting Facebook credentials en mass&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;This is all a bit odd really, I mean these sites have gone to the effort of implementing &lt;em&gt;some&lt;/em&gt; SSL but then blown it by loading those login forms over HTTP. As we saw with Woolworths, posting over a secure connection is completely useless if there’s no integrity in the login form itself, an attacker may already have the credentials by then if the connection is compromised which is the very risk they all implemented SSL to protect from in the first place!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/2MOCxoW2JyE" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7400430161750349756?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7400430161750349756?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/2MOCxoW2JyE/your-login-form-posts-to-https-but-you.html" title="Your login form posts to HTTPS, but you blew it when you loaded it over HTTP" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/nm-85-bDP6c/default.jpg" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/your-login-form-posts-to-https-but-you.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUAQHwyeyp7ImA9WhBbF0k.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-4995890629154816184</id><published>2013-05-16T06:34:00.001+10:00</published><updated>2013-05-17T09:17:21.293+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-17T09:17:21.293+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><category scheme="http://www.blogger.com/atom/ns#" term="ASafaWeb" /><title>Hack yourself first – how to go on the offence before online attackers do</title><content type="html">&lt;p&gt;The unfortunate reality of the web today is that&lt;strong&gt;&lt;em&gt; you’re going to get hacked&lt;/em&gt;&lt;/strong&gt;. Statistically speaking at least, the odds of you having a website without a serious security risk are very low – 14% according to &lt;a href="https://blog.whitehatsec.com/the-state-of-web-security/#.UY77SrVTDL9"&gt;WhiteHat’s State of Web Security&lt;/a&gt; report from a couple of weeks ago. Have enough websites for long enough (as many organisations do), and the chances of you getting out unscathed aren’t real good.&lt;/p&gt; &lt;p&gt;There’s this great TEDx talk by Jeremiah Grossman titled &lt;a href="http://tedxtalks.ted.com/video/TEDxMaui-Jeremiah-Grossman-Hack"&gt;Hack Yourself First&lt;/a&gt; where he talks about the importance of actively seeking out vulnerabilities in your own software before the evildoers do it for you. In Jeremiah’s &lt;a href="http://jeremiahgrossman.blogspot.com.au/2012/01/tedxmaui-hack-yourself-first.html"&gt;post about the talk&lt;/a&gt;, he makes a very salient point:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;b&gt;Hack Yourself First &lt;/b&gt;advocates&lt;b&gt; &lt;/b&gt;building up our cyber-offense skills, and focusing these skills inward at ourselves, to find and fix security issues before the bad guys find and exploit them.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;I love this angle – &lt;strong&gt;&lt;em&gt;the angle that empowers the individual to go out and seek out risks in their own assets&lt;/em&gt;&lt;/strong&gt; – as it’s a far more proactive, constructive approach than the one we so often see today which is the “after it breaks, I’ll fix it” approach. Perhaps that’s not always a conscious decision but it all too often turns out to be the case. It also advocates for the folks writing our apps to develop the skills required to break them which is a big part of what I’ve been advocating for some time now and features heavily in many posts on this blog as well as throughout &lt;a href="http://pluralsight.com/training/Courses/TableOfContents/owasp-top10-aspdotnet-application-security-risks"&gt;the Pluralsight training I recently released&lt;/a&gt;. If developers do not understand the risk – I mean &lt;em&gt;really&lt;/em&gt; understand it to the point where they know how to exploit it – then you’re fighting an uphill battle in terms of getting them to understand the value of secure coding.&lt;/p&gt; &lt;p&gt;It’s not just the dedicated security folks talking about hacking yourself first. The other day I was listening to &lt;a href="http://hanselminutes.com/369/wordpress-and-internet-security-with-kellep-charles"&gt;Scott Hanselman talking about WordPress security on his podcast&lt;/a&gt; and he made the following point:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;I know when I’m writing code I’m not thinking about evil, I’m just trying to think about functionality.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Which of course is perfectly naturally for most developers – we build stuff. &lt;em&gt;Other people&lt;/em&gt; break stuff! But he goes on to say:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;When was the last time I sat down and spent a day or a week trying to break my site?&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;And we’re back to hacking yourself first or in other words, &lt;strong&gt;&lt;em&gt;making a concerted attempt to find vulnerabilities in your own code before someone else does.&lt;/em&gt;&lt;/strong&gt; As Jeremiah referred to it, &lt;strong&gt;&lt;em&gt;building up cyber-offense skills for developers&lt;/em&gt;&lt;/strong&gt;. Developing the ability to detect these risks is easy once you know what to look for, in fact many of them are staring you right in the face when you browse a website and that’s what I want to talk about here today.&lt;/p&gt; &lt;p&gt;Let me share my top picks of website security fundamentals that you can check on any site right now &lt;em&gt;&lt;strong&gt;without doing anything that a reasonable person would consider “hacking”.&lt;/strong&gt;&lt;/em&gt; I make this point for two reasons: firstly, you really don’t want to go messing up things in your own live site and testing for risks such as SQL injection has every chance of doing just that if a risk is present. The other reason is that by picking non-invasive risks you can assess them on &lt;em&gt;other peoples’&lt;/em&gt; sites. I’ll come back to why I’m saying this and the context it can be used in at the end of this post, the point is that these are by no means malicious tests, think of them as the gateway drug to identifying more serious risks.&lt;/p&gt; &lt;p&gt;This is going to be a lengthy one so let me give you a little index to get you started:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="#LackOfTls"&gt;Lack of transport layer protection for sensitive data&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#InsecureLogin"&gt;Loading login forms over an insecure channel&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#SecureCookies"&gt;Secure cookies&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#MixedModeHttps"&gt;Mixed mode HTTP and HTTPS&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#Xss"&gt;Cross Site Scripting (XSS)&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#PasswordReminders"&gt;Password reminders via email&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#PasswordStorage"&gt;Insecure password storage&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#PasswordRules"&gt;Poor password entropy rules&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#PasswordDos"&gt;Denial of service via password reset&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#HttpOnly"&gt;HTTP only cookies&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#InternalErrors"&gt;Internal server error messages&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#RobotsTxt"&gt;Path disclosure via robots.txt&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#HtmlSource"&gt;Sensitive data leakage via HTML source&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#ParameterTampering"&gt;Parameter tampering&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#Clickjacking"&gt;Clickjacking and the X-Frame-Options header&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#Csrf"&gt;Cross Site Request Forgery (CSRF)&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Remember, every one of these is remotely detectable and you can find them in any website with nothing more than a browser. They’re also web platform agnostic so everything you read here is equally relevant to ASP.NET as it is PHP as it is Java – there are no favourites here! I’m going to draw on lots of examples from previous posts and live websites to bring this back down to earth and avoid focussing on theory alone. Let’s get into it.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;h4&gt;&lt;a name="LackOfTls"&gt;&lt;/a&gt;1. Lack of transport layer protection for sensitive data&lt;/h4&gt; &lt;p&gt;We’ll start off one that’s easy to observe and manifests itself in several different ways. When we talk about HTTPS, we’re talking about a secure transport channel and as I’ve written before, &lt;a href="http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html"&gt;it’s about more than just encryption&lt;/a&gt;. In fact HTTPS gives us assurance of identity (we know who we’re connecting to), it ensures data integrity (we know the content hasn’t been modified) and finally, it gives us privacy (the data is encrypted and can’t be read by others).&lt;/p&gt; &lt;p&gt;Observing HTTPS is simple as it’s right up there in the address bar:&lt;/p&gt; &lt;p align="left"&gt;&lt;img width="753" height="223" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="A website with an HTTPS scheme" src="http://lh5.ggpht.com/-KXbAIQyX2KY/UZPxEywSweI/AAAAAAAAFSs/PI0Kzf7IJFY/image51.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Any time any of those three HTTPS objectives are required – assurance, integrity, privacy – HTTPS needs to be there. There are several common HTTPS-misuse scenarios but clearly the most obvious one is when it simply doesn’t exist at all. &lt;a href="http://www.troyhunt.com/2013/04/5-ways-to-implement-https-in.html"&gt;We saw this recently with Top CashBack&lt;/a&gt; where they allowed for registration – including password transmission – without any transport layer protection whatsoever:&lt;/p&gt; &lt;p&gt;&lt;img title="" alt="Registration page on Top CashBack without HTTPS" src="http://lh5.ggpht.com/-xVgTkcgGhzE/UVv9kxVCDVI/AAAAAAAAFFk/Mgxp6eRYhGw/image7.png?imgmax=800"&gt;&lt;/p&gt; &lt;p&gt;Confidential information such as bank account info, passwords and other data which should not be publicly accessible &lt;em&gt;must be sent over HTTPS&lt;/em&gt;. Failure to do this opens up the requests to interception and eavesdropping by a third party at many, many points in the communication chain. Have a read of my post on &lt;a href="http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html"&gt;The beginners guide to breaking website security with nothing more than a Pineapple&lt;/a&gt; if you’re not quite sure how that might be possible.&lt;/p&gt; &lt;h4&gt;&lt;a name="InsecureLogin"&gt;&lt;/a&gt;2. Loading login forms over an insecure channel&lt;/h4&gt; &lt;p&gt;As &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;OWASP talks about in part 9 of the 10&lt;/a&gt;, HTTPS is about more than just “do you or don’t you have it”, it’s about doing it properly. Indeed this is why they refer to it as “&lt;em&gt;insufficient&lt;/em&gt; transport layer protection”. If a page isn’t loaded over HTTPS then you have no confidence in the integrity of it. In the aforementioned link, I pointed out how &lt;a href="http://www.thetechherald.com/article.php/201101/6651"&gt;the Tunisian government had harvested Facebook credentials&lt;/a&gt; because the logon form could be loaded over HTTP. This meant that the state run ISPs could inject their own script into the page to siphon off credentials on submit. Nasty.&lt;/p&gt; &lt;p&gt;Detecting insufficient use of HTTPS is easy – you won’t see the HTTPS scheme in the address bar! If you see a logon form and the address starts with http:// then that’s wrong. Here’s an example courtesy of Singapore Airlines:&lt;/p&gt; &lt;p&gt;&lt;img width="880" height="188" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Singapore Airlines loading the login form over HTTP" src="http://lh4.ggpht.com/--KiZjHzZkOI/UZPxFneG5NI/AAAAAAAAFS0/-aO7S_HgBC0/image9.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;This may look the same as the previous section but here’s the difference:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;form &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="headerLoginForm" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;action&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="https://www.singaporeair.com/kfHeaderLogin.form" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;method&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="post" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;autocomplete&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="off"&amp;gt;&lt;/span&gt;&lt;/pre&gt;It &lt;em&gt;posts&lt;/em&gt; to an HTTPS path. Strictly speaking, the credentials &lt;em&gt;are&lt;/em&gt; encrypted when they’re posted but by then it’s too late – the login form has already been loaded over an insecure channel and an attacker has already (potentially) injected their own keylogger into the page. 
&lt;p&gt;On occasion, you’ll also see a form &lt;em&gt;loaded into an iframe&lt;/em&gt; within an HTTP page. The problem, of course, is we come back to integrity again: there is no guarantee that the HTTP page that embeds the iframe hasn’t been manipulated. Sure, when everything goes just right then the login form is loaded from a secure server, but when it doesn’t then you end up with an attacker loading their own login form that looks just like the real one and the victim is none the wiser.&lt;/p&gt;
&lt;h4&gt;&lt;a name="SecureCookies"&gt;&lt;/a&gt;3. Secure cookies&lt;/h4&gt;
&lt;p&gt;The thing about HTTP is that it’s stateless which means that each request is a new connection totally independent of previous requests. To maintain state (i.e. some knowledge about the user and their previous activities on the site), we most commonly use cookies and one of the most common uses of cookies is that after logging on, we set what’s referred to as an “auth cookie”. The auth cookie is verification that the user has indeed successfully logged on.&lt;/p&gt;
&lt;p&gt;Now, if an attacker can obtain that auth cookie then they can impersonate the victim simply be sending it in a request to the target site. I showed how this works in &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;part 9 of the OWASP Top 10 for .NET developers&lt;/a&gt; where I very easily sniffed out an auth cookie from a public network and hijacked the session. Consequently, &lt;em&gt;all authenticated requests must be made over an HTTPS connection&lt;/em&gt;. If you can load a page that displays personal information &lt;em&gt;while authenticated&lt;/em&gt; and the address starts with http:// then that’s almost certainly wrong.&lt;/p&gt;
&lt;p&gt;For example, take a look at Qantas:&lt;/p&gt;
&lt;p&gt;&lt;img width="880" height="429" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Qantas sending auth cookies over HTTP" src="https://lh6.googleusercontent.com/-wKiY9HvSwJk/UZVoYYOj85I/AAAAAAAAFVM/glXm5msrdFU/s800/image13.png" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Get your hands on that auth cookie and suddenly you’re viewing my travel history, booking flights on my behalf, buying stuff with my frequent flyer points and so on and so forth.&lt;/p&gt;
&lt;p&gt;The fix is easy and twofold: Firstly, you obviously don’t want to be loading pages over HTTP which need to show personal info once you’ve logged in, that’s quite clear. The other thing is that those auth cookies need to be flagged as “secure”. I wrote about this in detail recently in the post titled &lt;a href="http://www.troyhunt.com/2013/03/c-is-for-cookie-h-is-for-hacker.html"&gt;C is for cookie, H is for hacker – understanding HTTP only and Secure cookies&lt;/a&gt; but in short, cookies have an attribute called “secure” which when set disallows the browser from sending them over an insecure connection. Here’s what Qantas’ cookies look like in Chrome’s developer tools after I've logged in:&lt;/p&gt;
&lt;p&gt;&lt;img width="750" height="303" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Qantas with no secure cookies after authenticating" src="http://lh4.ggpht.com/-4fJw5m30lxo/UZPxHlqCD6I/AAAAAAAAFTE/_Wl0ovCD0_o/image6.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;No secure cookies! Some of them shouldn’t be because they relate to browsing habits outside of my authenticated session, but some of them &lt;em&gt;definitely&lt;/em&gt; should be and that includes the multiple auth cookies that are passing my frequent flyer account number around.&lt;/p&gt;
&lt;h4&gt;&lt;a name="MixedModeHttps"&gt;&lt;/a&gt;4. Mixed mode HTTP and HTTPS&lt;/h4&gt;
&lt;p&gt;Continuing with the HTTPS theme, another improper implementation is when a page loaded securely over HTTPS then embeds content &lt;em&gt;insecurely&lt;/em&gt; over HTTP. This was &lt;a href="http://www.troyhunt.com/2012/07/lessons-in-website-security-anti.html"&gt;one of the many (many, many) things that Tesco got wrong&lt;/a&gt; as it means you present your users with a rather disconcerting message like this:&lt;/p&gt;
&lt;p align="left"&gt;&lt;img alt="Mixed content warning from Chrome" src="http://lh4.ggpht.com/-d9fbOOGyKdg/UBY3CrV7vlI/AAAAAAAADy8/xbI5icswaxo/SNAGHTML6d29c03.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;That’s pretty clear – “Don’t load”! Not particularly reassuring, but assuming you &lt;em&gt;do&lt;/em&gt; load the page, here’s what you’ll see:&lt;/p&gt;
&lt;p align="left"&gt;&lt;img title="" alt="Tesco's Safe Shopping Guarantee with a security warning" src="http://lh5.ggpht.com/-cprx2-F1DS4/UBY3DCyG4rI/AAAAAAAADzE/KZEBtc9NA5U/SNAGHTML7e92333.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;The usual assurance provided by the HTTPS scheme and the padlock has a great red cross through it. Nasty (particularly on a page designed to convince you of their security!)&lt;/p&gt;
&lt;p&gt;What’s so bad about this? I mean the three HTTPS objectives I outlined earlier – assurance, integrity, privacy – still apply to the page, right? To the page itself as loaded over the wire, yes, but unfortunately things go downhill from there.&lt;/p&gt;
&lt;p&gt;Here’s a scenario: a page is loaded over HTTPS which therefore means an eavesdropper cannot modify the contents. However, that page then embeds JavaScript which is loaded &lt;em&gt;insecurely&lt;/em&gt; over HTTP which means that it &lt;em&gt;can&lt;/em&gt; be intercepted and modified. So that’s just what an attacker does and the modification includes embedding JavaScript to siphon off credentials just like the Tunisian government did earlier. It’s that simple.&lt;/p&gt;
&lt;p&gt;The easiest way to identify mixed mode is just to look for the browser warnings you see above. Different browsers will present the warning in different ways, for example in Internet Explorer:&lt;/p&gt;
&lt;p align="left"&gt;&lt;img width="848" height="57" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Internet Explorer's mixed mode warning" src="http://lh6.ggpht.com/-PCwwhMXghtM/UZPxIKfat_I/AAAAAAAAFTM/x6mAwadA0DY/image5.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;You can also often see more information by clicking on the padlock icon, here’s Chrome (sorry Qantas, I’m calling you on bad security again!):&lt;/p&gt;
&lt;p align="left"&gt;&lt;img width="329" height="591" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Chrome's mixed mode warning" src="http://lh6.ggpht.com/-eNIGLxrfnBs/UZPxIjAg78I/AAAAAAAAFTU/VRWu8G4-JOY/image2.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;But that doesn’t tell you &lt;em&gt;what&lt;/em&gt; was loaded insecurely. To do this, all we need to do is look at the requests made by the browser and the Developer Tools in Internet Explorer (just hit F12) are a great way of doing this. Here I’ve simply looked at the network requests made to load the Qantas website and identified the request that was sent over the HTTP scheme:&lt;/p&gt;
&lt;p align="left"&gt;&lt;img width="848" height="387" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Network view showing insecure request on an HTTPS page" src="http://lh4.ggpht.com/-kOCTdHg6BXk/UZPxJYqvNDI/AAAAAAAAFTc/IDVV3u0B1Ck/image8.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;And there we have it; a single request designed to set a tracking cookie and now you’re being told the whole page can’t be trusted!&lt;/p&gt;
&lt;h4&gt;&lt;a name="Xss"&gt;&lt;/a&gt;5. Cross Site Scripting (XSS)&lt;/h4&gt;
&lt;p&gt;This is the one area where some folks might argue a little exploring is no longer playing nice. However, assuming we’re talking about &lt;em&gt;reflective&lt;/em&gt; XSS (the kind you only see when they payload is passed in via the request) and not &lt;em&gt;persistent&lt;/em&gt; XSS (the kind you put in the database and gets served to everyone), I reckon, in my humble opinion, there’s no harm done assuming you don’t then go out and leverage it in an attack.&lt;/p&gt;
&lt;p&gt;Moving on, you can observe reflective XSS when content such as HTML tags and JavaScript is able to be passed to a page (usually via query string or form post data) and rendered into the markup thus changing the way the page behaves. Take a page such as Billabong’s registration page:&lt;/p&gt;
&lt;p&gt;&lt;img title="" alt="Billabong's registration page" src="http://lh6.ggpht.com/-f__eKBMA66w/UAPqjSQJRJI/AAAAAAAADtc/Klg8YTiJ2hk/SNAGHTML2b29423.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;Now let’s manipulate a few query string parameters and &lt;a href="http://www.troyhunt.com/2012/07/heres-why-we-keep-getting-hacked-clear.html"&gt;the page can be modified to include Bugs Bunny and Miranda Kerr&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img title="" alt="Registration page manipulated by query string parameters" src="http://lh5.ggpht.com/-mbGqPHq5J2I/UAPqlCPdkFI/AAAAAAAADtk/Xv4EzV-2c-I/SNAGHTML60ba894.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;Clearly this is pretty innocuous but it demonstrates that an attacker can modify the page behaviour &lt;em&gt;if they can engineer a victim to click on a carefully crafted link to the site&lt;/em&gt;. That link may rewrite the page contents to something quite different, serve the victim malware or even steal their cookies and hijack their session. There are many, many ways that XSS can be used to do nasty things and the detection of the risk is very simple.&lt;/p&gt;
&lt;p&gt;Usually it takes nothing more than wrapping untrusted data (remember, this is the stuff your users provide to the system), in an italics tag to confirm the presence of XSS. For example, if I search for “Earth-shattering &amp;lt;i&amp;gt;kaboom!&amp;lt;/a&amp;gt;” on a website and it then says “You searched for Earth-shattering &lt;em&gt;kaboom!&lt;/em&gt;”, we have a problem. Instead of correctly output encoding the angle brackets into &amp;amp;lt; and &amp;amp;gt; it has rendered them exactly as provided to the source code and thus changed the actual &lt;em&gt;markup&lt;/em&gt; rather than the &lt;em&gt;content&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;It’s a similar (although arguably more prevalent) problem with untrusted data rendered to JavaScript. What you need to remember is that encoding differs from context to context; you can’t encode angle brackets like you would for HTML, instead they become %3Ci and %3E. Developers often make the mistake of doing this very manually (“if char is &amp;lt; then replace with %3Ci”) which inevitably leads to gaps in the encoding logic so testing a range of different characters often yields results where the obvious ones won’t.&lt;/p&gt;
&lt;h4&gt;&lt;a name="PasswordReminders"&gt;&lt;/a&gt;6. Password reminders via email&lt;/h4&gt;
&lt;p&gt;Nothing of a sensitive nature goes into email, it’s that simple. You should never, ever receive an email &lt;a href="http://www.troyhunt.com/2012/05/everything-you-ever-wanted-to-know.html"&gt;like this&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Password sent in plain text by usoutdoor.com" src="http://lh4.ggpht.com/-tA8lYIl6je4/T7rAbzBq9TI/AAAAAAAADiU/KxAENou4oM4/SNAGHTML22b5d853.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;There are a couple of reasons why and the first one is that email is simply not a secure transport mechanism. Whilst it’s possible to secure the connection to an outbound SMTP server using SSL (SMTPS), there’s a lot that happens downstream from there with no guarantee that transport layer encryption is present on each downstream node. Of course there are options like &lt;a href="http://www.infosecisland.com/blogview/19924-How-to-Encrypt-Your-Email-with-PGP.html"&gt;PGP Email&lt;/a&gt; but I’ve &lt;em&gt;never&lt;/em&gt; seen this used in a password reminder from a website. Ever.&lt;/p&gt;
&lt;p&gt;The other issue is that your mailbox is simply not a secure storage facility. Of course there are many different mail providers with many different implementations but the only safe assumption is not to store sensitive data in there. Websites that email credentials put users at risk not just on their own site, but also on other sites due to the (unfortunate but real) propensity for people to reuse passwords. We’ve seen password reuse exploited before through cases like &lt;a href="http://www.troyhunt.com/2011/01/why-your-apps-security-design-could.html"&gt;the Gawker Acai berry tweets&lt;/a&gt;. It’s a real risk.&lt;/p&gt;
&lt;p&gt;The only suitable way for a website to assist a user who has lost heir password is to provide &lt;a href="http://www.troyhunt.com/2012/05/everything-you-ever-wanted-to-know.html"&gt;a secure password reset feature&lt;/a&gt;. This means emailing a time-limited, single use token that allows a &lt;em&gt;new&lt;/em&gt; password to be set on the account and a confirmation email sent to the user afterwards. That’s a pretty simple mechanism but there are still numerous sites doing the wrong thing and sending the original password in email.&lt;/p&gt;
&lt;h4&gt;&lt;a name="PasswordStorage"&gt;&lt;/a&gt;7. Insecure password storage&lt;/h4&gt;
&lt;p&gt;The previous point around emailing passwords is only possible because passwords are not stored correctly to begin with. Let that just sink in a bit and allow me to repeat: if a website is even &lt;em&gt;able&lt;/em&gt; to email you your password then they’re not satisfactorily protecting it. You’ve got three common ways of storing passwords:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In plain text&lt;/li&gt;
&lt;li&gt;Encrypted&lt;/li&gt;
&lt;li&gt;Hashed&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;The first point is pretty clear – there is no cryptography involved in the storage of the password. One little SQL injection risk let alone disclosure of the database and you’re toast – every password is immediately readable.&lt;/p&gt;
&lt;p&gt;Encryption is at least &lt;em&gt;some&lt;/em&gt; attempt at secure storage but as I’ve often said before, the problem with encryption is &lt;em&gt;decryption&lt;/em&gt;. Once you’re talking encryption you’re talking key management and that’s not something we do well enough, often enough, particularly when it comes to websites (keys in config files, anyone?). What it usually means is multiple points of potential failure when a system is breached.&lt;/p&gt;
&lt;p&gt;The most appropriate means of storing passwords is with a strong hashing algorithm. That doesn’t mean a single hit of MD5 or SHA1 (or any other SHA variant for that matter) and it also doesn’t mean just salting it before it’s hashed. I go into a lot more detail about this in &lt;a href="http://www.troyhunt.com/2012/06/our-password-hashing-has-no-clothes.html"&gt;Our password hashing has no clothes&lt;/a&gt; but in short, we’re often doing hashing wrong and what you really want is a computationally expensive algorithm designed for password cryptography.&lt;/p&gt;
&lt;p&gt;Here’s why this is important:&lt;/p&gt;
&lt;p&gt;&lt;img alt="AMD Radeon HD 7970" src="http://lh3.ggpht.com/-4bZ622nOwfQ/T-jHxFjmZOI/AAAAAAAADrE/dctuT8wO1fE/amd_radeon-hd-79702.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;This is an &lt;a href="http://www.amd.com/us/products/desktop/graphics/7000/7970/Pages/radeon-7970.aspx"&gt;AMD Radeon 7970&lt;/a&gt; consumer-level graphics card. You can buy it for a few hundred bucks and it can crack up to 7.5B hashes per second. Yes, that’s with a “B” so in other words 7,500,000,000. Crikey! Without delving into the nuances of cryptographic hashes here (the “no clothes” post above covers that), the point is that you have to choose the &lt;em&gt;right &lt;/em&gt;hashing algorithm. Cracking is still possible, but what if we could bring that rate down by, say 99.99% then it poses a very different value proposition to an attacker.&lt;/p&gt;
&lt;p&gt;In the context of this post though, there’s a very easy way to tell when a password hasn’t been stored as a hash – you can see it. That’s usually via the previous risk where it’s emailed to you but sometimes it’s also represented in the UI (more on that a little later). Another common way that poor password practices are disclosed is when an operator knows it, for example when you call up for support. Now identity verification is just fine and there are multiple ways to do that, but using the same credentials for web login and customer service verification is fraught with problems, not least of which is the fact that your personal credentials are visible to other humans whether that be by them looking at them in the system or people verbally providing them to operators.&lt;/p&gt;
&lt;p&gt;You start to understand more about why this is a problem when you see &lt;a href="http://www.troyhunt.com/2012/07/what-do-sony-and-yahoo-have-in-common.html"&gt;stats like these&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Reuse of passwords between Sony and Yahoo! Voices" src="http://lh5.ggpht.com/-Qw0LUe_GNPI/UASjduEqn9I/AAAAAAAADv8/-icotccj0l4/Untitled-2%25255B2%25255D.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;When 58% of people are reusing credentials (and many studies will show far higher levels than that), the risk of sloppy password management by a website starts to have much greater reach than just their own site, they’re jeopardising customers’ &lt;em&gt;other&lt;/em&gt; sites because rightly or wrongly, there’s a pretty good chance those credentials have been reused elsewhere.&lt;/p&gt;
&lt;h4&gt;&lt;a name="PasswordRules"&gt;&lt;/a&gt;8. Poor password entropy rules&lt;/h4&gt;
&lt;p&gt;Here is a very simple password fact: the longer it is and the more characters of different types it contains in the most random fashion possible, the better it is.&lt;/p&gt;
&lt;p&gt;Conversely, the more constrained a password is whether that be by length or particular characters or even entire character sets, the more likely it is to be cracked if push comes to shove.&lt;/p&gt;
&lt;p&gt;Consequently, this is bad:&lt;/p&gt;
&lt;p&gt;&lt;img alt="St. George bank not allowing spaces or special characters in the password" src="http://lh3.ggpht.com/_Qbax2DGZEkU/TTP0elXxF4I/AAAAAAAACN0/r7H2VE_Vl60/image71.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;But this is even worse:&lt;/p&gt;
&lt;p&gt;&lt;img alt="ING Direct using a four digit PIN" src="http://lh6.ggpht.com/_Qbax2DGZEkU/TTP0iLRilYI/AAAAAAAACOI/gNcmVgQbEv8/image35.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;These are examples taken from my 2011 post on the &lt;a href="http://www.troyhunt.com/2011/01/whos-who-of-bad-password-practices.html"&gt;Who’s who of bad password practices – banks, airlines and more&lt;/a&gt; where an alarming number of websites were placing arbitrary constraints on passwords. A follow-up post found &lt;a href="http://www.troyhunt.com/2011/03/3-reasons-youre-forced-into-creating.html"&gt;3 major reasons why these constraints exist&lt;/a&gt; and frankly, they’re all pretty weak excuses.&lt;/p&gt;
&lt;p&gt;We need to come back to why this is so important: in the last risk above about password storage I mentioned cracking 7.5B passwords per second with a consumer level graphics card. Now, imagine you bank with ING Direct using a 4 digit password, their database gets breached and the hashed accounts are leaked – the hash is now the only thing between the password being protected and an attacker gaining access to it and using it anywhere it’s still valid, either on the original site or places it’s been reused. An attacker can compute the entire key space of hashes in 1/750,000th of a second. Clearly ING felt this might be a risk so since this post they strengthened their password policy… all the way up to 6 digits, or in other words, 1/7,500th of a second. Your password is toast. But strength increases exponentially so the longer a password becomes and the more characters it contains, the stronger it gets. It’s that simple.&lt;/p&gt;
&lt;p&gt;Constraints of any kind on password fields (short of perhaps just one on a very long length) are just not on – there’s simply no good reason for it today. In fact I also made the point a little while back that &lt;a href="http://www.troyhunt.com/2012/09/do-you-allow-xss-in-your-passwords-you.html"&gt;you should expressly allow XSS in your passwords&lt;/a&gt; – no sanitisation at all! The thing is that per the previous risk on storage, passwords should never be redisplayed in any context anyway so let customers go nuts.&lt;/p&gt;
&lt;h4&gt;&lt;a name="PasswordDos"&gt;&lt;/a&gt;9. Denial of service via password reset&lt;/h4&gt;
&lt;p&gt;Here’s one that you often see gotten wrong: password reset processes that immediately disable the old password. It looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img width="863" height="530" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Aussie Farmers Direct disabling accounts on password reset" src="http://lh4.ggpht.com/-rVLNcy8EnmQ/UZPxKa7TnQI/AAAAAAAAFTk/0Y30Pmfqjgw/image311.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Now that might not &lt;em&gt;seem &lt;/em&gt;too bad, but the problem is that it poses a denial of service risk (there’s also that mixed mode HTTP / HTTPS warning we looked at earlier). Here’s an example: you know someone who uses the &lt;a href="http://aussiefarmers.com.au/"&gt;Aussie Farmers Direct&lt;/a&gt; website and you want to make life a bit hard on them so you reset their password and bingo – they can no longer log in. Now of course they can go and grab the new password from their inbox (or junk mail) and log themselves in again, but they’ll probably want to then change it which adds another layer of inconvenience. This sort of practice &lt;em&gt;can &lt;/em&gt;be used as an attack, for example it can take someone out of the running just before the end of an auction so the impact can extend beyond the realm of just mere inconvenience.&lt;/p&gt;
&lt;p&gt;The correct way to issue a password reset is to send a time-limited, single use token to the recipient. This gives only the legitimate owner the ability to change their password and it does so without breaking the earlier rule of emailing a password that can then be used beyond the reset process. You can read more about this and other aspects of password resets in &lt;a href="http://www.troyhunt.com/2012/05/everything-you-ever-wanted-to-know.html"&gt;Everything you ever wanted to know about building a secure password reset feature&lt;/a&gt;.&lt;/p&gt;
&lt;h4&gt;&lt;a name="HttpOnly"&gt;&lt;/a&gt;10. HTTP only cookies&lt;/h4&gt;
&lt;p&gt;People often don’t think a lot about cookies but those little bytes of information in the header have hidden depths. They can also be pretty damn important to the security of the website and thus need to be appropriately protected. For example, it’s usually cookies that are used to persist a user’s authenticated state across requests. If an attacker can get hold of that cookie then they can hijack the session or in other words, immediately take on the identity of the victim.&lt;/p&gt;
&lt;p&gt;I wrote about this recently in &lt;a href="http://www.troyhunt.com/2013/03/c-is-for-cookie-h-is-for-hacker.html"&gt;C is for cookie, H is for hacker – understanding HTTP only and Secure cookies&lt;/a&gt;, the latter part of which we looked at in the third risk in this post. For now though, the important thing to understand is that cookies may have an attribute set that is referred to as “HTTP only” which you can easily view from any tools which can inspect cookies such as Internet Explorer’s developer tools:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Test cookies set in the response" src="http://lh5.ggpht.com/-eiA7tf93r2Q/UVCy0MeM9_I/AAAAAAAAFD0/YUW-oxRVaH8/image9.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;Here’s the party trick that HTTP only cookies have: they can’t be read by JavaScript on the client. Keeping in mind that there &lt;em&gt;are&lt;/em&gt; cases where you want JavaScript to be able to access cookies, in many situations it’s only the &lt;em&gt;server&lt;/em&gt; that needs to access those cookies. For example, when you logon to a website it’s usually an auth cookie that’s returned by the server and then automatically sent back again with each new request. This is what enables the website to see that you’re still authenticated.&lt;/p&gt;
&lt;p&gt;This is what also enables session hijacking; if an attacker can get that cookie then it’s all over red rover – they can now become you. A popular means of session hijacking is to leverage an exploit such as XSS to send the cookies to an attacker. For example, an attacker may socialise a link which causes JavaScript to be embedded in the page which accesses document.cookie and makes a request to a resource which they own whilst passing the cookies along in the query string.&lt;/p&gt;
&lt;p&gt;When we look at the response after logging into a site which &lt;em&gt;doesn’t&lt;/em&gt; properly protect cookies with the HTTP only flag – such as &lt;a href="http://aussiefarmers.com.au/"&gt;Aussie Farmers Direct&lt;/a&gt; (again) – we see something like this:&lt;/p&gt;
&lt;p&gt;&lt;img width="730" height="71" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Aussie Farmers Direct with a non-HTTP Only session cookie" src="http://lh4.ggpht.com/-iqS6AAcvZa4/UZPxLeVD7cI/AAAAAAAAFTs/ZpbHNomKKU8/SNAGHTML809c503.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;What we can see here is that the PHPSESSID cookie &lt;em&gt;is not&lt;/em&gt; flagged as HTTP only. All it would take is one little XSS risk to be combined with this and things would start to get very ugly.&lt;/p&gt;
&lt;h4&gt;&lt;a name="InternalErrors"&gt;&lt;/a&gt;11. Internal error messages&lt;/h4&gt;
&lt;p&gt;I’ve written a bunch about disclosure of internal error messages in the past. For example, there was &lt;a href="http://www.troyhunt.com/2012/04/graphic-demonstration-of-information.html"&gt;Kogan with their massive leakage&lt;/a&gt; last year:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Django debug info from kogan.com" src="http://lh5.ggpht.com/-Bz4FYWQSo0c/T31FBiEhenI/AAAAAAAADaQ/GINZrbSMYaA/SNAGHTMLa086a2b%25255B3%25255D.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;This included everything from framework versions to code locations to database credentials. This was running on Django but I’ve written about equally bad practices in ASP.NET, such as the &lt;a href="http://www.troyhunt.com/2012/01/aspnet-session-hijacking-with-google.html"&gt;masses of exposed ELMAH logs that are easily discoverable via Google&lt;/a&gt;. There were 11,000 easily discoverable ELMAH logs exposing authentication cookies when I wrote about this early last year:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Google search for inurl:elmah.axd ASPXAUTH" src="http://lh4.ggpht.com/-2UNc5DbxpMc/Twp-nBohNbI/AAAAAAAADGY/lHx3OC0P6xQ/SNAGHTML297a5d3.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;It’s, uh, kinda gotten a bit worse since then:&lt;/p&gt;
&lt;p&gt;&lt;img width="620" height="413" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="44,300 ELMAH logs in a Google search" src="http://lh6.ggpht.com/--wSKS0u_54U/UZPxMbEli-I/AAAAAAAAFT0/TWdyaMCfYwQ/SNAGHTML5269fc23.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Of course the problem with internal error messages is that they can give an attacker a &lt;em&gt;massive &lt;/em&gt;head start when it comes to compromising a vulnerable website. Naturally this will depend on the nature of the data exposed in the error, but in a case like those ELMAH auth cookies it makes session hijacking an absolute cinch. Other examples of exposed information can include anything up to and including connection strings to database servers that are publicly accessible. Ouch!&lt;/p&gt;
&lt;p&gt;How you tackle this will differ by framework but the simple message that’s relevant across the stacks is this: &lt;em&gt;keep internal errors internal!&lt;/em&gt; Configure your app to return generic error messages that don’t leak any info about how the app is put together. It’s not only more secure, it’s a whole lot more user friendly.&lt;/p&gt;
&lt;p&gt;In terms of detection, there are enough times where an error message will just reveal itself during the organic use of the website. That was the case with Kogan above but you can often cause an internal error simply by a minor change to the request structure. For example, replacing “id=123” with “id=abc” and an exception is raised when the parameter is attempted to be converted to an integer without the appropriate error handling. Or simple appending an illegal character to a URL – an angle bracket will often cause an exception.&lt;/p&gt;
&lt;h4&gt;&lt;a name="RobotsTxt"&gt;&lt;/a&gt;12. Path disclosure via robots.txt&lt;/h4&gt;
&lt;p&gt;Everybody know what &lt;a href="http://en.wikipedia.org/wiki/Robots_exclusion_standard"&gt;robots.txt&lt;/a&gt; does? Here’s a quick recap: when search engines come knocking to discover what’s on a website so that it can be indexed and made easily searchable, &lt;em&gt;in theory&lt;/em&gt; the search engine will look for a file named robots.txt in the root of the site. This file contains information which complies with the Robots Exclusion Standard and the idea is that it helps search engines with both what to index and &lt;em&gt;what not&lt;/em&gt; to index.&lt;/p&gt;
&lt;p&gt;The reason why the “what not to index” bit is important in the context of web security is that often developers will use the “Disallow” syntax to prohibit the search engine from making information on their site discoverable. For example, they may have some sensitive documents or administrative features they don’t want people stumbling across via carefully crafted Google searches (everyone is aware of &lt;a href="http://www.exploit-db.com/google-dorks/"&gt;Google Dorks&lt;/a&gt;, right?) so they politely ask the search engine not to crawl that particular piece of content.&lt;/p&gt;
&lt;p&gt;The problem is that you end up with sites like GoGet and &lt;a href="http://www.goget.com.au/robots.txt"&gt;their robots.txt file&lt;/a&gt; which looks just like this:&lt;/p&gt;&lt;pre&gt;User-agent: * 
Disallow: /administrator/
Disallow: /cache/
Disallow: /components/
Disallow: /editor/
Disallow: /help/
Disallow: /images/
Disallow: /includes/
Disallow: /language/
Disallow: /mambots/
Disallow: /media/
Disallow: /modules/
Disallow: /templates/
Disallow: /installation/
Disallow: /bookings/secret/&lt;/pre&gt;
&lt;p&gt;See the last one – “/bookings/secret/”? The problem, of course, is that just naming a path “secret” does not make it so! Now GoGet isn’t immediately disclosing anything of risk (although they might want to review the earlier point on insufficient use of TLS), but there are many examples where that isn’t the case.&lt;/p&gt;
&lt;p&gt;The thing about robots.txt is that it very often gives an attacker a starting point. It’s one of the first things to look for when trying to understand how a site is put together and where features that are intended to be private might exist. But most importantly, a disallow declaration in the robots.txt is &lt;em&gt;never &lt;/em&gt;a substitute for robust access controls. Regardless of how much obfuscation you throw at a path, you absolutely, positively need to implement access controls and work on the assumption that &lt;em&gt;all URLs are public URLs&lt;/em&gt;.&lt;/p&gt;
&lt;h4&gt;&lt;a name="HtmlSource"&gt;&lt;/a&gt;13. Sensitive data leakage via HTML source&lt;/h4&gt;
&lt;p&gt;Everyone knows how to view the HTML source of a page, right? It’s always a variation of the classic right-click –&amp;gt; view source or for the keyboard ninjas, CTRL-U in browsers such as Chrome and Firefox. But of course that’s not the only way to view source, you can always proxy the traffic through tools like &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt; or &lt;a href="http://www.charlesproxy.com/"&gt;Charles&lt;/a&gt; and inspect the page contents at that point. The point is that HTML source, for all intents and purposes, is readily viewable and &lt;em&gt;not&lt;/em&gt; the place to store any sensitive data. Yet we have examples such as &lt;a href="http://www.mydish.co.uk/"&gt;MyDish.co.uk&lt;/a&gt; doing this in the browser:&lt;/p&gt;
&lt;p&gt;&lt;img width="458" height="216" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="My Dish web interface showing a password field" src="http://lh3.ggpht.com/-ch9gRhxdEcM/UZPxNG37vGI/AAAAAAAAFT8/EPym8DMfz9I/image311111.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Which is driven by this in the source:&lt;/p&gt;
&lt;p&gt;&lt;img width="578" height="154" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="My Dish source code with the password re-typed" src="http://lh6.ggpht.com/-zqpbaO4vqPU/UZPxNtJYxvI/AAAAAAAAFUE/lAt1UduvyeA/image611.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Now this is clearly just crazy stuff – there’s absolutely no reason to pre-populate this field and of course just the fact they &lt;em&gt;can&lt;/em&gt; also means that they’re not storing the password correctly as a secure hash to begin with. Whilst this risk only discloses &lt;em&gt;your own&lt;/em&gt; password, if an attacker could hijack the session then they could easily grab it from the HTML source (and then leverage everywhere it’s been reused on other sites).&lt;/p&gt;
&lt;p&gt;This is a rather extreme example but I’ve seen many, many others which expose data they shouldn’t in the source. Just viewing the source code of various pages in a site can disclose a &lt;em&gt;huge&lt;/em&gt; amount of information about how it’s put together and often disclose risks in the design. On many occasions now I’ve seen comments in the source which disclose varying levels of information about the internal implementation of the source. In fact commenting of code itself can be very revealing, particularly if it points to paths that may not be properly secured or contain their own vulnerabilities.&lt;/p&gt;
&lt;p&gt;Another angle is the nature of the information disclosed through source in the legitimate function of the website. On occasion I’ve seen SQL statements in hidden fields which not only discloses the structure of the database but also opens the site up to parameter tampering and potentially SQL injection. Speaking of which…&lt;/p&gt;
&lt;h4&gt;&lt;a name="ParameterTampering"&gt;&lt;/a&gt;14. Parameter tampering&lt;/h4&gt;
&lt;p&gt;Here’s an interesting one – when you &lt;a href="http://www.actionrecruitment.ie/search.html?module=next_results&amp;amp;basic_query=SELECT%20*%20,%20'1'%20AS%20Score%20FROM%20posting%20WHERE%20%20%20%20(%20CategoryID%20LIKE%20'%')%20%20%20ORDER%20BY%20Title%20&amp;amp;start=10"&gt;search Action Recruitment for jobs&lt;/a&gt; you’ll notice a URL a little like this:&lt;/p&gt;&lt;pre&gt;http://www.actionrecruitment.ie/search.html?module=next_results&amp;amp;basic_query=SELECT%20*%20,%20'1'%20AS%20Score%20FROM%20posting%20WHERE%20%20%20%20(%20CategoryID%20LIKE%20'%')%20%20%20ORDER%20BY%20Title%20&amp;amp;start=10&lt;/pre&gt;
&lt;p&gt;Can anyone see the problem with that? Let me break out the important bit and remove the URL encoding:&lt;/p&gt;&lt;pre&gt;SELECT * , '1' AS Score FROM posting WHERE    ( CategoryID LIKE '%')   ORDER BY Title&lt;/pre&gt;
&lt;p&gt;That’s right, you’re looking at SQL statements embedded in the query string. For the sake of posterity should the site design change in the future, here’s what that page looks like right now:&lt;/p&gt;
&lt;p&gt;&lt;img width="791" height="223" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Action Recruitment with SQL in the query string" src="http://lh4.ggpht.com/-HeZP1syXpu0/UZPxOU__0oI/AAAAAAAAFUM/7wOp7w3_4Gg/image3.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;The problem here is that should this site indeed just take the query string parameter and execute it as an entire SQL statement, well, it actually poses two problems. The first is that tampering can produce results outside the intended function of the app. This could be minor – such as returning more records – or more significant such as returning &lt;em&gt;someone else’s&lt;/em&gt; records. The second issue is that it could be at risk of SQL injection if manipulating the parameter changes the structure or behaviour of the database query itself. This is where things become a lot less grey and a lot more black…&lt;/p&gt;
&lt;p&gt;The intention of this post is to draw attention to detecting risks which don’t step into the realm of what most reasonable people would deem “hacking”. Probing for SQL injection flaws very quickly descends into that realm and that’s not somewhere you want to go anywhere near on someone else’s site if you’re trying to play nice.&lt;/p&gt;
&lt;h4&gt;&lt;a name="Clickjacking"&gt;&lt;/a&gt;15. Clickjacking and the X-Frame-Options header&lt;/h4&gt;
&lt;p&gt;A few days ago I wrote about &lt;a href="http://www.troyhunt.com/2013/05/clickjack-attack-hidden-threat-right-in.html"&gt;Clickjack attack – the hidden threat right in front of you&lt;/a&gt; and showed just how easily a clickjacking attack can be launched. In essence, this attack boils down to placing the target site in an iframe and whacking the opacity of it down to zero so that the site underneath that shows through. The underlying site is then structured to show tempting links which line up perfectly underneath the target site so whilst the victim &lt;em&gt;thinks&lt;/em&gt; they’re clicking on a link on the hoax site, they’re actually clicking a hidden link on top of that which is served by the victim site above it.&lt;/p&gt;
&lt;p&gt;Imagine this scenario:&lt;/p&gt;
&lt;p&gt;&lt;img title="" alt="Win an iPad website showing the banking website on top of it" src="http://lh4.ggpht.com/-SrWIMhNll5c/UZC0CsQ192I/AAAAAAAAFRs/IqxQsazDETo/image11.png?imgmax=800"&gt;&lt;/p&gt;
&lt;p&gt;This image shows the victim site sitting at 50% opacity (it would normally be at 0% therefore hidden), so you get a sense of how everything lines up. The impact of the clickjacking attack is commensurate with the action being performed by a simple click; it could range from a social media endorsement such as a “like” all the way through to performing a banking action.&lt;/p&gt;
&lt;p&gt;The mitigation is simple to implement and also simple to observe, you just need to look for the response header. By example, here’s what you’ll see on &lt;a href="https://asafaweb.com"&gt;ASafaWeb&lt;/a&gt; (my own site we’ll come back to shortly) using the Chrome developer tools:&lt;/p&gt;
&lt;p&gt;&lt;img width="661" height="533" title="SNAGHTML50f59ec" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="SNAGHTML50f59ec" src="http://lh3.ggpht.com/-H_To_pianhY/UZPxO7kg2NI/AAAAAAAAFUU/GCfiiVHOKHg/SNAGHTML50f59ec3.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;As you’ll read in the post above, there are a few different possible values for this header, the main thing is that unless you’ve got a good reason to allow the site to be embedded in a frame absolutely anywhere, there should be an X-Frame-Options header returned along with each request. You can also &lt;a href="https://asafaweb.com"&gt;check this with ASafaWeb&lt;/a&gt;, this test has been added to the software just this week.&lt;/p&gt;
&lt;h4&gt;&lt;a name="Csrf"&gt;&lt;/a&gt;16. Cross Site Request Forgery (CSRF)&lt;/h4&gt;
&lt;p&gt;In many ways HTTP is quite clever. For example, you can authenticate to a website and then in unison with the web browser it will happily send your auth cookie back to the website with each request automagically.&lt;/p&gt;
&lt;p&gt;In other ways HTTP is rather foolish. For example, you can authenticate to a website and then in unison with the web browser it will happily send your auth cookie back to the website with each request automagically. Oh – even when you didn’t actually intend to make the request!&lt;/p&gt;
&lt;p&gt;It’s that last bit that CSRF exploits. The risk here is that if an attacker can trick a victim’s browser into making a request to a website they’re already authenticated to &lt;em&gt;and &lt;/em&gt;modify the parameters of the request to do the attacker’s bidding, we might have a bit of a problem. For example, if a banking website allows an authenticated user to make a request such as “/transfer/?amount=500&amp;amp;to_account=1234567890” and it actually impacts a change (such as transferring money), then we have a CSRF risk. That’s a very simplistic example and I do go into a lot more detail in &lt;a href="http://www.troyhunt.com/2010/11/owasp-top-10-for-net-developers-part-5.html"&gt;part 5 of the OWASP Top 10&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let me give you a real world example. When you’re logged in to Toys R Us, if you make a POST request like this:&lt;/p&gt;&lt;pre&gt;http://www.toysrus.com.au/scripts/additemtoorder.asp&lt;/pre&gt;
&lt;p&gt;And you send the following form data:&lt;/p&gt;&lt;pre&gt;productid: 1675220
quantity: 1
injectorder: true
&lt;/pre&gt;
&lt;p&gt;You will add one of these to your cart:&lt;/p&gt;
&lt;p&gt;&lt;img width="343" height="253" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Lego Star Wars X-wing model" src="http://lh6.ggpht.com/-0kI37uUxdiI/UZPxQdEtGMI/AAAAAAAAFUc/Zt0A9oAqkDY/image31.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Now of course there is nothing wrong with a Lego Star Wars X-wing model, &lt;em&gt;assuming you actually wanted one!&lt;/em&gt; The problem is that all an attacker needs to do is trick your browser into reproducing the same request pattern – just the URL and form data – and you’ll have one of these in your cart. This execution of this can be extremely simple, for example, visit an attacker’s page where there are hidden form fields reconstructing those three pieces of data I showed earlier on and set the action to the URL which adds the item to the cart. Now give them a big “Win free stuff” button (which is how the attacker lured them in to begin with) and badaboom – they’ll submit the request &lt;em&gt;along with their authentication cookie&lt;/em&gt; to the Toys R Us website and have a shiny new Leo model in their cart! The attacker might even target a hidden frame so that the victim can’t see the response from the Toys R US server.&lt;/p&gt;
&lt;p&gt;That’s a very simplistic example in a low-risk scenario. There are more complex executions and obviously more risky scenarios and they’re possible because the CSRF attack is able to reproduce the appropriately structured HTTP request which, of course, also sends off the authenticated user’s cookies &lt;em&gt;because that’s just how HTTP works&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The mitigation is detailed in the post I mentioned earlier and it’s all about using an anti-forgery token in the form with a corresponding cookie. If both of these values don’t reconcile when the request is made then it’s considered to be forged. This works because an attacker cannot simply recreate the correct form data without grabbing the token from the website which is unique to the user. The anti-forgery cookie will be sent automatically – that’s fine – but its mate from the form won’t be.&lt;/p&gt;
&lt;p&gt;What’s important in the context of this post though is what a secure request &lt;em&gt;should&lt;/em&gt; look like. Here’s what happens when I logon to ASafaWeb and there are two important bits of info I’ve highlighted:&lt;/p&gt;
&lt;p&gt;&lt;img width="780" height="379" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Anti-forgery token being sent" src="http://lh5.ggpht.com/-0I9SY-QVaDo/UZPxRA3tf4I/AAAAAAAAFUk/-Z_s2baMQ-U/SNAGHTML644d74b63.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;This is the anti-forgery token in both a cookie then further down in the hidden field. This is the way ASP.NET names them, other web platforms may show slightly different names but the point is that the token exists and without it, the request fails. This should be in every location where an inadvertent request could have an adverse impact for the user. If you don’t see it – like on Toys R Us – then a CSRF risk is almost certainly present.&lt;/p&gt;
&lt;h4&gt;&lt;a name="Scorecarding"&gt;&lt;/a&gt;Scorecarding websites with ASafaWeb&lt;/h4&gt;
&lt;p&gt;There’s a lot to remember when securing websites and indeed what’s listed above only even scrapes the surface. However it’s a good starting point and these are all risks that have many precedents of being exploited for an attacker’s gain. They’re also all risks that as I stated from the outset, can be remotely detected without stepping into the evil hacker realm. You can be responsible in detecting these risks.&lt;/p&gt;
&lt;p&gt;I often see tweets like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/DE_Glasgow/status/322653556035448832"&gt;&lt;img width="473" height="201" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="@StartupNomads just set up account &amp;amp; you emailed me my password - are you not aware of security implications of this?" src="http://lh3.ggpht.com/-AIVge5UsKGg/UZPxRgAdH-I/AAAAAAAAFUo/Obj7UvHTg4w/SNAGHTML73357b64.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Clearly this is somewhat of a rhetorical question as it’s very unlikely the culprit is aware of the risk. Moving on, rather than just having people point website owners to a lengthy post covering multiple issues as is the case above, I wanted to provide something more succinct that talks about specific risks then provide further reading from there. Given the sort of risks I’ve outlined throughout this post, I wanted to provide an easy mechanism for assessing, recording and sharing them so here it is – the &lt;a href="https://asafaweb.com/Scorecard"&gt;ASafaWeb Scorecard&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://asafaweb.com/Scorecard"&gt;&lt;img width="814" height="498" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="ASafaWeb scorecard" src="http://lh6.ggpht.com/-BhrdDmdw308/UZPxSYC1g6I/AAAAAAAAFUw/g_cU7GolA6s/image11111%25255B1%25255D.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is very simple mechanism and it works like this: first you enter the URL of the site you’re assessing. Next, for each of the 16 risks outlined above there’s an entry on the ASafaWeb Scorecard along with “Pass” and “Fail” buttons. You then go through and self-assess the site, clicking the appropriate button as you go (you can click the same button again to de-select the risk). &lt;/p&gt;
&lt;p&gt;This &lt;em&gt;is not &lt;/em&gt;a dynamic analysis tool like the ASafaWeb scanner is and that’s simply because for the most part you need to be a human to detect these issues. For example, you actually need to do a password reset and assess the resulting email in order to discover that it’s not being stored satisfactorily.&lt;/p&gt;
&lt;p&gt;As you complete the assessment you’ll see the results appear in a hash in the URL. What this means is that a completed assessment has a URL something like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://asafaweb.com/Scorecard#url=notasafaweb.apphb.com&amp;amp;LackOfTls=Fail&amp;amp;InsecureLogin=Fail&amp;amp;SecureCookies=Fail&amp;amp;MixedModeHttps=Pass&amp;amp;Xss=Fail&amp;amp;PasswordReminders=Pass&amp;amp;PasswordStorage=Pass&amp;amp;PasswordRules=Pass&amp;amp;PasswordDos=Pass&amp;amp;HttpOnly=Pass&amp;amp;InternalErrors=Fail&amp;amp;RobotsTxt=Pass&amp;amp;HtmlSource=Pass&amp;amp;ParameterTampering=Pass&amp;amp;Clickjacking=Fail&amp;amp;Csrf=Fail"&gt;https://asafaweb.com/Scorecard#url=notasafaweb.apphb.com&amp;amp;LackOfTls=Fail&amp;amp;InsecureLogin=Fail&amp;amp;SecureCookies=Fail&amp;amp;MixedModeHttps=Pass&amp;amp;Xss=Fail&amp;amp;PasswordReminders=Pass&amp;amp;PasswordStorage=Pass&amp;amp;PasswordRules=Pass&amp;amp;PasswordDos=Pass&amp;amp;HttpOnly=Pass&amp;amp;InternalErrors=Fail&amp;amp;RobotsTxt=Pass&amp;amp;HtmlSource=Pass&amp;amp;ParameterTampering=Pass&amp;amp;Clickjacking=Fail&amp;amp;Csrf=Fail&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When the URL is received by someone and they open it up, the Scorecard appears with a little summary and the risks in read only mode so that they can’t be directly edited again:&lt;/p&gt;
&lt;p&gt;&lt;img width="974" height="349" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="ASafaWeb Scorecard in read only mode" src="http://lh3.ggpht.com/-y56ID_2CK_Q/UZPxTBfba8I/AAAAAAAAFU4/nb8cL9ZR6E0/image6111.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Mind you, it’s easy just to change the URL and as a result the Scorecard values, but this isn’t intended to be a tamperproof rather it’s a means of sharing information via URL alone. When the Scorecard is opened up it won’t show any risks that haven’t been given a pass or a fail grade so you can elect exactly what data you want to share. Only want to raise one risk – fine, just select that. Only want to alert someone to failing risks – likewise, just send those. You choose.&lt;/p&gt;
&lt;p&gt;There are two reasons I’ve done this and by far the most important is that I don’t want to be building up a repository of vulnerable sites! By persisting the risk in the URL parameter the address contains all the information that’s required to understand what’s going on. Secondly, because that URL is so self-contained it’s easy to pick up and send to someone so it’s very transportable.&lt;/p&gt;
&lt;p&gt;Ultimately that’s the goal – to create a mechanism to easily report on risks and share them around. I’d love to see this tool being used in place of trying to explain risks via Twitter and engaging in the banter that often ensues in an attempt to try and explain things in only 140 characters a shot. It would be great if this gains some traction and I’d love feedback on the effectiveness of it, including if there are further risks that should be included in an attempt to encourage people to seek them out.&lt;/p&gt;
&lt;p&gt;And that brings us back to where this post started out – hacking yourself first. Using the Scorecard above, the chances of you finding at least one risk in your own site is very high and if you can do that and mitigate it before someone exploits it then that’s a very good thing indeed. And likewise, if you do find issues in someone else’s site, the risks above &lt;em&gt;should&lt;/em&gt; keep you out of trouble if you detect and report on them responsibly. Hopefully the Scorecard feature helps this process and makes the web, well, ASafa place!&lt;/p&gt;
&lt;h4&gt;More hacking yourself&lt;/h4&gt;
&lt;p&gt;The risks outlined above are ones I tend to use as a starting point either to assess sites I’m involved in building or to get a sense of the relative security position of someone else’s site. They’re not exhaustive though and as I said at the outset, there are other risks such as SQL injection which are serious, prevalent and will very likely cause damage if probed a little further.&lt;/p&gt;
&lt;p&gt;A good resource for further probing is the &lt;a href="https://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf"&gt;OWASP Testing Guide&lt;/a&gt;. This will take you through hundreds of pages of steps that go into a lot more detail than what this blog post alone covers. If you want to get really in depth then there’s &lt;a href="http://pluralsight.com/training/Courses/TableOfContents/owasp-top10-aspdotnet-application-security-risks"&gt;my recent Pluralsight video training&lt;/a&gt; which gets right down into the guts of how these risks are exploited &lt;em&gt;and&lt;/em&gt; mitigated across just over eight hours of material.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/tVdNzIAhgKQ" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/4995890629154816184?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/4995890629154816184?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/tVdNzIAhgKQ/hack-yourself-first-how-to-go-on.html" title="Hack yourself first – how to go on the offence before online attackers do" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-KXbAIQyX2KY/UZPxEywSweI/AAAAAAAAFSs/PI0Kzf7IJFY/s72-c/image51.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/hack-yourself-first-how-to-go-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUHR3gyfSp7ImA9WhBbFEo.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-4718366305660480889</id><published>2013-05-13T19:36:00.001+10:00</published><updated>2013-05-14T06:50:36.695+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-14T06:50:36.695+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Clickjack attack – the hidden threat right in front of you</title><content type="html">&lt;p&gt;XSS protection: check! &lt;/p&gt; &lt;p&gt;No SQL injection: check! &lt;/p&gt; &lt;p&gt;Proper use of HTTPS: check! &lt;/p&gt; &lt;p&gt;Clickjacking defences: uh, click what now?!&lt;/p&gt; &lt;p&gt;This is one of those risks which doesn’t tend to get a lot of coverage but it can be a malicious little bugger when exploited by an attacker. &lt;a href="http://jeremiahgrossman.blogspot.com.au/2008/10/clickjacking-web-pages-can-see-and-hear.html"&gt;Originally described by Jeremiah Grossman&lt;/a&gt; of WhiteHat Security fame back in 2008, a clickjacking attack relies on creating a veneer of authenticity under which lies a more sinister objective.&lt;/p&gt; &lt;p&gt;Imagine you visit a website and see the following:&lt;/p&gt; &lt;p&gt;&lt;img width="518" height="416" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Win an iPad website" src="http://lh3.ggpht.com/-uFYu1_D0wOk/UZC0A8o7HrI/AAAAAAAAFRc/n8NAqJdjBJg/image5.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Free stuff is always good so you click on the big button and WAMMO! You’ve just been clickjacked. You see, whilst you think you just clicked a “WIN” link, in reality you just clicked this instead:&lt;/p&gt; &lt;p&gt;&lt;img width="518" height="240" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Banking website" src="http://lh4.ggpht.com/-ucSNcVxYWHs/UZC0BhdJ2ZI/AAAAAAAAFRk/s_-WNmzrndw/image8.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;This, of course, is your bank. You are logged in and your bank provides a handy option to transfer all your money with a single click. But of course you don’t know you you’ve just given Mr Dotcom all your money because you never even saw the link. This is a very simple example of a clickjacking attack, let’s take a look at the mechanism underneath and then talk about defences.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;h4&gt;Sleight of hand and other tricks&lt;/h4&gt; &lt;p&gt;This is a little like a magician’s sleight of hand trick; your focus is on one particular area of interest (winning free goodies) and whilst you’re distracted by this, the real “magic” is happening just out of view. This all make a lot more sense when we toggle some opacities on the page, take a look at it again now:&lt;/p&gt; &lt;p&gt;&lt;img width="518" height="416" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Win an iPad website showing the banking website on top of it" src="http://lh4.ggpht.com/-SrWIMhNll5c/UZC0CsQ192I/AAAAAAAAFRs/IqxQsazDETo/image11.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;What you can see now is the bank’s page sitting in an iframe &lt;em&gt;on top of the iPad page&lt;/em&gt;, it simply has the opacity set at 50%. Earlier on it was set to 0% which effectively meant it was hidden &lt;em&gt;but still active&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;Here’s another neat way to view this courtesy of Firefox’s 3D view:&lt;/p&gt; &lt;p&gt;&lt;img width="518" height="381" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="The hidden website in Firefox's 3D mode" src="http://lh4.ggpht.com/-s0E99lJyM_o/UZC0DsC9GOI/AAAAAAAAFR0/b_-w_ZTS5yQ/image2.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;You can see the content that’s actually visible in the attack (such as the “Hey – we’re giving away…” text) sitting several layers deep and the highlighted turquoise box is actually the “WIN” text. The banking site is sitting on top of this which is why you can see several layers on top of it and the “WIN” text ultimately showing through them because of their opacity.&lt;/p&gt; &lt;p&gt;Here’s the key to a clickjacking attack: the target content is hidden and the attacker’s content sits over the top and effectively tricks the victim into clicking links they don’t know they’re clicking. Here’s what the markup of the attacker’s page looks like:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="&lt;/span&gt;&lt;span style="background: white; color: red"&gt;position&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;absolute&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;left&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;10px&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;top&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;10px&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;"&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Hey - we're giving away iPad minis!!! Just click the WIN button and it's yours!!!&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="&lt;/span&gt;&lt;span style="background: white; color: red"&gt;position&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;absolute&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;left&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;200px&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;top&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;50px&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;"&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;img &lt;/span&gt;&lt;span style="background: white; color: red"&gt;src&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://images.apple.com/my/ipad-mini/overview/images/hero.jpg" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="250"&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="&lt;/span&gt;&lt;span style="background: white; color: red"&gt;position&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;absolute&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;left&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;10px&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;top&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;101px&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;color&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;red&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;font-weight&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;bold&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;"&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;&amp;gt; WIN &amp;lt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;iframe &lt;/span&gt;&lt;span style="background: white; color: red"&gt;style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="&lt;/span&gt;&lt;span style="background: white; color: red"&gt;opacity&lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;0&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="545" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="680" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;scrolling&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="no" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;src&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://mybank/Transfer.aspx"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;iframe&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;How easy is that?! Whack the target content in an iframe, hide it then position some rogue links underneath the ones you actually want them to click. Job done.&lt;/p&gt;
&lt;p&gt;When we look at the request that was made by clicking on the “WIN” link (which of course was actually the “Donate” link), we see the following in Chrome’s developer tools:&lt;/p&gt;
&lt;p&gt;&lt;img width="518" height="526" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Hiden request to donate money" src="http://lh3.ggpht.com/-CkHT1fZEXCI/UZC0EfwlAUI/AAAAAAAAFR8/dPaqc31KNWM/image14.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;The two important highlighted areas here show the donate resource being requested and an auth cookie being passed with the request. Remember the significance of this – it persists your logged in state which means that for all intents and purposes, this is an authenticated requests from a logged in user, it’s just that they didn’t really intend to issue it. Now of course for something like a banking website or any other use case that takes advantage of an authenticated state, the user actually needs to be logged in. In that regard it’s a little like a &lt;a href="http://www.troyhunt.com/2010/11/owasp-top-10-for-net-developers-part-5.html"&gt;cross site request forgery attack&lt;/a&gt;. There’s also a bit of &lt;a href="http://www.troyhunt.com/2010/07/owasp-top-10-for-net-developers-part-3.html"&gt;broken authentication and session management&lt;/a&gt; going on insofar as also like CSRF, this is one of those cases where expiring sessions quickly is a great defence albeit at the expense of usability.&lt;/p&gt;
&lt;p&gt;So that’s the execution of it, let’s take a look at the mitigations.&lt;/p&gt;
&lt;h4&gt;Frame busters (and frame buster busters)&lt;/h4&gt;
&lt;p&gt;The issue here is that the target site has been loaded up within an iframe. One way to address this is via a little JavaScript in the banking website which works as follows:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(top.location != location) {
  top.location = self.location;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Simple – if the page isn’t the URL in the address bar (and remember, this is our hypothetical banking site), then redirect the top location of the browser to this page so that it and it alone is loaded into the browser. In other words, the target page is literally “busting” out of the frame and taking over the entire browser window hence freeing itself of the malicious site. Job done? Not quite.&lt;/p&gt;
&lt;p&gt;For every frame buster there is a frame buster buster. In a classic example of the arms race that is builders versus breakers, there are numerous ways this model can be circumvented. There’s a fantastic paper from a few years ago titled &lt;a href="http://seclab.stanford.edu/websec/framebusting/framebust.pdf"&gt;Busting Frame Busting: a Study of Clickjacking Vulnerabilities on Popular Sites&lt;/a&gt; that talks about this in detail but in short, frame buster busters use techniques such as:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Nesting the victim site in &lt;em&gt;two&lt;/em&gt; frames as the double framing causes the descendent frame navigation policy to disable the redirection&lt;/li&gt;
&lt;li&gt;Tapping into the onBeforeUnload event to cancel the redirection (albeit with some user input) when the frame buster attempts to unload the page&lt;/li&gt;
&lt;li&gt;Exploiting XSS filters designed to prohibit cross site scripting in order to cancel out the frame buster&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Implementations differ by browser and by version and it becomes somewhat of a quagmire of conditional logic and varying degrees of success, but the real point is that frame busting via JavaScript is &lt;em&gt;very&lt;/em&gt; patchy. We need a better mousetrap.&lt;/p&gt;
&lt;h4&gt;X-Frame-Options&lt;/h4&gt;
&lt;p&gt;Frame busters are hacks. Nasty, messy hacks of limited efficiency. What we really need is a simpler, more semantic means of specifying how and where a page may be used when it comes to being embedded in a frame and that's what we have in the X-Frame-Options (XFO) header. This one actually &lt;a href="http://blogs.msdn.com/b/ie/archive/2009/01/27/ie8-security-part-vii-clickjacking-defenses.aspx"&gt;came out of Microsoft back in early 2009&lt;/a&gt; so it’s been around for a while although evidence would suggest it hasn’t been extensively adopted.&lt;/p&gt;
&lt;p&gt;Firstly a bit of response headers 101. When an HTTP header is preceded with “X-“ then it’s not strictly part of the HTTP spec. Anyone can make up their own headers to pass info around outside of the response body. Fortunately it’s a little more organised than that with the browser vendors agreeing to recognise the header and place some limitations on how the browser handles the page as a result. There’s actually a &lt;a href="http://tools.ietf.org/html/draft-ietf-websec-x-frame-options-00"&gt;draft IETF spec for the header&lt;/a&gt; so we may see more formality at some point in the future.&lt;/p&gt;
&lt;p&gt;You’ve got 3 different values for your XFO headers and I’ll quote from that draft IETF spec as it does a good job of describing them:&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; DENY&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A browser receiving content with this header MUST NOT display&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this content in any frame.&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; SAMEORIGIN&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A browser receiving content with this header MUST NOT display&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this content in any frame from a page of different origin than&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the content itself.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If a browser or plugin can not reliably determine whether the&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; origin of the content and the frame have the same origin, this&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MUST be treated as "DENY".&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;a href="http://tools.ietf.org/html/draft-ietf-websec-x-frame-options-00#ref-TBD"&gt;TBD&lt;/a&gt;]current implementations do not display if the origin of&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the top-level-browsing-context is different than the origin of&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the page containing the X-FRAME-OPTIONS header.&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; ALLOW-FROM&amp;nbsp; (followed by a URI of trusted origins)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A browser receiving content with this header MUST NOT display&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this content in any frame from a page of different origin than&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the listed origin.&amp;nbsp; While this can expose the page to risks by&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the trusted origin, in some cases it may be necessary to use&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; content from other domains.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For example: X-FRAME-OPTIONS: ALLOW-FROM&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="https://www.domain.com/"&gt;https://www.domain.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There is also the non-standard ALLOWALL value which does just what it sounds like it does – in theory. Apparently &lt;a href="http://ipsec.pl/node/1094"&gt;this value started getting served up by Google quite recently&lt;/a&gt; and got the browsers a little confused. Well more specifically, the browsers don’t recognise it as a valid value and consequently just ignored it which, of course, is exactly what the intention is and is the equivalent of having no XFO header at all. Except it isn’t really; when you see no header there are two possible options with the first being that the developer wants to allow the page to be embedded anywhere and the second that they never even thought to include it. My money is on the second option being by far and away the most prevalent situation and the ALLOWALL value is an explicit acknowledgement that a conscious decision has been made to allow embedding in frames. The intent is much clearer and far less implicit which IMHO is a good thing.&lt;/p&gt;
&lt;p&gt;There is, however, some criticism of the XFO implementation as it stands. For example, it’s not possible to allow framing of content both from the same origin and from a trusted URI. In a similar vein, it’s also not possible to allow framing from multiple trusted URIs. Both of these are unfortunate shortcomings of the header as they’re very real scenarios. Allowing the browser to recognise multiple non-conflicting definitions of the header would be one approach but that doesn’t appear to be on the cards just now.&lt;/p&gt;
&lt;p&gt;Moving on, XFO is all pretty simple and the browser support is very good with IE8 onwards implementing it as well as all the other major vendors for a number of versions now (Firefox 3.6, Safari 4, Chrome 4.1). What if a browser &lt;em&gt;doesn’t &lt;/em&gt;implement it? Absolutely nothing, it will just carry on as usual and not put any constraints around the content being framed.&lt;/p&gt;
&lt;p&gt;Assuming you don’t actually want a site embedded within other sites (which will &lt;em&gt;usually&lt;/em&gt; be the case), just use it – it’s a few bytes of overhead to prevent a potentially rather malicious scenario. Ideally, you want to just deny access to browsers loading the page in a frame. If you really want to load your own pages into frames on the same site then you do the same origin trick or open it up further to another site with the “allow-from” syntax. Do be cautious though: things will break if you’re overzealous and inadvertently block content from loading into legitimate frames.&lt;/p&gt;
&lt;h4&gt;XFO in practice&lt;/h4&gt;
&lt;p&gt;Getting back to our original example, here’s what happens to that site once XFO denies embedding in a frame (I’ve left the opacity at 50%):&lt;/p&gt;
&lt;p&gt;&lt;img width="518" height="416" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="XFO header denying the banking website from being loaded in a frame" src="http://lh6.ggpht.com/-xMHZymY2pF0/UZC0FW8YrrI/AAAAAAAAFSE/zgTI4jQ_J9s/image31.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;You see that? Of course you don’t, that’s the whole point! The banking site is no longer rendered in the browser, all you can see is the iframe border. Mind you, the banking site is still &lt;em&gt;requested&lt;/em&gt; because after all, that’s the only way the browser can be instructed not to render it once it’s returned by the server. You can see this in Chrome’s network profiler:&lt;/p&gt;
&lt;p&gt;&lt;img width="518" height="428" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Chrome showing the banking page is still requested" src="http://lh4.ggpht.com/-fSFHIhLDTew/UZC0FwXcUvI/AAAAAAAAFSM/F1hQOw6m1rQ/image6.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Check the status of that last request to Transfer.aspx – it’s now “cancelled” which is &lt;em&gt;kind of &lt;/em&gt;right. As I said earlier, the request is actually still made and indeed you can inspect the response headers:&lt;/p&gt;
&lt;p&gt;&lt;img width="518" height="442" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="The X-Frame-Options header set to DENY" src="http://lh4.ggpht.com/-NlW25GZ9r0k/UZC0Jj-5WgI/AAAAAAAAFSU/JYgr-CUOH80/image91.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Just to close the loop on things, there’s that XFO header. Job done!&lt;/p&gt;
&lt;h4&gt;Protecting your ASP.NET app with NWebsec&lt;/h4&gt;
&lt;p&gt;Adding response headers to most frameworks is a piece of cake, ASP.NET included. Normally I’d just go and &lt;a href="http://msdn.microsoft.com/en-us/library/ms227673(v=vs.100).aspx"&gt;create a custom HTTP module&lt;/a&gt; and be done with it but being a fan of taking community projects that already work well, it’s worth checking out &lt;a href="http://nwebsec.codeplex.com/"&gt;NWebsec&lt;/a&gt; first. This little package was created by &lt;a href="http://www.dotnetnoob.com/"&gt;André Klingsheim&lt;/a&gt; who has done a number of clever security things over the years. As with all good .NET packages it can be &lt;a href="https://www.nuget.org/packages/NWebsec"&gt;easily grabbed from NuGet&lt;/a&gt;:&lt;/p&gt;&lt;pre&gt;PM&amp;gt; Install-Package NWebsec&lt;/pre&gt;
&lt;p&gt;One of the things I like about NWebsec is that it’s a configuration-only install; there’s no recompile, just drop in the libraries and setup the web.config and you’re done. For some people, this is quite advantageous. The other neat thing is that it tackles a bunch of other security related headers as well. For example, I just dropped it into &lt;a href="https://asafaweb.com/"&gt;ASafaWeb&lt;/a&gt; and used it to both add an XFO header and replace my existing HSTS header code with just a web.config configuration. Speaking of ASafaWeb…&lt;/p&gt;
&lt;h4&gt;Detecting the clickjack risk with ASafaWeb&lt;/h4&gt;
&lt;p&gt;As many of you will already know, I maintain a little security misconfiguration scanner called &lt;a href="https://asafaweb.com"&gt;ASafaWeb&lt;/a&gt; which is the Automated Security Analyser for ASP.NET Websites. As the name suggests, it’s predominantly aimed at security misconfiguration of sites built on the Microsoft stack but its horizons are increasingly being broadened. For example, I recently &lt;a href="http://www.troyhunt.com/2013/03/c-is-for-cookie-h-is-for-hacker.html"&gt;added support for detecting HTTP only and secure cookies&lt;/a&gt; which, of course, works across any web platform that talks in HTTP.&lt;/p&gt;
&lt;p&gt;Now I’ve added support for detecting XFO. It’s a real no-brainer for ASafaWeb as it just involves looking at the response headers of one of the requests it already makes so that’s no additional HTTP overhead by way of additional requests. &lt;a href="https://asafaweb.com/Scan?Url=notasafaweb.apphb.com#ClickjackingResult"&gt;Here’s what a sample scan looks like when no clickjacking defence exists&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img width="810" height="418" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="ASafaWeb scan showing no XFO header exists" src="http://lh4.ggpht.com/-ZdYdaZumMiM/UZC0KEAHq0I/AAAAAAAAFSc/9fmfrdxze7k/image24.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;You’ll see that ASafaWeb flags it as a warning and there are a few different reasons for that. Firstly, it may be perfectly legitimate not to set an XFO header because there are cases where you &lt;em&gt;want &lt;/em&gt;your content to be framed by other sites beyond what is feasible to describe with an ALLOW-FROM value. It’s rare, but there are cases. Secondly, flagging this an error alongside risks such as an exposed ELMAH log or a page stack trace is not really commensurate with the actual risk it poses. I did exactly the same thing with the &lt;a href="http://www.troyhunt.com/2012/02/shhh-dont-let-your-response-headers.html"&gt;excessive headers scan&lt;/a&gt; for the same reason. Finally, I’m going to take a guess here and say that 90%+ of sites are going to fail this scan. I do store de-identified logs so I’ll be able to validate this assumption once some data is collected, but marking almost every single scan someone does as having an “error” can be counter-productive, particularly when people also have &lt;a href="http://www.troyhunt.com/2012/08/welcome-to-asafaweb-scheduler.html"&gt;scheduled scans&lt;/a&gt; which are only triggered when an error state occurs.&lt;/p&gt;
&lt;p&gt;If this post has sparked your interest, go and drop some of your sites into ASafaWeb and you’ll quickly get an idea of how many are at risk of a clickjacking attack. It will almost certainly be many.&lt;/p&gt;
&lt;h4&gt;More on XFO&lt;/h4&gt;
&lt;p&gt;It’s interesting to look at how other websites implement XFO. For example, here’s what Facebook does:&lt;/p&gt;&lt;pre&gt;X-Frame-Options: DENY&lt;/pre&gt;
&lt;p&gt;And Twitter:&lt;/p&gt;&lt;pre&gt;x-frame-options: SAMEORIGIN&lt;/pre&gt;
&lt;p&gt;And even GitHub:&lt;/p&gt;&lt;pre&gt;X-Frame-Options: deny&lt;/pre&gt;
&lt;p&gt;On the other hand, let’s look at what our “Big 4” Aussie banks do:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://anz.com.au"&gt;ANZ&lt;/a&gt; – no XFO&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.commbank.com.au/"&gt;Commonwealth&lt;/a&gt; – nothing there&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.westpac.com.au/"&gt;Westpac&lt;/a&gt; – nada&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.nab.com.au/"&gt;NAB&lt;/a&gt; – nope&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Now of course the clickjacking risk can only really be exploited when there’s an advantage to be gained by a victim unknowingly clicking on a link, so for example once they’re actually logged on to their bank account &lt;em&gt;and &lt;/em&gt;assuming it’s a mere single link click that doesn’t require follow-up action to actually impact a change. Maybe that usage pattern doesn’t exist behind the logons of those banks but at the end of the day, we’re just talking about a few bytes added to the response header so it’s not like implementing XFO is going to cause any tangible adverse impact.&lt;/p&gt;
&lt;p&gt;Ultimately, this is just another one of those little additional security value-add features. It’s not exactly in the same league as SQL injection or cross site scripting, but &lt;a href="http://www.troyhunt.com/2012/10/she-did-what-in-school-mechanics-of.html"&gt;as I’ve written before&lt;/a&gt;, it can be a real nuisance when leveraged against features such as a Facebook “like” buttons. Plus of course there are genuine cases where it can cause damage, particularly when combined with other sloppy practices such as far-reaching session expirations. Just add an XFO header and be done with it.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/NYG1lBO1phw" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/4718366305660480889?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/4718366305660480889?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/NYG1lBO1phw/clickjack-attack-hidden-threat-right-in.html" title="Clickjack attack – the hidden threat right in front of you" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-uFYu1_D0wOk/UZC0A8o7HrI/AAAAAAAAFRc/n8NAqJdjBJg/s72-c/image5.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/clickjack-attack-hidden-threat-right-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EDRns4eCp7ImA9WhBaEE0.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-7049350034235553282</id><published>2013-05-08T22:24:00.001+10:00</published><updated>2013-05-20T09:21:17.530+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-20T09:21:17.530+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSL" /><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Here’s why you can’t trust SSL logos on HTTP pages (even from SSL vendors)</title><content type="html">&lt;p&gt;A couple of days ago I wrote about &lt;a href="http://www.troyhunt.com/2013/05/why-i-am-worlds-greatest-lover-and.html"&gt;Why I am the world’s greatest lover (and other worthless security claims)&lt;/a&gt; and it&amp;nbsp; really seemed to resonate with people. In short, whacking a seal on your website that talks about security awesomeness in no way causes security awesomeness. Andy Gambles gets that and shared this tweet with me:&lt;/p&gt; &lt;p&gt;&lt;a href="https://twitter.com/andygambles/status/332065425485611008"&gt;&lt;img width="463" height="330" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="@troyhunt so when an SSL vendor is saying stuff like this http://st.cm/18WVy6O  does that give us any hope?" src="http://lh6.ggpht.com/-03AmIWzhGP4/UYpD9CsnfwI/AAAAAAAAFQw/7XcoZobRvw8/SNAGHTML4122a27b%25255B4%25255D.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;So let’s check out exactly what’s going on here and you really need video to understand the fatal flaw in the logic of SSL logos coming down over HTTPS:&lt;/p&gt;

&lt;iframe width="100%" height="480" src="http://www.youtube.com/embed/Z3aCT4FAuYA" frameborder="0" allowfullscreen="allowfullscreen"&gt;&lt;/iframe&gt; 

&lt;p&gt;So there you go – it can be that simple. How I MiTM’d the page so easily is not really the point, the point is that an SSL logo on an unprotected page is as good as worthless (and frankly they’re not much good on protected pages either).&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/I6qrJWxwYu8" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7049350034235553282?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7049350034235553282?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/I6qrJWxwYu8/heres-why-you-cant-trust-ssl-logos-on.html" title="Here’s why you can’t trust SSL logos on HTTP pages (even from SSL vendors)" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-03AmIWzhGP4/UYpD9CsnfwI/AAAAAAAAFQw/7XcoZobRvw8/s72-c/SNAGHTML4122a27b%25255B4%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/heres-why-you-cant-trust-ssl-logos-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UNSH8-fSp7ImA9WhBUGE4.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-3340518537360018028</id><published>2013-05-06T21:21:00.001+10:00</published><updated>2013-05-06T21:21:39.155+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-06T21:21:39.155+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSL" /><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Why I am the world’s greatest lover (and other worthless security claims)</title><content type="html">&lt;p&gt;I’ve been considering purchasing one of these t-shirts:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;img width="500" height="500" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="The World's Greatest Lover T-shirt" src="http://lh6.ggpht.com/-CPnLLVDGukQ/UYeSF5C_bMI/AAAAAAAAFO4/45Ppn4RkeSE/414QOIA7vnL2.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;This shirt would announce to everyone who crosses my path that I am, in fact, the world’s greatest lover. They would know this because I have a t-shirt that tells them so and it would give them enormous confidence in my sexual prowess.&lt;/p&gt; &lt;p&gt;If ever I was challenged on the claim, I could quite rightly say that nobody has ever demonstrated that this is not the case and there are no proven incidents that disprove it.&lt;/p&gt; &lt;p&gt;Sound ridiculous? Of course it is but somehow we’ve come to accept this practice – or at least tolerate it – by virtue of images like these:&lt;/p&gt; &lt;p&gt;&lt;img width="300" height="162" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Norton Secured - Powered by VeriSign" src="http://lh4.ggpht.com/-MJQX__5VXPI/UYeSGo2GOBI/AAAAAAAAFPA/ppBynNo4_a0/seal4.jpg?imgmax=800" border="0"&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;p&gt;The futility of this logo struck me last month when I wrote about &lt;a href="http://www.troyhunt.com/2013/04/5-ways-to-implement-https-in.html"&gt;5 ways to implement HTTPS in an insufficient manner (and leak sensitive data)&lt;/a&gt;. Here was a site that despite the assertions of the owner that it was “secure”, sent sensitive data in the clear, had mixed mode HTTP and HTTPS content, sent auth cookies over an insecure connection, didn’t flag sensitive cookies as secure to begin with and relied on HTTP to load the login form. Oh – and had a “Norton Secured” logo.&lt;/p&gt; &lt;p&gt;The futility of the logo really struck me when I read this forum response from Top CashBack after they were asked “how safe are your bank details in TCB”:&lt;/p&gt; &lt;p&gt;&lt;img width="880" height="411" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="&amp;quot;If you go to your account and scroll to the bottom of the page, you will see the logos for both Verisign and McAfee Secure&amp;quot;" src="http://lh5.ggpht.com/-UMjrbPMcL7Y/UYeSHY0EORI/AAAAAAAAFPI/SNcTX_-fe94/image16.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;The site is secure because it has logos. Not just one logo, but two logos. This is beginning to be reminiscent of the &lt;a href="http://www.troyhunt.com/2011/07/padlock-icon-must-die.html"&gt;entirely nonsensical padlock icon bitmap&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;So what exactly does this logo get you? &lt;a href="http://www.symantec.com/en/au/page.jsp?id=seal-transition"&gt;According to Norton&lt;/a&gt; (or rather Symantec who owns the brand), you get consumer trust:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;77% of consumers recognize the Norton Secured Seal.&lt;/li&gt; &lt;li&gt;65% of consumers agree that a website displaying the Norton Secured Seal is safe to browse and won’t give them a virus.&lt;/li&gt; &lt;li&gt;55% of consumers agree that a website displaying the Norton Secured Seal means that the website protects their online privacy.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;It’s the last two points that I found particularly interesting so I thought I’d take a browse around at &lt;a href="https://www.google.com.au/search?safe=off&amp;amp;biw=1680&amp;amp;bih=989&amp;amp;tbm=isch&amp;amp;sa=1&amp;amp;q=%22norton+secured%22+logo&amp;amp;oq=%22norton+secured%22+logo&amp;amp;gs_l=img.3...623057.624271.0.624461.6.5.0.0.0.0.0.0..0.0...0.0...1c.1.12.img.hEg4abxYsew"&gt;sites displaying the logo&lt;/a&gt;. Almost every random example I picked where this logo had been used had basic security flaws. Not obscure hypothetical flaws but rather easily observable, readily exploitable flaws.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.versaliftsystems.com/"&gt;Versa Lift&lt;/a&gt; has mixed mode HTTP and HTTPS when you go to checkout:&lt;/p&gt; &lt;p&gt;&lt;img width="572" height="404" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Versa Lift website with mixed mode HTTP and HTTPS" src="http://lh6.ggpht.com/-MTdhWnIJMNQ/UYeSH_y7wRI/AAAAAAAAFPM/UmNUaYAVLGM/SNAGHTML41e4da83.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.mybinding.com/"&gt;MyBinding.com&lt;/a&gt; also messes this up:&lt;/p&gt; &lt;p&gt;&lt;img width="363" height="296" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="MyBinding.com website with mixed mode HTTP and HTTPS" src="http://lh4.ggpht.com/-vy0gcNvlu3I/UYeSLKpU_mI/AAAAAAAAFPY/ZX4rdANJX6k/SNAGHTML4292ed23.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;And then they let you choose a 3 character password. And email it to you:&lt;/p&gt; &lt;p&gt;&lt;img width="429" height="278" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="MyBinding.com website sending 3 char password in plain text" src="http://lh4.ggpht.com/-OA6u95_1Ugw/UYeSLqg6BvI/AAAAAAAAFPc/O5TCgDbXzNA/SNAGHTML42b09c53.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Then there’s &lt;a href="http://www.tanguito.co.uk/tango-clothing/"&gt;Tanguito dancewear&lt;/a&gt; which has many impressive logos:&lt;/p&gt; &lt;p&gt;&lt;img width="494" height="172" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Tanguito dancewear with Norton and Trustwave logos" src="http://lh4.ggpht.com/-CYwpOoZHIXY/UYeSMLIoATI/AAAAAAAAFPk/FVJtbfhUJUI/SNAGHTML431f4bf3.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;And no transport layer protection whatsoever on the login (and no, it doesn’t even post over HTTPS which would still be insufficient anyway):&lt;/p&gt; &lt;p&gt;&lt;img width="410" height="444" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Tanguito dancewear logon with no HTTPS" src="http://lh5.ggpht.com/-2ICu58mKazA/UYeSMr7fVVI/AAAAAAAAFPw/WXsiKz7bN3U/SNAGHTML45b5b4f3.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;There’s also no HTTPS on the &lt;a href="http://www.rarefile.net/"&gt;RareFile&lt;/a&gt; login (and we have multi-logos again):&lt;/p&gt; &lt;p&gt;&lt;img width="537" height="398" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="RareFile logon with no HTTPS" src="http://lh3.ggpht.com/-ziF7o6HSmyo/UYeSNWqKH_I/AAAAAAAAFP4/UBKA2JfPBY4/SNAGHTML45b18853.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;None on &lt;a href="http://www.chemicalcontainers.com/"&gt;Chemical Containers inc.&lt;/a&gt; either:&lt;/p&gt; &lt;p&gt;&lt;img width="420" height="294" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Chemical Containers logon with no HTTPS" src="http://lh5.ggpht.com/-dhg0woNGLeI/UYeSN0iem3I/AAAAAAAAFQA/Ho4cn90KUiU/SNAGHTML45ee0373.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Or there’s &lt;a href="http://www.imeds.com.br/medicina?t=0&amp;amp;q=%3Cscript%3Ealert%28%27XSS%21%27%29%3C%2Fscript%3E"&gt;iMeds with the simplest of reflected XSS&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;img width="667" height="309" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="iMeds with reflected XSS" src="http://lh6.ggpht.com/-Jcc8b8jkH2U/UYeSOsz4ofI/AAAAAAAAFQI/sg1V4t1H_u4/SNAGHTML4b4d81e3.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Continuing with the non-SSL theme, there’s &lt;a href="http://www.telegraphcottages.co.uk/"&gt;Telegraph Cottages&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;img width="602" height="371" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Telegraph Cottages" src="http://lh4.ggpht.com/-tvhQ8A7mWKw/UYeSPAnAKGI/AAAAAAAAFQQ/1xvW9RAjL8Q/SNAGHTML4b799983.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;But get &lt;a href="http://www.telegraphcottages.co.uk/%3C"&gt;one illegal character into the URL&lt;/a&gt; and we have a case of Yellow Screen of Death via security misconfiguration courtesy of a misconfigured web.config:&lt;/p&gt; &lt;p&gt;&lt;img width="783" height="413" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Yellow Screen of Death on Telegraph Cottages" src="http://lh3.ggpht.com/-7IA7Icg-pn0/UYeSPxuMakI/AAAAAAAAFQY/Z_FIwSAuNQ8/SNAGHTML4b84d1e3.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;And so on and so forth. The list goes on and on and on and, well, there’s a lot.&lt;/p&gt; &lt;p&gt;Of course there’s (unfortunately) nothing unusual about websites getting basic security practices like these wrong but when they do so &lt;em&gt;and&lt;/em&gt; claim to have reached some higher moral security ground by virtue of a Norton or McAfee or any other seal then that’s just downright misleading. Claiming that the website is “safe to browse” or that it “protects [consumers’] online privacy” simply by the presence of a bitmap image is way off the mark. Who knows, maybe these cases have simply abused the acceptable use of the imagery but one thing is for sure; they’ve got their basics wrong on the security front and no number of security logos will change that.&lt;/p&gt; &lt;p&gt;If you believe &lt;a href="http://www.conversioniq.com/casestudies/norton-secured-verisign-conversion-rate-case-study/"&gt;the marketing hype&lt;/a&gt; (and I would definitely take this with a grain of salt), one of these little logos could lead to a 11% improvement in sales and 52% lift in sales from paid search. Suddenly the value proposition to websites becomes a lot more tangible and again, &lt;em&gt;it all comes back to establishing trust&lt;/em&gt;. Unfortunately it’s just not warranted in so many of the cases where the logo appears.&lt;/p&gt; &lt;p&gt;But of course it begs the question: what exactly do you need to do in order to display this seal which will boost your appeal with consumers? Have your site audited by security professionals? Scanned by a comprehensive dynamic analysis tool? Self-assess against a set of stringent criteria? Nope, you &lt;a href="http://www.symantec.com/ssl/seal-agreement/install.jsp"&gt;buy one of their SSL certs or have them check there’s no malware on the site&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;img width="760" height="159" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Note: You must purchase a Symantec SSL Certificate or Symantec Safe Site before installing the Norton Secured Seal." src="http://lh5.ggpht.com/-CST0INPZ5xY/UYeSQe5IeUI/AAAAAAAAFQc/42-HTb9sAdQ/image19.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Now interestingly, in theory, this also means embedding the seal with a piece of script which appears to go some way to verifying the fact that the page displaying the seal is indeed protected with one of their certs. Clearly this isn’t the case in some of the examples above but how is a consumer to know that? And whilst there’s absolutely nothing wrong with a Symantec SSL cert (at least not to my knowledge), when used as intended the presence of the seal merely verifies that the page in which it is embedded is loaded over HTTPS. The whole idea of OWASP calling &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;part 9 of the Top 10&lt;/a&gt; “Insufficient” Transport Layer Protection is that there is far more to SSL than just having a cert; &lt;em&gt;it has to be used correctly!&lt;/em&gt;&lt;/p&gt; &lt;p&gt;At the end of the day, the only real difference between the t-shirt at the start of this post and the website badges above is that it’s simple to disprove the claim of the latter.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/ANg3Fzu8O74" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/3340518537360018028?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/3340518537360018028?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/ANg3Fzu8O74/why-i-am-worlds-greatest-lover-and.html" title="Why I am the world’s greatest lover (and other worthless security claims)" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-CPnLLVDGukQ/UYeSF5C_bMI/AAAAAAAAFO4/45Ppn4RkeSE/s72-c/414QOIA7vnL2.jpg?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/why-i-am-worlds-greatest-lover-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UBQns4eSp7ImA9WhBUFUk.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-7468976783809349588</id><published>2013-05-03T11:40:00.001+10:00</published><updated>2013-05-03T11:40:53.531+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-03T11:40:53.531+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Pineapple Surprise! Mixing trusting devices with sneaky Wi-Fi at #wdc13</title><content type="html">&lt;p&gt;I’m pushing the “Publish” button on this just before I go on stage at &lt;a href="http://code13melb.webdirections.org/"&gt;Web Directions Code&lt;/a&gt; because all things going well, what I’m going to talk about in this post will form part of my demo about securing web services.&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Web Directions Code stage" src="http://lh5.ggpht.com/-L5KdFbSVjTo/UYMVniTrZaI/AAAAAAAAFOU/qrgNYBvgWqA/Photo-2-05-13-8-53-502.jpg?imgmax=800" width="880" height="474" /&gt;&lt;/p&gt;  &lt;p&gt;I’m making some (admittedly very simple) code available and providing some resources that will hopefully help everything I talk about with regards to unprotected wireless traffic make sense. I’d like to begin by introducing you to Pineapple Surprise!&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Stack Overflow dnsspoof" src="http://lh4.ggpht.com/-yeVJ8jJdbLo/UYMVoWPfjVI/AAAAAAAAFOc/_wq1YjkKaLo/12.png?imgmax=800" width="250" height="525" /&gt;&lt;/p&gt;  &lt;p&gt;Wait – what?! Where’s my Stack Overflow?! I mean I’m seeing stackoverflow.com in the address bar, what’s going on here?! It gets worse:&lt;/p&gt;  &lt;p&gt;&lt;img title="2" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="2" src="http://lh4.ggpht.com/-G7YNq__es9A/UYMVoytF4SI/AAAAAAAAFOk/CFIYHLuZV3A/22.png?imgmax=800" width="250" height="525" /&gt;&lt;/p&gt;  &lt;p&gt;That little usr cookie down the bottom – that’s the money shot. Create a cookie in the browser with that name and value while the session is active (yes, it has expired just in case you were wondering) and wammo! You’re now me on Stack Overflow. You can go and respond to every security question about encryption and tell them to use ROT13, you can abuse Jon Skeet for not knowing his covariants from his contravariants and you can respond to any question about “How do I use ASP.NET to…” by telling them to use SharePoint. Except it’s not you saying that, it’s me and I’ll cop the abuse for it.&lt;/p&gt;  &lt;p&gt;Let me explain what’s happening here.&lt;/p&gt; &lt;a name='more'&gt;&lt;/a&gt;  &lt;h4&gt;All your Wi-Fis are belong to the Pineapple&lt;/h4&gt;  &lt;p&gt;This is all the work of the Wi-Fi Pineapple which I initially wrote about a couple of weeks back in &lt;a href="http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html"&gt;The beginners guide to breaking website security with nothing more than a Pineapple&lt;/a&gt; and then again a few days ago in &lt;a href="http://www.troyhunt.com/2013/04/your-mac-iphone-or-ipad-may-have-left.html"&gt;Your Mac, iPhone or iPad may have left the Apple store with a serious security risk&lt;/a&gt;. It’s this little guy here:&lt;/p&gt;  &lt;p&gt;&lt;img alt="Wi-Fi Pineapple" src="http://lh6.ggpht.com/-KA7rofLkRpE/UW538jHFdmI/AAAAAAAAFHE/JPtjHlcp8nw/Untitled-12.png?imgmax=800" /&gt;&lt;/p&gt;  &lt;p&gt;You can go and read the detail in those posts so I won’t repeat too much of it here beyond saying that this little device can trick trusting phones, tablets, laptops and anything else that can auto-connect to an &lt;em&gt;open&lt;/em&gt; (i.e. no Wi-Fi password) known Wi-Fi access point (which is pretty much everything) into connecting to it instead. What many people don’t realise is that their wireless devices are constantly sending out “probe” requests looking for networks it has previously connected to (secured or not) &lt;em&gt;and would like to connect to again&lt;/em&gt;. Just walking around yesterday morning with the Pineapple resulted in 315 unique SSID’s being probed for, sometimes by multiple different unique MAC addresses (the amusing ones are in bold):&lt;/p&gt;  &lt;p&gt;&lt;em&gt;#HKAirport Free WiFi, #WiFi@Changi, @yvrairport, _FREE Wi-Fi by inlink., 120wire, 14 Stewart Gibson Place, 2WIRE361, 474Labs-N, 4ten.net, ABC_PSK, ABC_WIFI, ACCESS-StarHub (2 MACs), aconex-wifi, AdshelWifi, Airport Free Wifi, ajfisher, allen, Anchors Aweigh, AndroidAP (3 MACs), AndroidAP5, AndroidHotspot1982, AnthB, ANU-Access, Apple Demo, Apple Store (3 MACs), Auckland Wi-Fi @ Tomizone, Aussieville, AUVIC-AEGIS-WIRELESS00, Axiom 5, B715 (2 MACs), BAIADAWL03, BAIADAWL04, BALoungeWiFi, BAMBI, bazillion, BBY Guest, BigPond022391, BigPond1D0761, BigPond47C6, BigPond4C0F55, BigPondD3DFA4, BigPondD7E713, BIPAC, BLERG, BlingBlingNet, Bliss, BO-AP03, Bordo, Brayza, BTHomeHub2-7J2T, BYOD, Cafe Caldera, CafeScreen_Free_WiFi, camphone, CCLA-HOTSPOT, Centre Wireless, chelagarto, ChinaNet-E3Ex, ChinaNet-Starbucks, ci+reactor, CiscoA4309 (2 MACs), CITWIRE, COKE Zero FREE WiFi, Colonial-One, Connect Free WiFi, Connect2UoM, Crush, Dan's White 64GB 4S, Darling Harbour Hotel2, db155, deblank, deblank2, deblanks, default, DEL C:, devgeeks (2 MACs), DH Studio, dh-int2, DigProd-Mixed, DigProd-N, DJ_Corp, dlink, Dodo, Dragonfly, DrayTek, DWLaptop, E583C-27a3 (2 MACs), &lt;strong&gt;Earth-shattering Kaboom!&lt;/strong&gt;, Eden, Elfin, Emerald Hotspot, f9sml9fX, Fanta Wi-Fi, Finch, FinPa New Media, Flightfox.com, FLOATdroid, fluffyland, fontenayDL001, Four Points by Sheraton, Free wifi (5 MACs), free-hotspot.com, FreeSkydeckWifi1, FRITZ!Box Cubitt, Fuck-Off, FWMM2, FWMM2-guest, GAGAWAVE, Galactica, Galactica Guest, Gareth Edwards...s iPhone4, GoogleGuest (3 MACs), hahd.fr (Cette), Havana, Hertzpert, HH-GUEST, hhonors, Holiday Inn Public Wireless (2 MACs), HollerWF, home, home2ng8wlanv, HOTEL BRUNY FREE INTERNET, Hotelpuri.com, Hotspot-TXL, HTC Portable Hotspot (2 MACs), Hypnotoad, ibahn, Ibis, ii005745primary, iMac G5, Inspire9 (2 MACs), inteddies, Internode (2 MACs), Io, iROOM-Akama 2, ISIS, J and P, j74eX5drDdgf, James's iPhone, Jason, JOHNDEBLANK-PC_Network, JScamp2012, JSConf EU 2012, Kevin Yank...s iPhone, KINWOWLAN (2 MACs), KIT-GUEST (2 MACs), kylevermeulen, L n J, LAX OneWorld Lounge, LAX-WiFi, Link (2 MACs), linksys_reception, linuxconfau, Little Shed, LittleWireless, &lt;strong&gt;lovenest&lt;/strong&gt;, LtBourkeSt, Luana 1207, Macquarie Public, MagicJohnston, Marty McWiFi, MAXSPOT, MAYA, McDonald's FREE WiFi, Melbourne Virgin Lounge, meteorology, metguest, Metro Wifi (2 MACs), met-wlan999, Miller Street Brewery Mobile 4G, Millhood, mka-27784, MOBILE, mojito, monstrouswifi, Mort, MOTOROLA-E5BE7, Movistar-Vex, Mozilla Guest, MPLUX AirPort, MRC-Guest, MTH Functions (6 MACs), museumcg, museumpublic, NDABBAYE, NetComm Wireless, NETGEAR (2 MACs), NETGEAR2, Nexus, &lt;strong&gt;no-one here but us chickens&lt;/strong&gt;, Norah Han...s iPhone, Novotel-Canberra, NPS Wireless, ntegrity.com.au, Ogilvy_Melbourne, OgilvyWiFi, OptimusPrime, Optus E583C f0b5, OPTUS_B1, OPTUSA82B5A1, OptusCD3_365c80, OPTUSV6FF126, OPTUSV8D64B0, Other... (2 MACs), PalaceMeetingRooms, Panasonic Display1, pandy, &lt;strong&gt;password: ken sent me&lt;/strong&gt;, Patient, Pegasus, pgh-wireless, Pluto, Porto, Porty Extreme, pp, PP-AP, &lt;strong&gt;Pretty Fly For A Wifi, Pretty Fly for a WiFi...&lt;/strong&gt;, Prometheus-2-4, public, Qantas Free WiFi, Qantas-Lounge (2 MACs), QANTASWebConnect, RAMMMOODIEWLAN, RCSWIFI_1, redlea (2 MACs), Residence du Rougier 1, rhapsody (2 MACs), Ricky...s iPhone 5, RMIT, Robot, roomlinx, ROSENEATH_WIFI, rtw, Scarlett Extreme, Sceptre, ScottiePippen, Seaport Wireless, SFR_E8C8, Shanghai_Wireless, Sherwood Forest, SH-Wireless, SJS, sky-free-e872b5, SKYMESH, &lt;strong&gt;Skynet Global Defence Network, Skynet mobile defence unit, Skynet Mobile Unit&lt;/strong&gt;, SOH_Guest, SpeedTouch913EE2, Squareweave - We build web apps, squiz.net, State Library of Victoria, StormsEnd, studiocea, Subaru_Customer_Lounge, Super_Dragon, SuperDragon, T1 Free wifi by SYD, t1fg, TASSWEB Wireless, Telecom wireless hotspot, TelerikAPAC, TEWM_0A7E0B, The Lounge Sydney, The Office of Marketing, THE PARLOR (2 MACs), thebrook, &lt;strong&gt;theinterweb&lt;/strong&gt;, TheOffice, thisismyhouse, ThousandPoundBend, tobyandloz, Tomizone @ Movenpick, Tony le Pony, &lt;strong&gt;trust me&lt;/strong&gt;, TULIP (4 MACs), Tygwyn1, UConnect, ULTIMATE-4F77, ULTIMATE-Rhapsody, UniWireless, vanessa's Network, Ventura_Free_WiFi, Verizon MIFI4510L 2412 Secure, vermeulen, Victoria Hotel, &lt;strong&gt;VirusProwler&lt;/strong&gt;, W3710, WANADOO-6058, Wards, Wayport_Access, wdc-a, wdc-b (2 MACs), weatherzone, webteam (2 MACs), webteam2, WIFI@CintaAyu, WIFI@CintaTerrace, wilnet, winboard, wireless, Wireless@SG (3 MACs), wireless01 (2 MACs), WLANadmin, wlan-ap (2 MACs), WME, WME iinet, WME Wireless, www.koodoz.com.au, Xperia S_284e, YBF-b, Young Henrys, Zentrum_Der_Macht, ZyXEL&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Tricks are one thing, but it can also act is a normal Wi-Fi access point which people connect to of their own free volition; see an SSID called “Free wifi” – sounds good, let’s go! Once you’re connected, you’re in a whole world of trouble, at least you are if you visit any websites &lt;em&gt;that don’t implement sufficient transport layer protection&lt;/em&gt;. And that’s the real story here – unprotected Wi-Fi traffic.&lt;/p&gt;  &lt;p&gt;What you saw in the screens above is the work of &lt;a href="http://tournasdimitrios1.wordpress.com/2011/03/03/dns-spoofing-with-dnsspoof-on-linux/"&gt;dnsspoof&lt;/a&gt; which in simple terms, was able to intercept the request for stackoverflow.com and rather than routing it to their server, routed it to the web server running in the Pineapple instead. The screens above were served from the Pineapple in response to the Stack Overflow request and in fact configured this way it will respond with that same page regardless of the site being requested, so long as it’s an HTTP request and not an HTTPS one.&lt;/p&gt;  &lt;p&gt;What this demonstrates is that the Pineapple controls the traffic – anything sent over HTTP can be manipulated with clever software, including where requests are routed to. Now let’s imagine that there is no DNS spoofing and the Pineapple simply passes requests through to a network bridge and out over an internet connection. It might look like this:&lt;/p&gt;  &lt;p&gt;&lt;img alt="Launching an MiTM attack with the Pineapple" src="http://lh6.ggpht.com/-MAg76YqFJ0Q/UW539WEKwXI/AAAAAAAAFHM/E6yZNVJZA7A/WiFi-Pineapple5.png?imgmax=800" /&gt;&lt;/p&gt;  &lt;p&gt;What this means is that the Pineapple and the attacker’s PC it’s connected to now control the unencrypted traffic. Anything sent over that connection – including Stack Overflow’s cookies – may be intercepted by the attacker. As you’ll see in the demo while I’m on stage, that is a very serious security risk.&lt;/p&gt;  &lt;h4&gt;What’s the risk?&lt;/h4&gt;  &lt;p&gt;I mean it’s just some cookies, why should you care? Let’s go back to the basics for a moment which means understanding what SSL is about and it boils down to three things:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Assurance of identity – only the legitimate owner of the site should be able to serve up a certificate for it&lt;/li&gt;    &lt;li&gt;Integrity – the content moving backwards and forwards over the connection can’t be manipulated&lt;/li&gt;    &lt;li&gt;Confidentiality – the content also can’t be eavesdropped on&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;It’s that last point that most people associate with SSL and they expect passwords and banking info to be kept from prying eyes. But there’s other info that needs to be protected as well and it’s not as immediately obvious. Should the demo gods be kind to me, the audience will see one simple request to a Stack Overflow API appear on the attacker’s PC. It’s a request to the up-vote service and along with the request is the authentication cookie used to identify the user. Because it’s sent over an unencrypted connection it can be intercepted and once it’s intercepted then the session can be hijacked. The attacker will simply recreate the cookie in his browser (that’ll be me) and badaboom – they’re logged on as the victim!&lt;/p&gt;  &lt;p&gt;One thing I do want to point out is that the guys at Stack Overflow understand this intimately. As &lt;a href="http://www.troyhunt.com/2012/08/is-stack-overflow-secure-kind-of.html"&gt;I’ve written before&lt;/a&gt;, these are without doubt some of the smartest developers on the planet and they’ve made a conscious decision about the risk versus benefit of SSL. They know exactly what they’re doing. In fact Nick Craver wrote a very good blog post just last week on &lt;a href="http://nickcraver.com/blog/2013/04/23/stackoverflow-com-the-road-to-ssl/"&gt;the road to SSL&lt;/a&gt; where he outlines the sort of challenges they need to overcome in order to secure the transport layer. As you can read in &lt;a href="http://webmasters.stackexchange.com/questions/47636/how-do-i-transition-to-ssl-without-affecting-pagerank"&gt;this question&lt;/a&gt;, clearly there is an intention to make Stack Overflow SSL only so that’s a very positive move in the right direction security wise.&lt;/p&gt;  &lt;h4&gt;Get Pineapple Surprise! on GitHub&lt;/h4&gt;  &lt;p&gt;I want to make the implementation of this freely available to the community in part so that others can take it and adapt it (contributions are welcome!) and in part so that it’s clear that despite the obvious opportunity to do evil, it’s not doing anything nasty. You can find it on GitHub here: &lt;a href="https://github.com/troyhunt/PineappleSurprise"&gt;https://github.com/troyhunt/PineappleSurprise&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Told you it was rudimentary! The index page merely replaces the default one on the device that did nothing other than a client-side redirect by meta tag to redirect.php. Replacing the existing index page keeps the URL clean – whatever resource is requested is served over that URL.&lt;/p&gt;  &lt;p&gt;There’s some logging that happens right up front in the file but it is very, very consciously only grabbing info that would be logged by a webserver anyway: time stamp, requested address, HTTP accept headers (to identify whether it’s an API call or a browser call), the IP address of the device (helps for looking at associated requests and the user agent (should give you an idea of the client being used).&lt;/p&gt;  &lt;p&gt;What’s not logged is far more important and that’s cookies. They’re reflected back to the screen as you can see above, but they are absolutely, positively not logged anywhere and for those that did (do?) come along to my talk, the reason will be crystal clear.&lt;/p&gt;  &lt;h4&gt;tl;dr&lt;/h4&gt;  &lt;p&gt;Secure your web services! Anything you don’t want an attacker observing or manipulating needs to be sent over HTTPS and that &lt;em&gt;includes&lt;/em&gt; auth cookies. Oh – and turn off your Wi-Fi in public!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/3rxtzTSDwm4" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7468976783809349588?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7468976783809349588?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/3rxtzTSDwm4/pineapple-surprise-mixing-trusting.html" title="Pineapple Surprise! Mixing trusting devices with sneaky Wi-Fi at #wdc13" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-L5KdFbSVjTo/UYMVniTrZaI/AAAAAAAAFOU/qrgNYBvgWqA/s72-c/Photo-2-05-13-8-53-502.jpg?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/pineapple-surprise-mixing-trusting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04BQ3Y6fSp7ImA9WhBUE0g.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-3746100517502727189</id><published>2013-05-01T07:02:00.001+10:00</published><updated>2013-05-01T07:05:52.815+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-01T07:05:52.815+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Introducing the OWASP Top 10 Web Application Security Risks for ASP.NET on Pluralsight</title><content type="html">&lt;p&gt;I’ve been a little bit busy the last few months and here’s why – my first Pluralsight course, the &lt;a href="http://www.pluralsight.com/training/Courses/TableOfContents/owasp-top10-aspdotnet-application-security-risks"&gt;OWASP Top 10 Web Application Security Risks for ASP.NET&lt;/a&gt;. Actually, if I’m honest, it’s been a lot longer than that in the making as my writing about the OWASP Top 10 goes all the way back to right on three years ago now. It begin with the &lt;a href="http://www.troyhunt.com/2010/05/owasp-top-10-for-net-developers-part-1.html"&gt;blog series&lt;/a&gt; followed by the &lt;a href="http://www.troyhunt.com/2011/12/free-ebook-owasp-top-10-for-net.html"&gt;free eBook&lt;/a&gt; then last year the &lt;a href="http://www.troyhunt.com/2013/01/the-problem-with-website-security-is-us.html"&gt;instructor lead training for QA&lt;/a&gt; and now finally, a complete online video course via Pluralsight.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.pluralsight.com/training/Courses/TableOfContents/owasp-top10-aspdotnet-application-security-risks"&gt;&lt;img width="500" height="109" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 30px 0px 20px; border-left: 0px; display: inline; padding-right: 0px" alt="Pluralsight - hardcore developer training" src="http://lh3.ggpht.com/-q3QldIEdNp0/UYAxVNzS5ZI/AAAAAAAAFN0/WMppUgeA4ls/pluralsight-fullcolor-500x109-v1%25255B1%25255D.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;For the uninitiated, Pluralsight is what they call “hardcore developer training” and it’s predominantly produced by fellow MVPs, community leaders and other subject matter experts who many of you would be very familiar with (there’s a great little article on TechCrunch with a very glowing overview of Pluralsight &lt;a href="http://techcrunch.com/2013/01/02/developer-training-platform-pluralsight-raises-27-5-million-from-insight-venture-partners/"&gt;here&lt;/a&gt;). The quality of Pluralsight’s authors really are top notch and it is an honour to be able to contribute to my own little corner of expertise. The content is subscription based and starts at only $29 per month (and there’s a free 10 day, 200 minute trial if you’re not sure). You can watch it online via the browser or native clients for a variety of devices and depending on your subscription level, even save the courses offline.&lt;/p&gt; &lt;p&gt;Pluralsight as a training service is an absolutely fantastic resource and one I have used on many, many different occasions now. The breadth of content is &lt;em&gt;huge&lt;/em&gt; and includes everything from the latest enhancements to ASP.NET 4.5, nitty gritty detail about LINQ, lots of fancy tricks in Entity Framework and a heap more in the ASP.NET space. Then of course you’ve got everything you could want to know about client technologies such as jQuery, CSS, HTML and on and on. Take a spin through the &lt;a href="http://pluralsight.com/training/Courses/TopCourses"&gt;top courses&lt;/a&gt; and you start to get a sense of the breadth of content.&lt;/p&gt; &lt;p&gt;One thing I’ve learnt working with a bunch of different people over the years is that everyone has their own style of learning. We all like absorbing information in different ways and what I like about the structure of Pluralsight is that you have the choice to either sit through an entire course and go through in a very structured fashion, pick just one module on a discrete topic and learn everything about it or drill down even further and just pick one clip from within the module.&lt;/p&gt; &lt;p&gt;I’ve used each of these approaches in the past, most recently when I really wanted to get up to speed on Entity Framework 5 enum support. There’s plenty of info out there on this but I knew that Julie Lerman is &lt;em&gt;the &lt;/em&gt;person when it comes to EF so I spent 6 minutes watching that topic in her &lt;a href="http://pluralsight.com/training/courses/TableOfContents?courseName=entity-framework5-getting-started"&gt;Getting Started with Entity Framework 5 course&lt;/a&gt; and had exactly what I needed to, well, get started!&lt;/p&gt; &lt;p&gt;Let me tell you a little more about what I’ve created.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;h4&gt;What’s in the OWASP Top 10 for .NET developers course?&lt;/h4&gt; &lt;p&gt;Getting back to my own course, there are (unsurprisingly) 10 modules that align to the OWASP Top 10. This now very familiar list includes:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Injection&lt;/li&gt; &lt;li&gt;Cross-Site Scripting (XSS)&lt;/li&gt; &lt;li&gt;Broken Authentication and Session Management&lt;/li&gt; &lt;li&gt;Insecure Direct Object References&lt;/li&gt; &lt;li&gt;Cross-Site Request Forgery (CSRF)&lt;/li&gt; &lt;li&gt;Security Misconfiguration &lt;/li&gt; &lt;li&gt;Insecure Cryptographic Storage&lt;/li&gt; &lt;li&gt;Failure to Restrict URL Access&lt;/li&gt; &lt;li&gt;Insufficient Transport Layer Protection&lt;/li&gt; &lt;li&gt;Unvalidated Redirects and Forwards&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;What I think is important though is how I’ve structured these modules. You see, my view is that for developers to really grok security concepts they need to see it in action. Of course they need to understand the principles behind it as well, but there’s nothing quite like seeing password hashes cracked or wireless traffic sniffed, that stuff really hits home. I also believe that it’s absolutely essential that risks are related back to practical instances where they’ve been exploited so every module has an industry precedent it refers to. It’s very easy to treat a risk as hypothetical or academic &lt;em&gt;until&lt;/em&gt; someone actually goes and does nasty things with it then suddenly everyone starts paying attention (&lt;a href="http://en.wikipedia.org/wiki/Firesheep"&gt;Firesheep&lt;/a&gt; was a great example of this in terms of the risk of not having SSL everywhere).&lt;/p&gt; &lt;p&gt;What all this means is that each module is broken down like this:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;An introduction to the topics that will be covered in the course&lt;/li&gt; &lt;li&gt;The OWASP overview of the risk including severity, threat agents and attack vectors&lt;/li&gt; &lt;li&gt;Anatomy of an attack – this is the interesting bit as it involves exploiting the app&lt;/li&gt; &lt;li&gt;The risk in practice where there’s been a precedent of it being exploited in the industry&lt;/li&gt; &lt;li&gt;Mitigation demos – usually four or five ways of mitigating the risk&lt;/li&gt; &lt;li&gt;Further information on the risk via slides or more demos&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;It’s a very practical course with most of it living in Visual Studio and the browser then where it adds value or just needs further explanation there’s info and graphics on slides. Certainly the preference is always to demonstrate though as again, practical relevance is what really helps security principles hit home.&lt;/p&gt; &lt;p&gt;All in all, there’s 8 hours and 6 minutes worth of content with some modules being relatively short (broken auth and session managements is under half an hour) and others being more comprehensive (transport layer security is nearly one and a quarter hours). I’ve tried to only include content of tangible benefit and break them down into very discrete units. Whilst 8 hours is quite long for a Pluralsight course, there are 121 clips in total so you’re looking at about 4 mins each. The longest is just over 11 mins and demonstrates an attacker sniffing wireless traffic whilst the victim browses a website then has their session hijacked due to insufficient transport layer protection. IMHO this is the best piece of content in the whole thing!&lt;/p&gt; &lt;h4&gt;How should you take this course?&lt;/h4&gt; &lt;p&gt;Like I said earlier, everyone likes learning differently and I totally get that some people like bite-sized information about discrete topics and others want to absorb things in a more formal, structured fashion. How you take this course will also come down to your familiarity with the topic; you may have a good understanding of the intricacies of SQL injection but CSRF remains a bit strange. Perhaps XSS is familiar but why unvalidated redirects are a risk seems odd.&lt;/p&gt; &lt;p&gt;What I will say though is that many of these risks have interdependencies and the course material does touch on this at multiple stages throughout the modules. I talk a lot about whitelists which are first introduced in the SQL injection module, the membership provider concepts in the third module on broken authentication are then reused at multiple points such as when I talk about cryptographic storage. The course builds on itself, module by module.&lt;/p&gt; &lt;p&gt;Ideally, absorb the whole thing piece by piece and in sequence. The assumptions I make about the material that has already been covered and the knowledge gained will make a lot more sense. There are also various segue ways into tangential security issues throughout the modules so they do cover more than just what the name might imply.&lt;/p&gt; &lt;h4&gt;&lt;em&gt;Why &lt;/em&gt;should you take this course?&lt;/h4&gt; &lt;p&gt;We have a problem. As developers, we’ve got a lot to answer for and you see the results of security shortcuts on the news on a daily basis. As I’ve written before, &lt;a href="http://www.troyhunt.com/2013/01/the-problem-with-website-security-is-us.html"&gt;the problem with website security is us&lt;/a&gt;. We are the ones designing the systems which expose excessive data, leak error messages and fail to properly secure credentials. Sometimes these are decisions made beyond our control with full consciousness of the risks but more often than not, it’s “us” thinking that encoding is encryption, that our admin systems are safe because nobody knows they’re there and that salting and hashing passwords is enough. It’s not, they’re not and it isn’t.&lt;/p&gt; &lt;p&gt;In so many of these cases it would have taken just one person on the development team to say “Hey, let’s think twice about this” and disaster would have been averted. But of course you don’t know what you don’t know and that’s why the education component is so critical.&lt;/p&gt; &lt;p&gt;My overwhelming strongly held belief – and this isn’t just about security – is that we must invest in our developers. The difference in cost between the good ones and the bad ones is a paltry sum (if indeed the good ones earn any more at all) but the difference in effectiveness is measured in an order of magnitude. When you do look at it in the context of security, investing in education will always seem like an excellent idea in hindsight. Whilst First State Super was &lt;a href="http://www.theage.com.au/it-pro/government-it/super-it-blunder-risked-23m-contract-20111024-1mf9f.html"&gt;looking down the barrel of losing a $23m contract&lt;/a&gt; because the developers didn’t understand the simple risk of insecure direct object references, security education must have seemed like a fine idea and there are many, many similar examples.&lt;/p&gt; &lt;p&gt;If security is important to you as either a developer or someone responsible for a development team, find a day. Just one day and you’ll get all the way through the course. Do it over a week and knock a couple of hours of each day before coffee break and you’re done. For most developers, they’ll end that week having learnt a whole lot of totally new stuff and who knows, it may quite possibly one day save their employer from ending up on the front page of the news.&lt;/p&gt; &lt;h4&gt;Inside the sausage factory&lt;/h4&gt; &lt;p&gt;Moving away from the course content itself, I thought some people might be interested in what goes into creating a Pluralsight course as there’s a lot more to it than what you might assume from face value alone. Firstly, for a new author such as myself there’s an audition process and a pitch; you’ve got to have both good content and be able to deliver it to Pluralsight’s standard. As an author, there’s a bit of work involved but as a customer, you really appreciate this as it means you get a consistent high-quality experience across courses.&lt;/p&gt; &lt;p&gt;Once all that’s ticked off the real hard work begins. For each module I produced I’d work out a series of clips and create a run-sheet of how I’d execute each one. This involved preparing slides, a sample app and then usually doing a dry-run of each clip before recording it. When everything was ready I’d drop a screen back to 1024x768 (the default video resolution) and try to record the whole thing in one go with &lt;a href="http://www.techsmith.com/camtasia.html"&gt;Camtasia&lt;/a&gt;. Kind of.&lt;/p&gt; &lt;p&gt;I say “kind of” because although it’s one go, every time I so much as stuttered or ummed or rambled ever so slightly, I’d record it again. &lt;em&gt;This&lt;/em&gt; is what killed me with this course because I just didn’t want to produce anything I didn’t feel was absolutely perfect. I’ve seen plenty of video material in the past that just wasn’t slick – those little glitches really irk me and I wasn’t going to be letting any of them into my course. What it meant though is that there’s rarely more than 10 seconds of video that was recorded in one continuous flow. That’s not because I continually made errors (there’s a degree of that), but rather because I wanted to get a clear message across then think very, very carefully about what made sense next.&lt;/p&gt; &lt;p&gt;Sometimes I found myself having to stop and say “Ok, when I produce this, go back to that earlier section then overlay the audio I’m about to record into the middle”. Other times I’d have to re-record audio when I listened to it later on during editing because an important part of the story was missing, I’d just skipped it in the excitement of the recording. What it means is that my Camtasia timelines all look like this:&lt;/p&gt; &lt;p&gt;&lt;img width="800" height="248" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Camtasia timeline with lots of editing" src="http://lh4.ggpht.com/-dBSqlpr3ERw/UYAxVpZJX2I/AAAAAAAAFN8/oufdR2elUU0/image2.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;What you’re seeing here is lots of chopping and editing just to get everything lining up perfectly. It ain’t pretty to look at, but it makes a lot of difference to listen to.&lt;/p&gt; &lt;p&gt;All of this comes at a cost – a &lt;em&gt;time&lt;/em&gt; cost. Just to give you a rough idea, here’s how I reckon it breaks down for every minute of produced video you watch:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;3 minutes of preparation (run sheet, sample app, slides, general research)&lt;/li&gt; &lt;li&gt;2 minutes of captured video&lt;/li&gt; &lt;li&gt;7 minutes of editing&lt;/li&gt; &lt;li&gt;2 minute of producing, packaging slides, app and assessment&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;In other words, every time you watch a minute of video it has taken about 12 minutes to get it to where it is. Across 8 hours and 6 mins of content that’s about 113 hours of work. That doesn’t sound too bad, but it’s amazingly monotonous, at least the editing is. It basically means I’ve spent my evenings and weekends for the last few months looking at this:&lt;/p&gt; &lt;p&gt;&lt;img width="640" height="480" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="My home workstation" src="http://lh6.ggpht.com/-Zv6ZsnRg4HU/UYAxWRFw7RI/AAAAAAAAFOE/QzG1MkaEDXE/Photo-21-04-13-19-22-284.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;I started all this at the end of Jan and in amongst all this I had numerous dramas to deal with including needing to &lt;a href="http://www.troyhunt.com/2013/01/102-simple-steps-for-installing-and.html"&gt;completely rebuild my machine after a catastrophic crash&lt;/a&gt;, trying to schedule recording around noisy kids, re-recording an entire clip due to noisy kids in the background and being away at the MVP summit for a week. It also finally pushed me into getting properly acquainted with &lt;a href="http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html"&gt;my Pineapple&lt;/a&gt; (it makes an appearance in the section on transport layer protection) which was a very lengthy (and ultimately very fulfilling) process.&lt;/p&gt; &lt;p&gt;This was an epic piece of work but I’m enormously happy with the result, it’s undoubtedly the most comprehensive, polished tutorial I’ve produced to date.&lt;/p&gt; &lt;h4&gt;What’s next?&lt;/h4&gt; &lt;p&gt;I have some ideas… no really, over the last six weeks as the end has begun to come into sight I’ve started jotting down notes for a new security course that’s quite a bit different to this one. In fact I think I have a great angle, all I need is for this course to prove popular enough for Pluralsight to want to invite me back, so it’s up to you now!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/o01ecV2moWM" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/3746100517502727189?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/3746100517502727189?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/o01ecV2moWM/introducing-owasp-top-10-for-aspnet-on.html" title="Introducing the OWASP Top 10 Web Application Security Risks for ASP.NET on Pluralsight" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-q3QldIEdNp0/UYAxVNzS5ZI/AAAAAAAAFN0/WMppUgeA4ls/s72-c/pluralsight-fullcolor-500x109-v1%25255B1%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/05/introducing-owasp-top-10-for-aspnet-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkECQn06fyp7ImA9WhBUEkk.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-394669202617905582</id><published>2013-04-29T16:06:00.001+10:00</published><updated>2013-04-29T23:04:23.317+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-29T23:04:23.317+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>Your Mac, iPhone or iPad may have left the Apple store with a serious security risk</title><content type="html">&lt;p&gt;Just over a year ago to the day, my wife and I walked into the Apple store in Sydney’s CBD and bought her a shiny new MacBook Air. Macs weren’t familiar territory for us so we happily accepted the offer for a staff member to walk us through some of the nuts and bolts of OSX. That was a handy little starter and we left the store none the wiser that &lt;strong&gt;&lt;em&gt;the machine now had a serious security risk that wouldn’t become apparent for another year.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;A couple of weeks ago I wrote about &lt;a href="http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html"&gt;my new favourite device, the Wi-Fi Pineapple&lt;/a&gt;. Despite its friendly tropical name, the Pineapple is a piece of cigarette-pack-sized professional security equipment I picked up online for $100 to help me demonstrate secure coding practices. Specifically, it’s helping me educate web developers about the risk of not using encryption between browsers and the websites they’re communicating with, something that needs to be built into the design of the site itself.&lt;/p&gt; &lt;p&gt;Among various party tricks packed into this little piece of equipment is a feature called “Karma” and it works like this: When you connect a device to a wireless network – let’s imagine the network is named “WILSON” for the purposes of demonstration – the device then continues to look for that network for perpetuity. What that means is that the device (laptop, smart phone, tablet, etc.) is running around shouting &lt;strong&gt;&lt;em&gt;“WILSON, WILSON, where are you WILSON?”&lt;/em&gt;&lt;/strong&gt; What Karma says when it hears this is “I’m Wilson, let’s get connected” and if WILSON wasn’t originally secured with a wireless password, the device connects to the Pineapple automatically. &lt;strong&gt;&lt;em&gt;It now looks just like a normal wireless connection and it has been made without any action whatsoever on the user’s behalf.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;You didn’t know this could happen? It’s written right there on the wireless network screen of every iOS device, albeit without explaining that “Known” means nothing more than an access point claiming to be exactly what the device has just publicly broadcast it’s looking for:&lt;/p&gt; &lt;p&gt;&lt;img width="396" height="368" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="iPhone stating that &amp;quot;Known networks will be joined automaticaly&amp;quot;" src="http://lh3.ggpht.com/-8FEPEeiuMIU/UX4NxSQrOqI/AAAAAAAAFL8/rNtux8bPlHM/iPhone-56.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;So what’s the risk of a device connecting to the Pineapple (or any similar equipment – it’s not the only one) without knowing it? It means that every single byte of data that passes through that connection and is not encrypted can be read or changed by an attacker. &lt;strong&gt;&lt;em&gt;Passwords, personal information, photos, videos and anything else not properly protected by the website can be intercepted. Links to secure login pages, documents, emails and even banking websites can be manipulated when that protection doesn’t exist.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;What’s now evident is that a large number of devices are leaving Apple stores after having been connected to an insecure network leaving them at risk for years to come. Let me explain.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;h4&gt;The “Apple Demo” conundrum&lt;/h4&gt; &lt;p&gt;When I wrote the blog post I mentioned above I commented that whilst testing the Pineapple I noticed some unexpected traffic flowing through it, traffic that looked like this:&lt;/p&gt; &lt;p&gt;&lt;img alt="My wife's MacBook Air connecting to the Pineapple" src="http://lh3.ggpht.com/-MoH38Mcz4KA/UW54RaXPubI/AAAAAAAAFKc/0UvZcHcG5nk/image171.png?imgmax=800"&gt;&lt;/p&gt; &lt;p&gt;This is my wife’s MacBook Air and I was able to intercept her internet traffic simply because she had wandered into range. This struck me as odd at the time because she had already been connected to our (secure) home wireless that also had a much stronger signal than the Pineapple’s. Sure enough though, she was now connected to the Pineapple’s rogue access point under the name “Apple Demo”:&lt;/p&gt; &lt;p&gt;&lt;img width="349" height="173" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="My wife's MacBook Air connected to the &amp;quot;Apple Demo&amp;quot; rogue network" src="http://lh5.ggpht.com/-P2abQx9ZhTU/UX4NyJx6XHI/AAAAAAAAFME/9PW3f2Wu6n0/image6.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;I made a note of this in the post then moved on.&lt;/p&gt; &lt;p&gt;Then this weekend just gone I was at a Microsoft event in a small room with dozens of fellow techie people, all with their laptops out for hours on end. Some of them were Macs. In amongst participating in the activities of the day, I was also preparing for a conference talk I’m doing down in Melbourne later this week which will involve using the Pineapple to demonstrate the risk of websites that don’t implement sufficient security measures. Without giving away the details of a yet-to-occur event, I had configured the device to simply see if anything would connect to it – and it did. Here’s what happened:&lt;/p&gt; &lt;p&gt;&lt;img width="723" height="60" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Probe requests for the SSID named &amp;quot;Apple Demo&amp;quot;" src="http://lh4.ggpht.com/-KRX7Js7JEFU/UX4NyqAj1cI/AAAAAAAAFMM/9JNNhvaOiiw/image2.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;This is a “Probe Request” from a Wi-Fi device which as I explained earlier, is essentially the device calling out “WILSON” except that in this case, it’s calling out “Apple Demo”. The Pineapple then responds with “I’m Apple Demo” and a successful association is made. Had the Pineapple been connected to the internet, all the unencrypted communication between the device and any websites it visited or services any apps connected to could have been logged or manipulated.&lt;/p&gt; &lt;p&gt;In the image above, the first and last lines contain the partially blurred MAC address – the uniquely identifying fingerprint that all network devices have – of the device that connected. The first three sets of two digits are the organisationally unique identifier which tells us who manufactured the device. You can &lt;a href="http://standards.ieee.org/cgi-bin/ouisearch?14-10-9f"&gt;check it up online&lt;/a&gt; and you’ll get a result that’s not too surprising:&lt;/p&gt; &lt;p&gt;&lt;img width="740" height="160" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Apple shown to own the OUI of the device that connected to &amp;quot;Apple Demo&amp;quot;" src="http://lh6.ggpht.com/-6p3soVmGdoM/UX4Ny2xMcHI/AAAAAAAAFMU/N64r6ngDtxo/SNAGHTML293ce913.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;In the very small amount of testing I’d done with the Pineapple, this was the second Mac that had connected to the same insecure network it had previously been associated to. This was more than just coincidence and far too prevalent for such a small sample size. It was time a visit to the Apple store.&lt;/p&gt; &lt;h4&gt;The Sydney Apple store&lt;/h4&gt; &lt;p&gt;As is usually the case with Apple, the Sydney store is an impressive piece of architecture with an amazing glass facade:&lt;/p&gt; &lt;p&gt;&lt;img width="564" height="395" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="The Apple store in Sydney" src="http://lh3.ggpht.com/-6Mtdzr3w5N4/UX4Nzvh6uSI/AAAAAAAAFMc/WO6iA9fp0x8/sydney_hero2.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;I’d made an appointment with a Genius to take a look at my iPad and had a bit of time to kill first so thought I’d take a look at what all the display models were connecting to. First up was an iPad mini:&lt;/p&gt; &lt;p&gt;&lt;img width="500" height="326" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="An iPad Mini connected to &amp;quot;Apple Demo&amp;quot;" src="http://lh6.ggpht.com/-4_yiDw8xu2I/UX4N0Drv1yI/AAAAAAAAFMk/jrGCqAK4JUk/Photo-28-04-13-11-40-192.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;And then a MacBook Pro:&lt;/p&gt; &lt;p&gt;&lt;img width="500" height="326" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="A MacBook Pro connected to &amp;quot;Apple Demo&amp;quot;" src="http://lh4.ggpht.com/-fNCBtCWCpzI/UX4N0x1-bAI/AAAAAAAAFMs/D4ujwfgW584/Photo-28-04-13-11-44-592.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;Although not surprising, it’s reasonable validation of the assumption regarding the origin of the other “Apple Demo” machines I’d been seeing. Of course the main thing is that the network is still insecure – there’s no padlock icon hence no Wi-Fi authentication is required. Now none of that matters in this case anyway – you’re not exactly about to do anything of a nature where you’d want to protect your data using floor stock.&lt;/p&gt; &lt;p&gt;I go upstairs for my appointment with the Genius and explain two issues I’m genuinely having with the iPad that irk me. Both issues will require internet to demonstrate. The Genius – let’s call him “John” – is exceptionally helpful and he promptly directs me over to the Wi-Fi settings on the iPad and has me select this:&lt;/p&gt; &lt;p&gt;&lt;img width="600" height="210" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="My iPad connected to the insecure &amp;quot;Apple Store&amp;quot; network on instruction from the Genius" src="http://lh4.ggpht.com/-gwqB_-LwkCI/UX4N1ZjUrXI/AAAAAAAAFM0/8-6sqJtj5tc/Photo-28-04-13-11-58-452.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;It’s “Apple Store” rather than “Apple Demo” but the risk is identical – there’s no wireless password and the device will now happily remember this name and attempt to reconnect to it at any time. We finish our session and I leave the store.&lt;/p&gt; &lt;p&gt;I come home, turn on the Pineapple and immediately see this:&lt;/p&gt; &lt;p&gt;&lt;img width="731" height="57" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="My iPad connecting to the Pineapple due to the insecure &amp;quot;Apple Store&amp;quot; network" src="http://lh5.ggpht.com/-u_zLgUHOLsc/UX4N11MLqHI/AAAAAAAAFM8/jUouLItVd2k/image311.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;My once-secure iPad has now become vulnerable. As soon as I walked out of the store the device started looking to reconnect to anything that would acknowledge it. Consider the consequences of this: &lt;strong&gt;&lt;em&gt;as soon as someone walks out of the Apple store after receiving support it’s highly likely that an attacker can begin immediately monitoring their internet traffic.&lt;/em&gt;&lt;/strong&gt; It’s that easy.&lt;/p&gt; &lt;h4&gt;What can you do if you own a Mac?&lt;/h4&gt; &lt;p&gt;When I looked at the network properties of my wife’s Mac, obviously there was a stored connection to Apple Demo:&lt;/p&gt; &lt;p&gt;&lt;img width="686" height="598" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Viewing network properties in Mac OSX" src="http://lh6.ggpht.com/-KRFncO0_JKI/UX4N2YC-U3I/AAAAAAAAFNE/9JjFun90HtY/image5.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;What really made the risk hit home though was when I looked at the “Advanced…” settings of the network:&lt;/p&gt; &lt;p&gt;&lt;img width="631" height="357" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="The &amp;quot;Apple Demo&amp;quot; network at the top of the network priority list" src="http://lh6.ggpht.com/-QeSw5Rt6a9U/UX4N3OurX7I/AAAAAAAAFNM/oCOnQ-EbNIE/image3.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;The Apple Demo network is the first on the list and will take priority over all networks that came after it. My wife’s machine first connected to Apple’s network then we came straight home and set it up on our own. Even now, one year later, the machine is still prioritising the first network it connected to and dropping off the newer one. This meant that the Pineapple was able to hijack the connection &lt;strong&gt;&lt;em&gt;even when the machine already had a perfectly legitimate association to a wireless access point.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The solution is simply to delete any networks where the Security is “None”. That’s easy on the Mac, not so much on iOS.&lt;/p&gt; &lt;h4&gt;What can you do if you own an iOS device?&lt;/h4&gt; &lt;p&gt;It’s a little trickier in iOS as &lt;a href="https://discussions.apple.com/thread/2738932?start=0&amp;amp;tstart=0"&gt;there’s no way of viewing the networks the device has previously connected to&lt;/a&gt; and consequently no way of removing the insecure ones. In fact the only way you can forget an individual network and not automatically reconnect to it is by selecting it when the network is in range:&lt;/p&gt; &lt;p&gt;&lt;img width="400" height="362" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="&amp;quot;Forget this Network&amp;quot; on the iPhone 5" src="http://lh3.ggpht.com/-G5yrtWY5AgQ/UX4N3o12BUI/AAAAAAAAFNU/b8BKQBulaqM/iPhone-52.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;This isn't going to do most people much good as they’re not exactly going to travel back to the store just to have their device forget the network. If you think it might have gone through the demo or support process in store or for that matter connected to &lt;em&gt;any &lt;/em&gt;unprotected wireless network you’ll need to erase all your trusted ones and start from scratch.&lt;/p&gt; &lt;p&gt;Jump over to “Settings” –&amp;gt; “General” –&amp;gt; “Reset” and then “Reset Network Settings”:&lt;/p&gt; &lt;p&gt;&lt;img width="400" height="445" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="&amp;quot;Reset Network Settings&amp;quot; on the iPhone 5" src="http://lh6.ggpht.com/-hZcPdgbam8c/UX4N4YwSG_I/AAAAAAAAFNc/nEZK8WjCNP4/iPhone-55.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;It’s going to make it unpleasant if you regularly connect to secure networks you now need to go and retrieve passwords for again, but it will ensure your iOS device hasn’t left Apple with a serious security risk.&lt;/p&gt; &lt;h4&gt;Can’t this happen after connecting to &lt;em&gt;any &lt;/em&gt;insecure wireless network?&lt;/h4&gt; &lt;p&gt;It sure can. If you go down to McDonalds and jump on their free Wi-Fi &lt;strong&gt;&lt;em&gt;and it doesn’t require a password&lt;/em&gt;&lt;/strong&gt;, you’ve got exactly the same problem. The difference, of course, is that McDonalds makes fast food whilst Apple makes devices with networking capabilities. McDonalds (and similar) need to lift their game and secure their network (and of course deal with the usability issues that creates) but to some degree they can be forgiven for the oversight.&lt;/p&gt; &lt;p&gt;When you buy a brand new phone or tablet or laptop you expect to walk out of the store with a secure piece of equipment, certainly one that would take some amount of effort to exploit. That’s not what’s happening after Apple connects it in-store and that’s the real story – &lt;strong&gt;&lt;em&gt;it’s insecure by default and vulnerable to a simple attack from day one.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This may well be the case with other stores as well. I don’t know how Microsoft or Samsung or other retail outlets selling similar devices and offering a similar setup service handle wireless connections, but clearly if they’re not using a protected network then they’re leaving consumers with exactly the same risks.&lt;/p&gt; &lt;h4&gt;Keeping customers safe is as easy as pie&lt;/h4&gt; &lt;p&gt;Paradoxically, there’s a little meat pie shop just around the corner from Apple’s gleaming architectural masterpiece. The pie shop is nothing more than a hole in the wall with a counter one staff member can barely fit behind. Somehow they still manage to offer free Wi-Fi and use an ingenious means of properly securing it for their customers. It works like this:&lt;/p&gt; &lt;p&gt;&lt;img width="400" height="658" title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" alt="Pie shop advising the Wi-Fi password is available at the counter" src="http://lh6.ggpht.com/-VXdOa5t5Wkw/UX4N4zBIMxI/AAAAAAAAFNk/W9L7jTSgSnE/Photo-28-04-13-11-14-373.jpg?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;That’s all it takes – kindly provide customers with a Wi-Fi password when they ask and this entire problem just disappears. Good work by the pie shop!&lt;/p&gt; &lt;h4&gt;For the more technically minded&lt;/h4&gt; &lt;p&gt;For those who want some more detail, here are a few key points:&lt;/p&gt; &lt;p&gt;Traffic sent via HTTPS can’t be intercepted and either read or manipulated by a man in the middle, at least not without resorting to attacks against the protocol such as &lt;a href="http://www.computerworld.com/s/article/9236537/Researchers_devise_new_attack_techniques_against_SSL"&gt;BEAST&lt;/a&gt;. Apps that make calls to APIs over SSL &lt;em&gt;and validate the certificate&lt;/em&gt; are in good shape as are browsing sessions which occur &lt;em&gt;entirely &lt;/em&gt;over HTTPS.&lt;/p&gt; &lt;p&gt;Browsing sessions that &lt;em&gt;begin&lt;/em&gt; over HTTP are not safe even if they redirect to HTTPS, for example if you simply type americanexpress.com into the address bar and the browser defaults to an unencrypted scheme (read about &lt;a href="http://www.thoughtcrime.org/software/sslstrip/"&gt;sslstrip&lt;/a&gt; if you want to know more). Webpages which load login forms over HTTP or embed them in an iframe within an HTTP page (even if the login page is HTTPS) are also at risk as the original HTTP request can be manipulated to load any other content an attacker desires (such as a rogue login page). Authentication cookies not flagged as “secure” and sent over an unencrypted network also pose a serious risk.&lt;/p&gt; &lt;p&gt;The Pineapple can detect probe requests for WPA protected networks but devices looking for them won’t automatically or even manually make the association if you try it that way. You’ll see the names of secure networks listed in the device’s Wi-Fi settings but that’s it – the initial authentication handshake won’t occur and the device won’t connect.&lt;/p&gt; &lt;p&gt;In this case, Wi-Fi security isn’t about protecting the network from unauthorised access nor is it about protecting any given client’s data from monitoring by other clients. This is entirely about not leaving the device in an insecure state long after the association with the network in question has ended.&lt;/p&gt; &lt;h4&gt;Summary&lt;/h4&gt; &lt;p&gt;What all this means is simply this: &lt;strong&gt;&lt;em&gt;if Apple helped you set your device up or provided you with support in the store it’s now exceptionally easy for an attacker to monitor and manipulate the majority of internet traffic that passes through it.&lt;/em&gt;&lt;/strong&gt; So long as an attacker can get in range of the wireless (and I’ve already done it accidentally and with good intent on multiple occasions), they own your device.&lt;/p&gt; &lt;p&gt;Obviously this was all tested on devices that had been through the Sydney store (this was the most likely source of the one I observed at the conference on the weekend). I don’t know how other Apple stores in other locations handle the situation described above, but given the carbon copy design, staff and experience in stores across the globe, I’d be surprised if the practice differed.&lt;/p&gt; &lt;p&gt;I’m still a happy iPhone and iPad user. My wife is a happy Mac user. There is nothing about the products per se that is insecure with regards to the information above, it’s simply an in-store process which leaves them vulnerable. It’s also easily rectified by simply putting a password on their wireless – &lt;em&gt;any&lt;/em&gt; password and the devices won’t be fooled into connecting to rogue access points in the future. I know that doesn’t make for as slick an experience as it currently is for customers, but it’s the only way to solve the issue short of the staff manually removing the connection again at the end of the session. Unfortunately, all this is also only any good for new devices and I’ll wager that as of right now there are thousands of devices in Australia alone that have been left vulnerable.&lt;/p&gt; &lt;h4&gt;Disclosure&lt;/h4&gt; &lt;p&gt;Yesterday I contacted Apple and shared the risk regarding their in-store practices:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Recently I've learnt that customers are receiving support for their Apple products in store with the help of Geniuses who connect their devices to unprotected wireless networks, from my experience named either "Apple Demo" or "Apple Store" (certainly this is the case in the George St store in Sydney). The association to a network with no security then leaves the devices vulnerable to inadvertently connecting to rogue access points which respond to probe requests the devices send out specifically looking for the presence of an insecure network it has once known.&lt;/p&gt; &lt;p&gt;In short, when a device leaves an Apple store after having been connected to an insecure network it is now at risk of an attacker hijacking internet traffic. This is a trivial process and easily exploited by those with malicious intent. I've observed this first hand with my wife's MacBook Air and my own iPad as well as observing other Apple devices exhibiting the same behaviour.&lt;/p&gt; &lt;p&gt;Your review and comments would be most appreciated.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;I’ll update the post with any responses.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/S4M2MfZtgno" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/394669202617905582?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/394669202617905582?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/S4M2MfZtgno/your-mac-iphone-or-ipad-may-have-left.html" title="Your Mac, iPhone or iPad may have left the Apple store with a serious security risk" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-8FEPEeiuMIU/UX4NxSQrOqI/AAAAAAAAFL8/rNtux8bPlHM/s72-c/iPhone-56.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/04/your-mac-iphone-or-ipad-may-have-left.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQCRX8_eyp7ImA9WhBUEk8.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-8700833987171440154</id><published>2013-04-17T20:26:00.001+10:00</published><updated>2013-04-29T19:06:04.143+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-29T19:06:04.143+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>The beginners guide to breaking website security with nothing more than a Pineapple</title><content type="html">&lt;p&gt;You know how security people get all uppity about SSL this and SSL that? Stuff like posting creds over HTTPS isn’t enough, you have to load login forms over HTTPS as well and then you can’t send auth cookies over HTTP because they’ll get sniffed and sessions hijacked and so on and so forth. This is all pretty much security people rhetoric designed to instil fear but without a whole lot of practical basis, right?&lt;/p&gt;  &lt;p&gt;That’s an easy assumption to make because it’s hard to observe the risk of insufficient transport layer protection being exploited, at least compared to something like XSS or SQL injection. But it turns out that exploiting unprotected network traffic can actually be extremely simple, you just need to have the right gear. Say hello to my little friend:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Wi-Fi Pineapple" src="http://lh6.ggpht.com/-KA7rofLkRpE/UW538jHFdmI/AAAAAAAAFHE/JPtjHlcp8nw/Untitled-12.png?imgmax=800" width="439" height="317" /&gt;&lt;/p&gt;  &lt;p&gt;This, quite clearly, is a Pineapple. But it’s not just any pineapple, it’s a &lt;a href="http://wifipineapple.com/"&gt;Wi-Fi Pineapple&lt;/a&gt; and it has some very impressive party tricks that will help the naysayers understand the real risk of insufficient transport layer protection in web applications which, hopefully, will ultimately help them build safer sites. Let me demonstrate.&lt;/p&gt; &lt;a name='more'&gt;&lt;/a&gt;  &lt;h4&gt;What is this “Pineapple” you speak of?!&lt;/h4&gt;  &lt;p&gt;What you’re looking at in the image above is a little device about the size of a cigarette packet running a piece of firmware known as “Jasager” (which over in Germany means “The Yes Man”) based on &lt;a href="https://openwrt.org/"&gt;OpenWrt&lt;/a&gt; (think of it as Linux for embedded devices). Selling for only $100, it packs Wi-Fi capabilities, a USB jack, a couple of RJ45 Ethernet connectors and implements a kernal mode wireless feature known as “Karma”.&lt;/p&gt;  &lt;p&gt;Huh? This is starting to slip into the realm of specialist security gear which is increasingly far away from the everyday issues we deal with as software developers. But it’s &lt;em&gt;exceptionally &lt;/em&gt;important because it helps us understand in very graphic terms what the risk of insufficient transport layer protection really is.&lt;/p&gt;  &lt;p&gt;The easiest way to think of the Pineapple is as a little device that sits between an unsuspecting user’s PC (or iPhone or other internet connected device) and the resource they’re attempting to access. What this means is that an attacker is able to launch a “Man in the Middle” or MiTM attack by inspecting the data that flow between the victim and any resources they’re accessing on the web. The physical design of the Pineapple means that victims can connect to it via its Wi-Fi adapter and it can connect to a PC with an internet connection via the physical Ethernet adapter. It all looks a bit like this:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Launching an MiTM attack with the Pineapple" src="http://lh6.ggpht.com/-MAg76YqFJ0Q/UW539WEKwXI/AAAAAAAAFHM/E6yZNVJZA7A/WiFi-Pineapple5.png?imgmax=800" width="880" height="244" /&gt;&lt;/p&gt;  &lt;p&gt;This isn’t the only way of configuring the thing, but being tethered to the attacker’s PC is the easiest way of understanding how it works. The point of all this is that it helps tremendously in understanding the risk of insufficient transport layer protection because ultimately, it’s websites that don’t do a good enough job of this that put the victim at risk. More on that later.&lt;/p&gt;  &lt;p&gt;But why on earth would a victim connect to the Pineapple in the first place?! Well firstly, we’ve become alarmingly accustomed to connecting to random wireless access points whilst we’re out and about. When the average person is at the airport waiting for a flight and sees an SSID named “Free Airport Wi-Fi”, what are they going to do? Assume it’s an attacker’s honeypot and stay away from it or believe that it’s free airport Wi-Fi and dive right in? Exactly.&lt;/p&gt;  &lt;p&gt;But of course that’s still a very conscious decision on behalf of the user. As it turns out, the Pineapple packs a much more subversive party trick to lure unsuspecting victims in…&lt;/p&gt;  &lt;h4&gt;Karma, baby&lt;/h4&gt;  &lt;p&gt;The Karma feature is best explained on the Pineapple website:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Most wireless devices including laptops, tablets and smartphones have network software that automatically connects to access points they remember. This convenient feature is what gets you online without effort when you turn on your computer at home, the office, coffee shops or airports you frequent. Simply put, when your computer turns on, the wireless radio sends out probe requests. These requests say &amp;quot;Is such-and-such wireless network around?&amp;quot; The WiFi Pineapple Mark IV, powered by Jasager -- German for &amp;quot;The Yes Man&amp;quot; -- replies to these requests to say &amp;quot;Sure, I'm such-and-such wireless access point - let's get you online!&amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Wait, what?! So devices just randomly connect to the Pineapple thinking it’s a legitimate AP? Yep, here it is in detail:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Karma saying it is the device&amp;#39;s preferred network" src="http://lh5.ggpht.com/-Qzxq_7EMKgo/UW53-B56MfI/AAAAAAAAFHU/NtElaw8-04c/are-you-my-network3.jpg?imgmax=800" width="525" height="159" /&gt;&lt;/p&gt;  &lt;p&gt;Simple, huh? The problem is that wireless devices are just too damn trusting. Once they establish a connection with an access point they &lt;em&gt;usually&lt;/em&gt; happily reconnect to it at a later date. Of course if it’s a protected network they still need to have the right wireless credentials, but if it’s an open network then the Pineapple asks for no such thing, it just lets the device straight in whether the device &lt;em&gt;thinks&lt;/em&gt; it’s connecting to a legitimate access point or not.&lt;/p&gt;  &lt;p&gt;So that’s how she works, a combination of simply providing an access point that victims connect to on their own free will or being tricked into connecting via Karma. Let’s get it setup and see it all in action.&lt;/p&gt;  &lt;h4&gt;Windows tethering&lt;/h4&gt;  &lt;p&gt;The easiest way to access the device and get started with configuring everything is to tether it to a PC with two network interfaces. This can be one with a couple of NICs connected to Ethernet or in most cases (and as with the diagram above), a laptop which commonly has a wired NIC &lt;em&gt;and&lt;/em&gt; a wireless one.&lt;/p&gt;  &lt;p&gt;What we’re going to do is configure the wired Ethernet NIC which we’ll plug the Pineapple into then share the connection on the wireless adapter so that the traffic from the Pineapple can be routed through it, effectively just passing everything through the PC. This is all pretty straight forward and it starts out from the Network Connections settings:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Network Connections in Windows" src="http://lh6.ggpht.com/-MrWEcS1Szes/UW53-v7pSLI/AAAAAAAAFHc/V9l3ORe0txw/image31.png?imgmax=800" width="580" height="274" /&gt;&lt;/p&gt;  &lt;p&gt;Just one little note before proceeding: I’m going to obfuscate any SSIDs or MAC addresses used in this post with a grey box simply because they explicitly tie back to my devices (or my neighbours’ devices!) and I’m not real keen on publicly identifying them. Who knows what they might get up to in future…&lt;/p&gt;  &lt;p&gt;Jump into the properties of the wireless adapter, and head over to the sharing tab then make sure that “Allow other network users to connect through this computer’s Internet connection” is checked:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Allow other network users to connect through this computer’s Internet connection" src="http://lh3.ggpht.com/-ahGCiZf2N6o/UW53_OAAKMI/AAAAAAAAFHk/P_8ZGT8MoXA/image6111%25255B1%25255D.png?imgmax=800" width="377" height="475" /&gt;&lt;/p&gt;  &lt;p&gt;That’s that adapter done, now let’s do the wired one. Jump into the properties locate the “Internet Protocol Version 4 (TCP/IPv4)” item:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Internet Protocol Version 4 (TCP/IPv4)" src="http://lh4.ggpht.com/-vWzxt9B5TYU/UW53_x2uSyI/AAAAAAAAFHs/fl24-K_7dkY/image12.png?imgmax=800" width="377" height="475" /&gt;&lt;/p&gt;  &lt;p&gt;Now grab the properties of that guy and configure a static IP address and subnet mask &lt;em&gt;and&lt;/em&gt; set the DNS server as follows:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Static IP address on 172.16.42.42, subnet mask on 255.255.255.0 and DNS on 8.8.8.8" src="http://lh6.ggpht.com/-4jNWAZx8KCo/UW54AdNGHeI/AAAAAAAAFH0/5hiuTx1QbaQ/image9111%25255B1%25255D.png?imgmax=800" width="414" height="462" /&gt;&lt;/p&gt;  &lt;p&gt;That’s it – job done.&lt;/p&gt;  &lt;h4&gt;Accessing the device&lt;/h4&gt;  &lt;p&gt;Once tethering is setup and the Pineapple is connected to Ethernet via its PoE LAN port, you should be able to access the Pineapple directly from within your browser via the IP address. You can hit it on &lt;a title="http://172.16.42.1:1471/" href="http://172.16.42.1/pineapple"&gt;172.16.42.1/pineapple&lt;/a&gt; or if running a newer version of the firmware (more on that later), the IP address and port &lt;a href="http://172.16.42.1:1471"&gt;172.16.42.1:1471&lt;/a&gt;. All things going well, you’ll be challenged to authenticate:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Authenticating to the Pineapple" src="http://lh5.ggpht.com/-RqMYWB-9wT8/UW54BDza6jI/AAAAAAAAFH8/Rt5gJfm-_Vg/image91.png?imgmax=800" width="439" height="354" /&gt;&lt;/p&gt;  &lt;p&gt;The default credentials are username “root” and password “pineapplesareyummy” after which you should be in:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="The Pineapple browser UI" src="http://lh4.ggpht.com/-f4hrR9qhYN0/UW54BponcHI/AAAAAAAAFIE/x_al0IFp3lQ/image18.png?imgmax=800" width="716" height="498" /&gt;&lt;/p&gt;  &lt;p&gt;That’s the first bit done, tethering is working and we can actually access the device, now for a bit of preparation.&lt;/p&gt;  &lt;h4&gt;Housekeeping&lt;/h4&gt;  &lt;p&gt;Before you start anything, get the firmware up to date. If I’m honest, I’m always scared about updating any firmware on any device because when it goes wrong it’s often a whole world of pain to get yourself back out of trouble again. You’re much better off doing this before you create any dependencies on the device or configure anything. I had a couple of glitches doing mine and it took a few goes, but in theory, you jump over to the “Upgrade” link on the nav, hit “Check for Upgrades” then if required, pull down a package, enter the MD5 hash of it (provided on the upgrade site) and upload the package:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="The upgrade interface" src="http://lh5.ggpht.com/-TKEVg68nZ2A/UW54CbftvRI/AAAAAAAAFIM/_NXzcxzWqtc/image26.png?imgmax=800" width="712" height="513" /&gt;&lt;/p&gt;  &lt;p&gt;One little thing you want to remember here: if like me, your GUI was originally accessed via &lt;a title="http://172.16.42.1:1471/" href="http://172.16.42.1/pineapple"&gt;172.16.42.1/pineapple&lt;/a&gt;, keep in mind the newer version of the firmware now puts the GUI behind a port so you want to hit &lt;a href="http://172.16.42.1:1471"&gt;172.16.42.1:1471&lt;/a&gt; instead. If, also like me, you try hitting the old address after the install and reboot you’ll keep getting redirected and not much will happen. Then you’ll think you’ve rooted your device (that’s the &lt;a href="http://www.koalanet.com.au/australian-slang.html#R"&gt;Australian rooted&lt;/a&gt;, not the American one) and start wondering how in the hell you’re ever going to get it back to a known good state and, well, just remember the port change!&lt;/p&gt;  &lt;p&gt;Next up, jump into configuration and change the default SSID. The device is configured to show “pineapple” followed by the first and last octets of the Wi-Fi adapter. Change it to something a little more subtle and make it persistent so that when you fire it back up later you’re not reverting to the default:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Changing the SSID" src="http://lh3.ggpht.com/-VAgzd-49TAk/UW54CwthWoI/AAAAAAAAFIU/F5tYyHk3F7o/image23.png?imgmax=800" width="720" height="338" /&gt;&lt;/p&gt;  &lt;p&gt;The other thing you want to do on the configuration page is to blacklist the MAC address of the machine you’re going to be orchestrating the Pineapple from &lt;em&gt;and any other devices you don’t want inadvertently connecting to it&lt;/em&gt;. This is important if you don’t want to “Pineapple yourself”! Seriously though, it can get very confusing otherwise so this makes good sense.&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Blacklisting a MAC address" src="http://lh6.ggpht.com/-Rp_vhB-NHqI/UW54DRCqcDI/AAAAAAAAFIc/T5ZjW4R7kzM/image17.png?imgmax=800" width="716" height="333" /&gt;&lt;/p&gt;  &lt;p&gt;Lastly, let’s change that default password, the last thing you want is someone else taking over your Pineapple whilst you’re pretending to be a l33t hax0r! Over to the “Advanced” link then down to the bottom of the page:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Changing the default password" src="http://lh6.ggpht.com/-rA8hdZFTMw4/UW54EZwq6BI/AAAAAAAAFIk/pozoVdObfFg/image61.png?imgmax=800" width="714" height="200" /&gt;&lt;/p&gt;  &lt;p&gt;That’s pretty much it for what I felt need to be configured via the UI, let’s go and get a bit low-level and enter the command shell.&lt;/p&gt;  &lt;h4&gt;SSH’ing in&lt;/h4&gt;  &lt;p&gt;This is where it gets a bit scary for Windows people! Keeping in mind that the Pineapple is ultimately just a little Linux box with some fancy party tricks, there are times when you’ll need to get your hands dirty and enter the &lt;a href="http://en.wikipedia.org/wiki/Secure_Shell"&gt;secure shell&lt;/a&gt; world. This is something I do very, very rarely and if memory serves me correctly, it was 1999 when I last regularly used a *nix machine so it was pretty unfamiliar territory for me as well.&lt;/p&gt;  &lt;p&gt;Moving on, one of the easiest way of SSH’ing into the device from Windows is to go and grab &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;PuTTY&lt;/a&gt;. With this in hand, the only configuration you need is the IP address of the device:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Using PuTTY to SSH into the Pineapple" src="http://lh5.ggpht.com/-mQzJffwbX7g/UW54E-SHBzI/AAAAAAAAFIs/nARezcNK-Ck/image2.png?imgmax=800" width="466" height="449" /&gt;&lt;/p&gt;  &lt;p&gt;Open the connection and you’re into the shell:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Into SSH mode on the Pineapple" src="http://lh3.ggpht.com/-IsVt6YIzU28/UW54FxLZuaI/AAAAAAAAFI0/GSfYRkYatz4/image5.png?imgmax=800" width="675" height="425" /&gt;&lt;/p&gt;  &lt;p&gt;Follow the instructions in the screen above enough times and suddenly the shell doesn’t seem to look so bad!&lt;/p&gt;  &lt;p&gt;Keep in mind that this is the OpenWrt distro of Linux and being intended for embedded devices, it’s a pretty lean edition. Don’t expect to find all the features you’d normally see in a full blown desktop edition – many of them are not there so keep that in mind when attempting to use commands that might not be supported.&lt;/p&gt;  &lt;p&gt;Once you’re SSH’d in you can go ahead and set the time and time zone correctly. This’ll be well outside your comfort zone if Linux shells are a bit foreign to you (and admittedly I had to look much of this up again), so here’s the whole thing step-by-step:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Change the directory to /etc/config: &lt;em&gt;cd /etc/config&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Edit the config file in vi: &lt;em&gt;vi config&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Navigate down to the “option timezone” line and delete out the existing “UTC” value (unless, of course, you are in the UTC time zone!)&lt;/li&gt;    &lt;li&gt;Jump over to the &lt;a href="http://wiki.openwrt.org/doc/uci/system#time.zones"&gt;timezones table on the OpenWrt site&lt;/a&gt; and find the appropriate one for your location. &lt;/li&gt;    &lt;li&gt;Enter the value from the “TZ string” column into the shell: &lt;em&gt;Hit the “i” key to insert then type away        &lt;br /&gt;        &lt;br /&gt;&lt;/em&gt;It should look kinda like this when you’re done:       &lt;br /&gt;      &lt;br /&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="New timezone" src="http://lh6.ggpht.com/-hKmnGCZ_-Z4/UW54GbRSUHI/AAAAAAAAFI8/pXxnh3S6bJ4/image29.png?imgmax=800" width="675" height="143" /&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Save the file: &lt;em&gt;Hit the esc key to stop editing then :wq&amp;lt;enter&amp;gt;&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Reboot the Pineapple: &lt;em&gt;reboot &amp;lt;enter&amp;gt;&lt;/em&gt; &lt;!--EndFragment--&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;A little tip for new players: every time I tried saving the config change I got the following message and nothing actually saved:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Error when saving timezone" src="http://lh3.ggpht.com/-0GOv_BhRu38/UW54Gy29ySI/AAAAAAAAFJE/C-d5958YpJw/image32.png?imgmax=800" width="674" height="114" /&gt;&lt;/p&gt;  &lt;p&gt;This, quite clearly, means that there is no available capacity on the device and after wasting considerable time trying to work out why I couldn’t use vi correctly, this become quite clear. Welcome to Linux!&lt;/p&gt;  &lt;h4&gt;Working with ext4 format and USB drives&lt;/h4&gt;  &lt;p&gt;You’ve got &lt;em&gt;very&lt;/em&gt; little space on the device, there’s literally only an 8MB ROM and 32MB of RAM so by the time you load everything into there just required for the device to run, there’ve not much left. It’s &lt;em&gt;certainly&lt;/em&gt; not going to be enough to start doing fancy things like storing packet captures which mount up very quickly.&lt;/p&gt;  &lt;p&gt;Fortunately it’s all expandable via USB so one of the first things you want to do is grab a spare thumb drive and get it ready for the Pineapple. But there’s a catch – as with many things Linux, this is a slightly different world to good old Windows so you can’t just take your NTFS formatted USB stick and chuck it in, you’ll need to partition it for &lt;a href="http://en.wikipedia.org/wiki/Ext4"&gt;ext4&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In theory, this is easy enough to do in the Windows world using a tool such as &lt;a href="http://www.partitionwizard.com/free-partition-manager.html"&gt;MiniTool Partition Wizard&lt;/a&gt;. That sounds just fine – except it’s not and you will only discover this through either banging your head against the wall for hours or reading what comes next. Whilst the aforementioned tool (and I assume others like it running on Windows) &lt;em&gt;seemed&lt;/em&gt; like a good idea, I just couldn’t get it to play nice. I’ll spare you the detail as &lt;a href="http://forums.hak5.org/index.php?/topic/29269-cant-install-infusions-to-usb/"&gt;I’ve captured them all on the Hak5 forum&lt;/a&gt;, but in short, the USB would mount and be readable from shell but I could never install Infusions to it (think of them as apps for the Pineapple) which I’ll come to shortly. It turns out that additional partitions were being created and that simply made things not play nice with the Pineapple despite no obvious warnings to that effect.&lt;/p&gt;  &lt;p&gt;The solution turns out to be that I needed to create the ext4 partition directly from a Linux machine. If this world is unfamiliar to you, there’s a (relatively) low friction process courtesy of an &lt;a href="http://www.ubuntu.com/download"&gt;Ubuntu LiveCD&lt;/a&gt;. This involves downloading an Ubuntu ISO, burning it to CD (or DVD or bootable USB), running up an in-memory instance of Ubuntu and partitioning the USB from there. I then followed the guidance provided in the very easy to follow page on &lt;a href="http://forums.hak5.org/index.php?showtopic=25882"&gt;enabling USB mass storage with swap partition&lt;/a&gt; as the swap partition looks like will come in handy later on when you want to start doing some other tricks with the Pineapple. &lt;/p&gt;  &lt;p&gt;That sounds like a hassle – running up an entire new operating system just to partition a USB drive – and certainly it was a drama getting to the point of realising that’s what I needed to do, but once you know what needs to be done it’s quite simple. Of course it would have been even simpler if I had a handy Linux machine hanging around somewhere and for many people, that will already be the case.&lt;/p&gt;  &lt;p&gt;Once it’s all setup you should see the storage appear under the “USB” menu item like so:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="USB drive listed" src="http://lh5.ggpht.com/-OyXhJQmJRDw/UW54HV-pLZI/AAAAAAAAFJM/holkRYdmC6k/image3.png?imgmax=800" width="716" height="90" /&gt;&lt;/p&gt;  &lt;p&gt;You’ll also probably want to &lt;em&gt;read &lt;/em&gt;from the drive back on your Windows machine at some point (I’ll save some packet captures to it a little later on) and I found &lt;a href="http://www.diskinternals.com/linux-reader/"&gt;DiskInternals Linux Reader&lt;/a&gt; did the job just fine.&lt;/p&gt;  &lt;h4&gt;Testing connectivity&lt;/h4&gt;  &lt;p&gt;Now that we’ve got everything ready to roll, let’s jump into the fun stuff! Back in that first screen grab of the UI, only the “Wireless” and “Cron Jobs” services were running so let’s fire up “Mk4 Karma” and set it to run automatically via the “Autostart” feature so the device just needs to be powered up for everything to kick into action:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Enabling services" src="http://lh4.ggpht.com/-a67G5cz08ks/UW54Ica8qvI/AAAAAAAAFJU/nLL9fBU7rSQ/image3111.png?imgmax=800" width="310" height="203" /&gt;&lt;/p&gt;  &lt;p&gt;Now we should be able to jump over to a device such as my iPhone and see some new SSIDs:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="iPhone seeing the &amp;quot;trust me&amp;quot; SSID" src="http://lh5.ggpht.com/-5q0080Y7Gxs/UW54JE1ClwI/AAAAAAAAFJc/KdwNlfVxkFA/Photo-14-04-13-11-18-252.png?imgmax=800" width="300" height="533" /&gt;&lt;/p&gt;  &lt;p&gt;This is a whole lot more interesting once you understand what’s under the grey box (which again, I’ve deliberately obfuscated), so let me explain what’s happening; each unsecured network is the Pineapple responding to a probe request from the iPhone with the name of the SSID it was previously associated with. The names include that of an old wireless router I replaced some years back, my parents’ network I was connected to interstate just the other day and an airline lounge in a far flung corner of the world. All of the &lt;em&gt;secured&lt;/em&gt; networks are legitimate (mine, my neighbour’s, etc.)&lt;/p&gt;  &lt;p&gt;We’re also seeing the new SSID of the Pineapple that I set earlier (“trust me”) and I’ve gone ahead and explicitly connected to that for demonstration purposes. This now makes the homepage of the GUI much more interesting:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="List of probe requests from and MAC addresses from different devices" src="http://lh3.ggpht.com/-ePipCAVZmE8/UW54Juv-1lI/AAAAAAAAFJk/WYnTwU-1HPU/image611.png?imgmax=800" width="713" height="599" /&gt;&lt;/p&gt;  &lt;p&gt;What’s particularly interesting is what you &lt;em&gt;can’t&lt;/em&gt; see which are all the SSIDs being probed for. These are predominantly APs I’ve connected to in the past and the MAC addresses doing the probing are predominantly my own (the Wi-Fi strength on the Pineapple is not great so I’m seeing mostly nearby devices), but you do see a few unfamiliar ones pop up which are clearly other people’s devices. It does make you wonder what risks might be present from devices leaking SSID names they’ve previously associated to; “Why is my colleague’s Android trying to connect to ‘Mistress Angeliques BDSM Palace’?!”&lt;/p&gt;  &lt;p&gt;Anyway, right at the end of the above image you can see the association of my iPhone to the Pineapple which means we can now drill down and get a detailed report of what’s going on:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Details of iPhone connected to the Pineapple" src="http://lh6.ggpht.com/-z7CXdB9cc7k/UW54KBKjGrI/AAAAAAAAFJs/ssKRCsBIclI/image911.png?imgmax=800" width="717" height="441" /&gt;&lt;/p&gt;  &lt;p&gt;This is mostly self-explanatory, the signal strength is kind of interesting as it starts to give you a sense of the distance the victim might be from the device. Of course what will be really interesting is the rx bytes – that’s about one a half MB that the phone has already received through the Pineapple and under normal operating conditions, the user would have absolutely no idea there was an MiTM. Let’s move on to taking a sneaky look at those packets because that’s where things get &lt;em&gt;really&lt;/em&gt; interesting!&lt;/p&gt;  &lt;h4&gt;Packet capturing&lt;/h4&gt;  &lt;p&gt;Now that we’ve got all the nuts and bolts in place, let’s start capturing the data. There are a couple of different ways of doing this and probably the simplest is to monitor the traffic moving through the Ethernet adapter on the attacker’s PC. Once we start getting into the realm of traffic monitoring we need to start looking at packets and the best way to do this on a PC by a long shot is to use &lt;a href="http://www.wireshark.org/"&gt;Wireshark&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;One of the best thing about Wireshark is that it’s free. This is no lightweight tool either, Wireshark is very full featured and is arguably the de facto standard for monitoring, capturing and analysing packets flying around a network. As powerful as Wireshark is, it’s also relatively easy to get started, just fire it up, choose the network interface you want to capture which in this case is the Ethernet adaptor (remember, this is the NIC the Pineapple is connected to) then jump down to the “Capture Options” button:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Starting Wireshark to monitor traffic from the Pineapple" src="http://lh4.ggpht.com/-Ne7YzDpxoko/UW54LRVwyaI/AAAAAAAAFJ0/DFFgZL3q0ts/image4111.png?imgmax=800" width="850" height="620" /&gt;&lt;/p&gt;  &lt;p&gt;The capture options start to give you an idea of the extent of the configurability but we’ll just leave all that as default and start the capture:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Wireshark capture options" src="http://lh4.ggpht.com/-1R7_UMzEj1c/UW54L4rCwGI/AAAAAAAAFJ8/7mXK80MYCPo/image7111.png?imgmax=800" width="595" height="614" /&gt;&lt;/p&gt;  &lt;p&gt;Once started, you should immediately begin to see packets flowing through the NIC:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Wireshark packets captured from the Pineapple" src="http://lh6.ggpht.com/-Bl64viP2Stg/UW54N9mwJTI/AAAAAAAAFKE/yrDLyCFjSiA/image14.png?imgmax=800" width="850" height="620" /&gt;&lt;/p&gt;  &lt;p&gt;Right about here the penny should drop – &lt;em&gt;this is someone else’s traffic!&lt;/em&gt; Ok, it’s really my own traffic from my iPhone but of course as we now know, the Pineapple has the ability to easily trick a victim into connecting to it whether deliberately or by default as their device looks for familiar SSIDs. Long story short is that this could just as easily be someone else’s traffic.&lt;/p&gt;  &lt;p&gt;I’m not going to delve into exactly what we can do with that traffic right now because I have subsequent posts planned that will demonstrate that, for now though let’s just filter that traffic down to something a bit more familiar – HTTP. You see, the traffic above includes a whole bunch of different protocols which for the purposes of talking about secure website design aren’t going to be of much use. Let’s add in a filter of “http” and load up a popular website with developers:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="HTTP requests to Stack Overflow being captured" src="http://lh5.ggpht.com/-GSblfy9jCsQ/UW54PygDQPI/AAAAAAAAFKM/eplvQ037mnM/image211.png?imgmax=800" width="850" height="621" /&gt;&lt;/p&gt;  &lt;p&gt;As I’ve written before, &lt;a href="http://www.troyhunt.com/2012/08/is-stack-overflow-secure-kind-of.html"&gt;Stack Overflow serves everything outside the logon over HTTP&lt;/a&gt; so it’s easy to monitor that traffic (including the authentication cookie). Once the traffic is captured, you can either save it as a PCAP file for later analysis or right click and follow the TCP stream which then gets you into the entire request and response (including the headers with those valuable auth cookies):&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Following the TCP stream of the request and response" src="http://lh5.ggpht.com/-UZURZFz9TJc/UW54QscUzZI/AAAAAAAAFKU/rVXZQMurshc/image241.png?imgmax=800" width="766" height="589" /&gt;&lt;/p&gt;  &lt;p&gt;I’ll stop there because that’s enough to demonstrate that everything is working as expected. Just to illustrate the power of the Pineapple, as I was writing this piece and watching the Wireshark traffic, a whole bunch of packets started appearing &lt;em&gt;that weren’t mine&lt;/em&gt;:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="My wife&amp;#39;s MacBook Air connecting to the Pineapple" src="http://lh3.ggpht.com/-MoH38Mcz4KA/UW54RaXPubI/AAAAAAAAFKc/0UvZcHcG5nk/image171.png?imgmax=800" width="850" height="160" /&gt;&lt;/p&gt;  &lt;p&gt;Turns out that my wife had wandered into range with her MacBook Air and it had automatically associated to the SSID “Apple Demo” which I can only assume is the access point the Apple store connected her to when walking her through the shiny new machine she recently bought. So there you go – right out of the box a brand new machine is already falling victim to the Pineapple without even trying.&lt;/p&gt;  &lt;h4&gt;Infusions and unattended packet capturing with tcpdump&lt;/h4&gt;  &lt;p&gt;This is the last configuration I want to touch on simply because it covers couple of important points: Infusions and using the USB drive we setup earlier. With these concepts understood I actually feel reasonably well-equipped to use the thing so they’re worth capturing here.&lt;/p&gt;  &lt;p&gt;The physical capabilities of the Pineapple should be pretty clear by now but what might not be quite as clear to the uninitiated is what can now be achieved with clever software. I’ll write a lot more about these capabilities in the future but for now I want to just take a quick look at the concept of &lt;a href="http://wifipineapple.com/index.php?infusions"&gt;Infusions&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Think of Infusions as apps and the Pineapple Bar as an app store for the Pineapple only with a couple of dozen apps that are all free. The Infusions cover a variety of different domains from informational to potentially malicious so there’s a good range of use cases in there. It’s accessible via the Pineapple from the “Pineapple Bar” link in the nav and it gives you some options like so:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="List of Infusions" src="http://lh3.ggpht.com/-eIMW9VFasvA/UW54SPQA8qI/AAAAAAAAFKk/1gvCCWC7gZk/image6111.png?imgmax=800" width="743" height="441" /&gt;&lt;/p&gt;  &lt;p&gt;As you can see, I’ve already installed the “status” Infusion and by way of example, here’s the sort of info you get from it:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="The status Infusion" src="http://lh6.ggpht.com/-srCGdSOFli8/UW54ShItYdI/AAAAAAAAFKs/-L_Dp0JraFY/image%25255B12%25255D.png?imgmax=800" width="552" height="899" /&gt;&lt;/p&gt;  &lt;p&gt;This can be pretty handy info in GUI format, there are also some neat real time graphs for things like CPU utilisation and bandwidth:&lt;/p&gt;  &lt;p&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-24EGoXWguCE/UW54TAa4iKI/AAAAAAAAFK0/AYw5xOzSa7E/image9.png?imgmax=800" width="602" height="378" /&gt;&lt;/p&gt;  &lt;p&gt;The really interesting one, however, is &lt;a href="http://www.tcpdump.org/"&gt;tcpdump&lt;/a&gt;. Now tcpdump is not an Infusion in and of itself, it’s an existing project which has been turned into an Infusion so that’s easily installable on the Pineapple and can then be managed from the GUI. What tcpdump offers is the ability to effectively do what we just did with Wireshark in terms of packet capturing but to do so locally within the device itself. What this means is that you can have the Pineapple independently capture traffic without needing to run Wireshark on a PC. In fact if you establish a connection from the Pineapple directly to the web (and there are several ways to do this), you don’t need a PC at all. Imagine just that little cigarette pack sized Pineapple sitting there on its own with its own power source and internet connection and any victims within Wi-Fi shot of it automatically connecting and having their packets captured. &lt;em&gt;That’s&lt;/em&gt; powerful stuff.&lt;/p&gt;  &lt;p&gt;Now that we have a &lt;em&gt;correctly partitioned&lt;/em&gt; USB drive, Infusions can be installed directly to there:&lt;/p&gt;  &lt;p&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-p2d5NmTXU4I/UW54T9tY7rI/AAAAAAAAFK8/yTU-9FnizB0/image9111.png?imgmax=800" width="586" height="122" /&gt;&lt;/p&gt;  &lt;p&gt;Incidentally, it’s that highlighted “USB Storage” link that I never saw when creating the ext4 partition in Windows.&lt;/p&gt;  &lt;p&gt;The thing with packet captures is that there can be a lot of them and they can chew up space &lt;em&gt;really&lt;/em&gt; quickly depending on how liberal you are with the data you want to save. You can configure tcpdump to filter out a lot of the “noise” packets and restrict it to, say, only HTTP traffic or even just only to HTTP requests using the POST verb. For now though we’ll just run it up with the defaults to capture all the traffic running through the wired LAN port:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Capturing TCP traffic using tcpdump" src="http://lh6.ggpht.com/-77Z5GhmZBm8/UW54UqTp_kI/AAAAAAAAFLE/x3ZCtGyPjX0/image4.png?imgmax=800" width="850" height="543" /&gt;&lt;/p&gt;  &lt;p&gt;You can now sit back and let the traffic flow whilst the Pineapple captures everything anyone connected to it sends across the wire (or air, as it may be). With the iPhone connected, I browsed over to a site I know doesn’t properly protect user credentials and attempted to logon. Once done you can hit “Stop” and you’ll see a summary of the captured data:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Captured packets from tcpdump" src="http://lh4.ggpht.com/-UxrDrz2Qzco/UW54VGgpXcI/AAAAAAAAFLM/sy1YgW14H4w/image%25255B3%25255D.png?imgmax=800" width="699" height="130" /&gt;&lt;/p&gt;  &lt;p&gt;Now we can jump over to the “History” tab and download the PCAP file:&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Viewing the tcpdump history" src="http://lh4.ggpht.com/-klhWubPTmv8/UW54Viwfy-I/AAAAAAAAFLU/FVTKcrnkZ5s/image%25255B6%25255D.png?imgmax=800" width="394" height="121" /&gt;&lt;/p&gt;  &lt;p&gt;That PCAP file is just the same as what we captured in Wireshark earlier on and you can now load it back up into Wireshark and analyse it in just the same way as you would the packets it captured directly. Alternatively, you can pull the USB out, chuck it into the PC and read it with a tool like DiskInternals which I mentioned earlier. Here’s what we can now see from my brief visit to the site&lt;/p&gt;  &lt;p&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Login credentials sent in unprotected GET request" src="http://lh6.ggpht.com/-ITtGPmF44CI/UW54W8TMdNI/AAAAAAAAFLc/Uh1B4iBHQZo/image%25255B9%25255D.png?imgmax=800" width="766" height="589" /&gt;&lt;/p&gt;  &lt;p&gt;This site is &lt;em&gt;particularly&lt;/em&gt; bad because the credentials just go into a GET request but of course the real story in the context of the Pineapple is that the whole thing is sent in the clear so it’s now easy to see everything sent by the victim and returned by the server. Keep in mind that this was all captured directly on the Pineapple (or at least on the USB) so the whole thing is now pretty well self-contained. That’s a good place to end the traffic capture for today, there’ll be &lt;em&gt;much&lt;/em&gt; more in the future though…&lt;/p&gt;  &lt;h4&gt;Other miscellaneous info&lt;/h4&gt;  &lt;p&gt;For those of you thinking of getting yourself into a Pineapple (and I know there are a few based on Twitter chats alone), there are a couple of pre-purchase things worth pointing out. Firstly, I went el-cheapo and only got the device itself without any accessories. This means you get an AC adaptor for power and that’s it so it’s definitely &lt;em&gt;not &lt;/em&gt;mobile.&lt;/p&gt;  &lt;p&gt;Being able to take the Pineapple out in the wild definitely presents all sorts of opportunities not available while it’s plugged in to the mains so the &lt;a href="http://hakshop.myshopify.com/collections/accessory/products/usb-battery-pack-3200mah"&gt;USB battery pack&lt;/a&gt; is a must. As the name suggests, this also gives you the ability to power the device directly from USB so you can just plug it into your laptop if the juice in the battery runs out.&lt;/p&gt;  &lt;p&gt;The other thing is that the Wi-Fi strength is pretty ordinary. By way of example, here’s how &lt;a href="http://www.metageek.net/products/inssider/"&gt;inSSIDer&lt;/a&gt; sees the Pineapple (in yellow, of course) versus my usual access point in blue from only about a foot away:&lt;/p&gt;  &lt;p&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-PeooN0RcNQo/UW542mkm8rI/AAAAAAAAFLk/vtbIKh5vBsE/image72.png?imgmax=800" width="850" height="145" /&gt;&lt;/p&gt;  &lt;p&gt;However, mover into the next room and the Pineapple just about drops off altogether:&lt;/p&gt;  &lt;p&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-jaf-526cP-Y/UW543Cy7n2I/AAAAAAAAFLs/e4AQkrZDXro/image1011.png?imgmax=800" width="850" height="145" /&gt;&lt;/p&gt;  &lt;p&gt;There are &lt;a href="http://hakshop.myshopify.com/collections/antennas"&gt;a few different antenna options&lt;/a&gt; so if your intended use doesn’t involve connecting to a target within a very, very close distance then this would be worth a look. Other than that though, the only other thing that &lt;em&gt;might&lt;/em&gt; be useful is a handy case and given HakShop has &lt;a href="http://hakshop.myshopify.com/products/wifi-pineapple-holiday-bundle"&gt;a Pineapple with battery and a case going for $115&lt;/a&gt; at the time of writing, that’s probably your best bet.&lt;/p&gt;  &lt;p&gt;The other thing that some people might find interesting is that a bunch of &lt;a href="https://github.com/WiFiPineapple/web-interface"&gt;the code running on the Pineapple is up on GitHub&lt;/a&gt;. This is apparently the www folder of the device so it’s not the firmware itself, but it is a bunch of the PHP files and scripts which is kind of interesting to have a browse through.&lt;/p&gt;  &lt;h4&gt;Responsible use&lt;/h4&gt;  &lt;p&gt;I bought the Pineapple for the sole purpose of helping developers better understand the risks of insufficient transport layer security. You’re going to see me writing a lot more about the risks of loading logon forms over HTTP, embedding HTTPS login forms in HTTP pages, mixed mode HTTP / HTTPS and other similar risks. The Pineapple will help me move that discussion from a theoretical “An attacker might do this or could do that” to a very practical “Here, let me show you exactly why that pattern is risky”. Demonstrations of this kind are very powerful and they’re often the only way of getting the message through.&lt;/p&gt;  &lt;p&gt;However, there is very clearly scope for misuse and abuse of unsuspecting victims. That incident I mentioned earlier where my wife walked into the room and suddenly I was watching &lt;em&gt;her&lt;/em&gt; network traffic is a perfect example of how easy it is to do potentially evil things, sometimes without even trying. For those reading this and considering how they might use it, there are some great use cases for penetration testing or demoing (in)secure web app design but there is also some very, very thin ice out there. Caveat emptor.&lt;/p&gt;  &lt;h4&gt;What next for the Pineapple?&lt;/h4&gt;  &lt;p&gt;The great thing about the Pineapple is that it makes it dead easy to demonstrate a whole bunch of concepts that I often write about but haven’t always shown in execution. For example, &lt;a href="http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html"&gt;why it’s not ok to load login forms over HTTP even if they post to HTTPS&lt;/a&gt;. Another one that has come up a few times (including in &lt;a href="http://www.troyhunt.com/2013/04/5-ways-to-implement-https-in.html"&gt;the Top CashBack post&lt;/a&gt;) is not embedding a login form that &lt;em&gt;is&lt;/em&gt; loaded over HTTPS within an iframe in an HTTP page. There’s a whole heap of things that will be easily demonstrated within a controlled environment.&lt;/p&gt;  &lt;p&gt;Then there’s the uncontrolled environment – the public. There’s a lot of grey area there about what can be done for the purposes of research and education without crossing the line into outright eavesdropping and getting on the wrong side of people. I do have some thoughts on it, but I’ll hold onto those for the moment…&lt;/p&gt;  &lt;p&gt;Regardless, I’ll start producing some video material to demonstrate the ease with which this thing does its work because it’s immensely impressive to see in real time – at least &lt;em&gt;I&lt;/em&gt; was impressed! I’ve already created a bit of video for a training program I’m putting together (more on that another day), and I reckon it comes up great. Stay tuned, there’s much, much more to come.&lt;/p&gt;  &lt;h4 align="left"&gt;Useful Links&lt;/h4&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://forums.hak5.org/index.php?/topic/25706-markiv-what-we-know-and-what-we-dont-know/?hl=%2Bext4+%2Bformatted+%2Busb+%2Bstick"&gt;Markiv: What We Know And What We Don't Know&lt;/a&gt; – good general overview of features and configuration &lt;/li&gt;    &lt;li&gt;&lt;a href="http://forums.hak5.org/index.php?/topic/26363-mark-4-setup-script/"&gt;Mark 4 setup script&lt;/a&gt; – very handy for seeing how to configure various things via the shell. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://hakinthebox.blogspot.com.au/2012/06/you-just-cant-trust-wireless-covertly.html"&gt;You just can't trust wireless: covertly hijacking wifi and stealing passwords using sslstrip&lt;/a&gt; – good view of defeating SSL with the device&lt;/li&gt;&lt;li&gt;&lt;a href="http://wifipineapple.com/"&gt;Main Wi-Fi Pineapple site&lt;/a&gt; - all things Pineapple start from here&lt;/li&gt; &lt;/ol&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/GmmL2ItpzB8" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/8700833987171440154?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/8700833987171440154?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/GmmL2ItpzB8/the-beginners-guide-to-breaking-website.html" title="The beginners guide to breaking website security with nothing more than a Pineapple" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-KA7rofLkRpE/UW538jHFdmI/AAAAAAAAFHE/JPtjHlcp8nw/s72-c/Untitled-12.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UGR3k5fCp7ImA9WhBWEEw.&quot;"><id>tag:blogger.com,1999:blog-3977663544337573923.post-7436391908717582385</id><published>2013-04-03T21:00:00.001+11:00</published><updated>2013-04-04T05:53:46.724+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-04T05:53:46.724+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSL" /><category scheme="http://www.blogger.com/atom/ns#" term="Security" /><title>5 ways to implement HTTPS in an insufficient manner (and leak sensitive data)</title><content type="html">&lt;p&gt;HTTPS or SSL or TLS or whatever you want to call it can be a confusing beast. Some say it’s just about protecting your password and banking info whilst the packets are flying around the web but I’ve long said that &lt;a href="http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html"&gt;SSL is not about encryption&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;As an indication of how tricky the whole situation is, &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;OWASP talks about insufficient transport layer security&lt;/a&gt;. Not “have you done it right” or “have you done it wrong”, rather have you considered all the little nuances that go into the correct implementation of this invaluable security feature.&lt;/p&gt; &lt;p&gt;Naturally, when this tweet from Mark Hemmings popped up on my timeline was a little intrigued:&lt;/p&gt; &lt;p&gt;&lt;a href="https://twitter.com/mhemmings/status/319087638093107200"&gt;&lt;img width="466" height="304" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="WRONG @Top_CashBack (cc @troyhunt) pic.twitter.com/PUiCL8Pf2L" src="http://lh6.ggpht.com/-I2dWLaLSlwc/UVv9iNXOwEI/AAAAAAAAFFM/vJ8PKUF1NW4/SNAGHTML270fc544.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;We’ve all seen this before right? Clearly it means your valuable password is being sent over the wire in plain text and the ghosts in the wires will immediately harvest them and do frightful things with them, won’t they? Apparently not:&lt;/p&gt; &lt;p&gt;&lt;a href="https://twitter.com/Top_CashBack/status/319116749649891328"&gt;&lt;img width="466" height="201" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="@mhemmings Hi Mark, The login box, which is the important bit on this page is secure.  It is a separate iFrame, which is a https page..." src="http://lh4.ggpht.com/-Lt0yp0n-6xw/UVv9iujSzwI/AAAAAAAAFFU/9t_4MLSToaM/SNAGHTML277668c4.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;This is not &lt;a href="http://www.troyhunt.com/2012/11/5-essential-tips-for-customer-care.html"&gt;your usual customer service rhetoric&lt;/a&gt; – these guys know about iFrames! They continue:&lt;/p&gt; &lt;p&gt;&lt;a href="https://twitter.com/Top_CashBack/status/319117503588622338"&gt;&lt;img width="472" height="231" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="@mhemmings ...all our key pages on the site are also secure, so your profile etc all have secure addresses. I hope this helps, thanks, TCB" src="http://lh4.ggpht.com/-ld3Qd1DiI4w/UVv9jMdk9oI/AAAAAAAAFFc/7Co_q0PC0gw/SNAGHTML27864c74.png?imgmax=800" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The key here is the word “key” in that sentence. Hang on – so other pages &lt;em&gt;aren’t&lt;/em&gt; sent over secure connections? What happens if you’re already logged on?&lt;/p&gt; &lt;p&gt;This is a great opportunity to revisit the quirks of HTTPS because as it turns out, Mark is spot on and there are some &lt;em&gt;very&lt;/em&gt; insufficient practices going on here. Let me break it down into 5 discrete problems and why each one of them undermines the HTTPS implementation not just on Top CashBack, but on many other sites following the same patterns.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt; &lt;h4&gt;Problem 1: Sending sensitive data over an insecure connection&lt;/h4&gt; &lt;p&gt;Of course you can see where the problem begins right here:&lt;/p&gt; &lt;p&gt;&lt;img width="800" height="579" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Registration page on Top CashBack" src="http://lh5.ggpht.com/-xVgTkcgGhzE/UVv9kxVCDVI/AAAAAAAAFFk/Mgxp6eRYhGw/image7.png?imgmax=800" border="0"&gt;&lt;/p&gt; &lt;p&gt;That’s right, it’s a registration form loaded over HTTP. Before we even get to looking at the claim of the login being loaded over HTTPS, we’ve got a serious problem. This isn’t even one of those common misunderstandings along the lines of “Oh but it’s safe because it posts to HTTPS” because, well, it doesn’t (and it isn’t). Watch the HTTP request after completing the form and it looks like this:&lt;/p&gt;&lt;pre&gt;POST http://www.topcashback.co.uk/light-box/join/ HTTP/1.1&lt;/pre&gt;
&lt;p&gt;And here’s the form variables in the request body:&lt;/p&gt;
&lt;p&gt;&lt;img width="466" height="287" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Registration data sent in plain text" src="http://lh5.ggpht.com/-fCS5do_6li8/UVv9lZKI8CI/AAAAAAAAFFs/foVSEKsgwL8/SNAGHTML2b35f1d3.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;Yes, that really is the password I created and yes, it really is sent from my PC through all the wires to their server in plain text. In fact after registering there were 140 requests made by the browser to load assets onto the page and some of them &lt;em&gt;were &lt;/em&gt;made over HTTPS; one to Facebook, one to Google, one to Doubleclick &lt;em&gt;but zero to Top CashBack!&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;Problem 2: Mixed mode&lt;/h4&gt;
&lt;p&gt;Moving on, after registering I was sent a verification email and I duly followed the link. Good news – it’s an HTTPS address! Bad news, it’s not secure:&lt;/p&gt;
&lt;p&gt;&lt;img width="800" height="579" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Top CashBack email authentication page" src="http://lh6.ggpht.com/-2iDFKyxSdKE/UVv9maR5H1I/AAAAAAAAFF0/O_Z6LfvyK8I/image15.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;See the error at the bottom of the browser? This is your classic mixed-mode HTTPS problem where the page has been requested over HTTPS but it then embeds assets requested over HTTP. The risk here is that the integrity of those assets can no longer be verified – they could have been manipulated. Now imagine you can manipulate the JavaScript loaded into a website to do whatever you want it to; change all the links on the page, rewrite the contents, steal the cookies and so on and so forth. In short, once content has been loaded insecurely you can no longer trust the page that embedded it, even if it was loaded over an HTTPS address.&lt;/p&gt;
&lt;h4&gt;Problem 3: Sending auth cookies over an insecure connection&lt;/h4&gt;
&lt;p&gt;Clearly we’re now logged on which gives us an opportunity to move onto the next problem. Let’s jump back to the homepage and you can immediately see the issue:&lt;/p&gt;
&lt;p&gt;&lt;img width="800" height="578" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Home page loaded over HTTP with links to &amp;quot;My account&amp;quot; and &amp;quot;Log out&amp;quot;" src="http://lh6.ggpht.com/-x5s-G4biYcs/UVv9oUZtntI/AAAAAAAAFF8/CqGK0Oy78eg/image20.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;You see that?! Let me help: this page has been requested over HTTP but somehow it knows that I’m logged on as it’s able to display the “My account” and “Log out” links in the top right. How can it be?&lt;/p&gt;
&lt;p&gt;Let’s take a step back and I’ll provide some context. HTTP is a stateless protocol which means that every time your browser makes a request it’s over a whole new connection with no implied continuity between them. This is problematic because it means that you can’t &lt;em&gt;persist&lt;/em&gt; information across requests such as an identity and the fact that you’re logged in. To work around this limitation we have the cookie, those little bytes of data that are sent between client and server in request and response headers. When you log on to a website, it’s (almost always) a cookie which is sent to your browser in the response and then &lt;em&gt;sent back&lt;/em&gt; to the server with each request to ensure it knows who you are and that you’re authenticated.&lt;/p&gt;
&lt;p&gt;The problem is this: if someone else can get hold of that cookie then they can become you! This is called session hijacking and it involves nothing more than an attacker intercepting the cookie, setting in their own browser then voila – they’re you! This is what &lt;a href="http://en.wikipedia.org/wiki/Firesheep"&gt;Firesheep&lt;/a&gt; did a few years back and caused such a fuss. It was arguably a significant factor in websites such as Facebook implementing HTTPS everywhere so that sessions couldn’t be hijacked in this fashion. In fact many websites got the message very quickly, but some did not…&lt;/p&gt;
&lt;p&gt;This risk is easily verified as the HTTP request to the page above contained the following cookie:&lt;/p&gt;&lt;pre&gt;.TCBAUTH=33813F16896A3527C7B4AC6B8988CE50A694329C9403579EB798A74B1AF938251C6AE61C703CB4FC761A587BE9F6BA4BAC46EE62A015A07E57E3252469C7954A7EBA0AA43121620BC66A7767F85B0064906D5B0F24CBF6D5A17F3AF0392D8889F9F04B80B1AEB3AC3E7376A205D8BB795A1C64BE30AA8073FCD89289A2B8AEBF914D0F4F4EA439BB8A8F16B353AB47EECE0997D089088D8BEDB847B038A9E41FDE9E320935772FB4CAE29FF767702D30C0608FC6054F51BDF4EED3747234AC0212D359B1;&lt;/pre&gt;
&lt;p&gt;Here, I’ll show you: I copied the cookie above, inserted it into a Chrome session using &lt;a href="https://chrome.google.com/webstore/detail/edit-this-cookie/fngmhnnpilhplaeedifhccceomclgfbg?hl=en"&gt;Edit This Cookie&lt;/a&gt;, loaded up the account details page and here’s what I now have:&lt;/p&gt;
&lt;p&gt;&lt;img width="800" height="578" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Session hijacked in another browser" src="http://lh4.ggpht.com/-uZIEXLRxonU/UVv9pjcS0WI/AAAAAAAAFGE/RpHt0s04arA/image29.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;That’s my details! In my “attacker mode” I never saw a password, all I needed was those few bytes from the cookie sent over the insecure connection and I’m in. There are many, many ways that an attacker can get the cookie from an insecure connection. One of the easiest is simply &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;sniffing wireless traffic as I’ve previously demonstrated&lt;/a&gt;, then there the good old &lt;a href="http://www.janitha.com/archives/146"&gt;physical wiretap&lt;/a&gt; or simply observing the traffic through any of the legitimate nodes it passes through; router, gateway, ISP, etc.&lt;/p&gt;
&lt;p&gt;Once you have the cookie, you have access to &lt;em&gt;everything&lt;/em&gt; that an authenticated user can see. For example:&lt;/p&gt;
&lt;p&gt;&lt;img width="800" height="578" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Banking details in hijacked session" src="http://lh5.ggpht.com/-2EqEDOZ0ats/UVv9rY-YdhI/AAAAAAAAFGM/z8zaZCvV6vw/image28.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;I’m sure Top CashBack probably feels they’re being secure by sending this over HTTPS (and certainly that’s a good thing in and of itself), but as an attacker, it doesn’t matter one bit because I’ve already hijacked the session when the cookie was sent insecurely. All the HTTPS on the page above does is allows the &lt;em&gt;attacker&lt;/em&gt; to load the page securely!&lt;/p&gt;
&lt;h4&gt;Problem 4. Not marking auth cookies as “secure”&lt;/h4&gt;
&lt;p&gt;This is closely related to the previous point and it’s one I wrote about just last week in &lt;a href="http://www.troyhunt.com/2013/03/c-is-for-cookie-h-is-for-hacker.html"&gt;C is for cookie, H is for hacker – understanding HTTP only and Secure cookies&lt;/a&gt;. Let’s log back in again via Chrome and inspect that auth cookie we looked at earlier on. Here it is:&lt;/p&gt;
&lt;p&gt;&lt;img width="458" height="247" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Auth cookie not marked as &amp;quot;secure&amp;quot;" src="http://lh4.ggpht.com/-xevkI2IGYps/UVv9sJVwVvI/AAAAAAAAFGU/sO8R00BkK3o/SNAGHTML24ad4c73.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;See that “Secure” option? Well obviously it isn’t! The problem this creates is it means the browser will happily send this cookie across an insecure connection and indeed that’s the problem we saw above when the page loaded over HTTP was able to recognise that we were authenticated. In this case I suspect it’s actually &lt;em&gt;by design&lt;/em&gt; (which is even worse) as if the cookie was actually secure then you’d never be able to see your authenticated state reflected on those insecure pages.&lt;/p&gt;
&lt;p&gt;Flagging a cookie as secure means that the browser simply will not send it over an insecure connection which is exactly what you want when we’re talking about auth cookies. All the HTTPS in the world won’t save you when there’s just one single inadvertent HTTP request which discloses the auth cookie and we saw earlier, this one simple mistake could mean disclosing &lt;em&gt;serious&lt;/em&gt; data such as banking info.&lt;/p&gt;
&lt;h4&gt;Problem 5. Relying on HTTP to load login forms&lt;/h4&gt;
&lt;p&gt;It’s taken until the last point but let me get back to the original assertion about the login form being loaded over HTTPS. Firstly, we’ve already registered over HTTP and sent our password via an insecure channel then sent that auth cookie flying around in the clear so by now the value presented by HTTPS has pretty much been shot to pieces anyway. But let’s push on.&lt;/p&gt;
&lt;p&gt;When you hit the login button you’re presented with this following:&lt;/p&gt;
&lt;p&gt;&lt;img width="463" height="394" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Login form with a padlock" src="http://lh6.ggpht.com/-PTgPXMtbf9s/UVv9s-8_QCI/AAAAAAAAFGc/fYMl3XQlmVw/image32.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;You know &lt;a href="http://www.troyhunt.com/2011/07/padlock-icon-must-die.html"&gt;it’s secure because it has a padlock bitmap&lt;/a&gt; and it says “SECURE LOGIN”, right?! What actually happens here is that the browser makes a separate request to &lt;a href="https://www.topcashback.co.uk/login?RedirectURL=http%3a%2f%2fwww.topcashback.co.uk%2fhome"&gt;this page containing the login form&lt;/a&gt; which is indeed requested over HTTPS. The question is &lt;em&gt;how did the browser know to request that page?&lt;/em&gt; I’ll tell you how, the page we originally loaded – the one requested insecurely over HTTP – has the following markup in it:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;a &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="login-toggle" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;href&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="#" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Login" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;onclick&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="ToggleLogin('https://www.topcashback.co.uk/login?RedirectURL=http%3a%2f%2fwww.topcashback.co.uk%2fhome');return false;" &amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;span&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Login&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;span&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;a&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;The problem, of course, is that when you load a page over HTTP then there’s no protection against a man in the middle manipulating the contents of the page. For example, there’s nothing to stop an attacker from changing that login path to a website of their own, they could then easily replicate the login control layout and the victim would be none the wiser. Tampering of this kind is nothing new, in fact it’s something we’ve seen many times before including in the Tunisian government example &lt;a href="http://www.troyhunt.com/2011/11/owasp-top-10-for-net-developers-part-9.html"&gt;I reference here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So how does this differ to other more secure implementations? The main thing is that “none the wiser” bit; because the login page is loaded into an iframe there’s no ability for the user to see the certificate loaded into the browser, you know, the one that’s usually perfectly clear in the address bar:&lt;/p&gt;
&lt;p&gt;&lt;img width="503" height="265" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Inspecting the certificate on the ASafaWeb website" src="http://lh3.ggpht.com/-M4HMX6O0IZc/UVv9t_V0b8I/AAAAAAAAFGk/ytmju8_vIT8/image35.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;In fact on that basis alone – the fact that the certificate can’t be seen – it means the implementation is relying on the user’s trust rather than explicitly showing them “Hey, here’s the HTTPS address and the certificate”. Without either of these the user can only draw the assumption that Mark did right back at the beginning which is that their credentials are being sent in plain text.&lt;/p&gt;
&lt;h4&gt;Norton secured (so it must be secure!)&lt;/h4&gt;
&lt;p&gt;One of the great ironies with this site is the “Norton Secured” logo down the bottom right hand corner:&lt;/p&gt;
&lt;p&gt;&lt;img width="199" height="114" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Norton Secured Logo" src="http://lh5.ggpht.com/-5S6C4IldNKU/UVv9uQPIVWI/AAAAAAAAFGs/hbv6eSpV5sA/image38.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;This gives a very reassuring report of the site:&lt;/p&gt;
&lt;p&gt;&lt;img width="549" height="423" title="" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" alt="Norton Secured report on site security" src="http://lh3.ggpht.com/-l7Ci7qEsezI/UVv9vN-PrjI/AAAAAAAAFG0/2phfJb04WRE/SNAGHTML288e3c63.png?imgmax=800" border="0"&gt;&lt;/p&gt;
&lt;p&gt;I’ve included this to make the point that whilst it may be reassuring, in this case it’s totally useless. The seal is on a page loaded over an HTTP address so in theory, it could have come from anywhere. But that aside, the whole assertion that a logo on a page implies some form of security when there are such blatant holes is a bit ludicrous.&lt;/p&gt;
&lt;h4&gt;Summary&lt;/h4&gt;
&lt;p&gt;The point with all the HTTPS in the Top CashBack site is simply this: it doesn’t matter how many pages you’re loading securely or how many padlock icons or vendor certifications you drop on the site, one you start sending auth cookies around insecurely, you’re toast. It’s &lt;em&gt;completely&lt;/em&gt; pointless to secure those banking details in transit but then let the auth cookie &lt;em&gt;which can load the financial data back up&lt;/em&gt; float around in the clear. That is a very insufficient use of HTTPS indeed.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TroyHunt/~4/ff-GGBqG6V0" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7436391908717582385?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3977663544337573923/posts/default/7436391908717582385?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TroyHunt/~3/ff-GGBqG6V0/5-ways-to-implement-https-in.html" title="5 ways to implement HTTPS in an insufficient manner (and leak sensitive data)" /><author><name>Troy Hunt</name><uri>https://plus.google.com/111846329802076778489</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-r4_CjHr7f7Q/AAAAAAAAAAI/AAAAAAAAEiM/0rQBorSp1ho/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-I2dWLaLSlwc/UVv9iNXOwEI/AAAAAAAAFFM/vJ8PKUF1NW4/s72-c/SNAGHTML270fc544.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.troyhunt.com/2013/04/5-ways-to-implement-https-in.html</feedburner:origLink></entry></feed>
