<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>authentication &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/authentication/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Fri, 12 Sep 2025 07:42:33 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>authentication &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Facebook 2FA Security Flaw (Disclosed)]]></title>
		<link>https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/</link>
					<comments>https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 12 Sep 2013 11:00:32 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[2fa]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=8641</guid>

					<description><![CDATA[I&#039;ve found (and disclosed) what I think is an interesting little security flaw in Facebook&#039;s Two-Factor Authentication usage.  First thing&#039;s first, this isn&#039;t a show-stopping bug.  It&#039;s more of a curiosity which shows how different providers treat the verification of Two-Factor Authentication.  Details  If you are a security conscious user, you should have set up Two-Factor Authentication (2FA).  …]]></description>
										<content:encoded><![CDATA[<p>I've found (and <a href="https://www.facebook.com/whitehat">disclosed</a>) what I think is an interesting little security flaw in Facebook's Two-Factor Authentication usage.</p>

<p>First thing's first, this isn't a show-stopping bug.  It's more of a curiosity which shows how different providers treat the verification of Two-Factor Authentication.</p>

<h2 id="details"><a href="https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/#details">Details</a></h2>

<p>If you are a security conscious user, you should have set up Two-Factor Authentication (2FA).  Every time you try to log in to Facebook, after providing the correct password, you are send a security code via SMS.  If you enter the code correctly, you're let in.  It looks a bit like this.
<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/08/Facebook-2FA-fs8.png" alt="Facebook 2FA-fs8" width="400" height="769" class="aligncenter size-full wp-image-8632"></p>

<p>If an attacker has hold of your password, she still won't be able to access your account because she doesn't have access to your phone.</p>

<p>However! There is more that Facebook could do to ensure that these codes are secure.  The vulnerability I discovered was that Facebook doesn't verify that the IP or User-Agent which <em>enters</em> the code is the same as the one which <em>requested</em> it.</p>

<h2 id="example"><a href="https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/#example">Example</a></h2>

<p>Alice has a mobile phone on IP address 198.51.100.1 - she access Facebook through her web-browser or app.  She enters the correct password and is sent a one-time code via SMS.</p>

<p>Bob has a laptop on IP address 203.0.113.5 - and is looking over Alice's shoulder.  He accesses Facebook in his browser and copies Alice's password.  When he sees the SMS come through, he quickly types it in and now has access to her account.</p>

<p>What Facebook <em>should</em> be doing is checking that the user who submits the token is the <strong>same user</strong> who requested the token.</p>

<p>An easy way to do this is to check that both request and response came from the same IP address.</p>

<p>To ensure that this cannot happen when two users have the same external IP (for example they are both on the same WiFi connection) Facebook should also check that the User-Agent is identical - that way a laptop cannot easily use a code intended for a specific model of phone.</p>

<p>Finally, to defend against an attacker having the same IP <em>and</em> the same device, the screen which asks for the code could have a hidden field which provides yet another proof that the submitter is the same as the requester.</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/08/Facebook-Enter-2FA-Code-fs8.png" alt="Facebook Enter 2FA Code-fs8" width="400" height="462" class="aligncenter size-full wp-image-8642">

<h2 id="does-it-work-elsewhere"><a href="https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/#does-it-work-elsewhere">Does It Work Elsewhere?</a></h2>

<p>It is possible that other sites which use 2FA are also deficient in the same way.</p>

<p>I tried on Twitter and found that the 2FA code was tied to the browser which requested it - but not to the IP address.</p>

<p>For example, requesting a 2FA code from Firefox will generate a code which didn't work in a Chrome session.  However, a code requested from Firefox still worked in the <em>same</em> browser even if I manually roamed onto a different WiFi network and subsequently got a new external IP address.
<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/08/Twitter-2FA-fs8.png" alt="Twitter 2FA-fs8" class="aligncenter size-medium wp-image-8692"></p>

<h2 id="impact"><a href="https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/#impact">Impact</a></h2>

<p>A couple of weeks after disclosing this to Facebook, I received the following reply:</p>

<blockquote><p>This is not an exploit an we will not be rewarding this.
</p><p>There are tradeoffs between security and usability and we've made a decision here; we are confident that two factors is sufficient to secure the accounts, and recommend that users keep their two-factor secrets, their password and their phone, secure.
</p><p>Inhibiting account authentication on the basis of IP address would have undesirable consequences for the victims, and even for non-victim users.
</p></blockquote>

<p>While I would have loved to been included on <a href="https://www.facebook.com/whitehat/thanks/">Facebook's Hall of Fame</a>, it's not hard to see that this is, at best, a relatively minor security flaw.  It relies on an attacker being able to discover or intercept two separate pieces of information.</p>

<p>But there's no reason to make it <strong>easy</strong> for an attacker who has got that far.</p>

<p>As Twitter has demonstrated, tying the response to the requesting browser is a cheap and easy way to defeat an attacker.  Personally, I would also ensure that the request and response came from the same IP address - although I can see certain situations (like mobile users) where that would be inconvenient.</p>

<p>I hope I have demonstrated why it's important to <em>thoroughly</em> verify credentials.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=8641&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2013/09/facebook-2fa-security-flaw-disclosed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
