<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Explore Security &#187; TLS</title>
	<atom:link href="http://www.exploresecurity.com/tag/tls/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.exploresecurity.com</link>
	<description>IT security tools, techniques and commentary</description>
	<lastBuildDate>Wed, 15 Jun 2022 09:21:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6.1</generator>
		<item>
		<title>A Thick Spread of Logjam</title>
		<link>http://www.exploresecurity.com/a-thick-spread-of-logjam/</link>
		<comments>http://www.exploresecurity.com/a-thick-spread-of-logjam/#comments</comments>
		<pubDate>Mon, 20 Jul 2015 22:26:59 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[Penetration Testing]]></category>
		<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[Logjam]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[pentesting]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=404</guid>
		<description><![CDATA[This article dissects the recent Logjam paper from a pentesting viewpoint to reveal a number of different factors that affect the impact of the vulnerability. One of those factors includes the use of common primes and I&#8217;ve included a small change to OpenSSL that you can use to look out for this. Two for the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>This article dissects the recent Logjam paper from a pentesting viewpoint to reveal a number of different factors that affect the impact of the vulnerability. One of those factors includes the use of common primes and I&#8217;ve included a small change to OpenSSL that you can use to look out for this.<span id="more-404"></span></p>
<h3>Two for the price of one</h3>
<p>For me, the penny dropped when I realised that the <a href="https://weakdh.org/imperfect-forward-secrecy.pdf">Logjam paper</a> sets out <em>two</em> strategies. The first is a <em>cryptanalytic</em> attack that uses pre-computation to speed up the process of cracking a Diffie-Hellman (DH) key exchange. The second is a <em>protocol</em> attack that allows weaker export-grade versions of DH-based cipher suites to be selected, so long as they are supported by the server. A man-in-the-middle attacker who can make use of the second technique can downgrade vulnerable connections, which helps the first attack by forcing the use of weaker cryptography. But an attacker doesn&#8217;t <em>have</em> to rely on the downgrade trick for an attack on the security of the connection to succeed. It all depends on what the attacker wants to achieve and what position they are in.</p>
<h3>Attack scenarios</h3>
<p>If the attacker wants to modify the data in transit then the attack must be performed in real time. The attacker must be a man-in-the-middle and have access to sufficient computing resources to perform the necessary cryptanalysis in a short space of time. To ease the cryptanalysis, if the attacker can downgrade the connection to using a 512-bit prime, then so much the better. That&#8217;s only possible if the server supports export-grade DH cipher suites. In the opinion of the Logjam authors, any 512-bit prime should be considered vulnerable but a 768-bit, and certainly a 1024-bit, DH prime would require a serious amount of effort to attack.</p>
<p>In contrast, decrypting (but not modifying) the secure traffic from a connection that begins with a DH key exchange can be done <em>passively</em> in slower time: the attacker can capture the traffic and run the cryptanalysis offline. In this case, the attacker must contend with whatever strength of DH prime was selected during the TLS negotiation, which is unlikely to be 512-bit. For passive attacks, cipher suite preference is therefore more important: if the server prefers a common cipher suite that <em>isn&#8217;t</em> based on the standard DH key exchange (e.g. AES256-SHA) then a passive attack is very unlikely to succeed.</p>
<h3>Client-side fixes</h3>
<p>As with a number of previous TLS bugs, browsers have applied plasters to the sores to try to mitigate the impact. Although the downgrade attack exploited a weakness in the TLS <em>protocol</em> rather than an implementation flaw, refusing to accept 512-bit DH primes is a quick and effective solution. But taking that strategy all the way up to 1024-bit primes is dangerous in terms of user experience &#8211; users could start complaining that sites are suddenly inaccessible. So the success of client-side &#8220;patching&#8221; will depend on the vendors, the minimum size of DH prime their browser accepts and the user’s update regime.</p>
<h3>Common primes</h3>
<p>Another factor to consider is the prime itself. The Logjam paper noted that servers tend to re-use it &#8211; and, not only that, but the same primes are in circulation across different implementations. The pre-computation work for the cryptanalysis is based on a single DH prime so it&#8217;s in the attacker&#8217;s interest to do the number crunching for primes that are most widely used. A server that uses a common prime is thus more of a target. But what are these common primes? The Logjam paper itself makes explicit reference to two 512-bit primes. A number of larger primes can be found by inspecting the JavaScript behind the <a href="https://weakdh.org/sysadmin.html">server test page</a> on the Logjam site. You can test for a dozen common primes by adding a bit of code to the file <code>apps/s_cb.c</code> before compiling OpenSSL. Since version 1.0.2 the default output includes a line, when appropriate, beginning “Server Temp Key”, e.g.<br />
<a href="http://www.exploresecurity.com/wp-content/uploads/2015/07/server_temp_key.png"><img class="aligncenter size-full wp-image-405" alt="server_temp_key" src="http://www.exploresecurity.com/wp-content/uploads/2015/07/server_temp_key.png" width="387" height="97" /></a><br />
Insert the following lines after the line that outputs the bit length, which is <code>BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(key));</code> (line 519 for the current version 1.0.2d):<br />
<code></code></p>
<pre>if (EVP_PKEY_bits(key) &gt; 1024)
   break;
const char *common[12]; // common primes from https://weakdh.org/imperfect-forward-secrecy.pdf, https://weakdh.org/docheck.js
common[0] = "9FDB8B8A004544F0045F1737D0BA2E0B274CDF1A9F588218FB435316A16E374171FD19D8D8F37C39BF863FD60E3E300680A3030C6E4C3757D08F70E6AA871033";
common[1] = "D4BCD52406F69B35994B88DE5DB89682C8157F62D8F33633EE5772F11F05AB22D6B5145B9F241E5ACC31FF090A4BC71148976F76795094E71E7903529F5A824B";
common[2] = "E9E642599D355F37C97FFD3567120B8E25C9CD43E927B3A9670FBEC5D890141922D2C3B3AD2480093799869D1E846AAB49FAB0AD26D2CE6A22219D470BCE7D777D4A21FBE9C270B57F607002F3CEF8393694CF45EE3688C11A8C56AB127A3DAF";
common[3] = "D67DE440CBBBDC1936D693D34AFD0AD50C84D239A45F520BB88174CB98BCE951849F912E639C72FB13B4B4D7177E16D55AC179BA420B2A29FE324A467A635E81FF5901377BEDDCFD33168A461AAD3B72DAE8860078045B07A7DBCA7874087D1510EA9FCC9DDD330507DD62DB88AEAA747DE0F4D6E2BD68B0E7393E0F24218EB3";
common[4] = "BBBC2DCAD84674907C43FCF580E9CFDBD958A3F568B42D4B08EED4EB0FB3504C6C030276E710800C5CCBBAA8922614C5BEECA565A5FDF1D287A2BC049BE6778060E91A92A757E3048F68B076F7D36CC8F29BA5DF81DC2CA725ECE66270CC9A5035D8CECEEF9EA0274A63AB1E58FAFD4988D0F65D146757DA071DF045CFE16B9B";
common[5] = "E6969D3D495BE32C7CF180C3BDD4798E91B7818251BB055E2A2064904A79A770FA15A259CBD523A6A6EF09C43048D5A22F971F3C20129B48000E6EDD061CBC053E371D794E5327DF611EBBBE1BAC9B5C6044CF023D76E05EEA9BAD991B13A63C974E9EF1839EB5DB125136F7262E56A8871538DFD823C6505085E21F0DD5C86B";
common[6] = "C9BBF5F774A8297B0F97CDDA3A3468C7117B6BF799A13D9F1F5DAC487B2241FE95EFB13C2855DFD2F898B3F99188E24EDF326DD68C76CC85537283512D46F1953129C693364D8C71202EABB3EBC85C1DF53907FBD0B7EB490AD0BC99289686800C46AB04BF7CDD9AD425E6FB25592EB6258A0655D75E93B2671746AE349E721B";
common[7] = "CD5C22FAEA0C53C39E602242C088FA0EA31586F472E9B04606AEDFB35F56C4948095F687B388575FA1700DB3D02253025A523AC76E9646F755A12338653AE071CB64F185591C34C6673FAC9B78DC4D71E53F3A5CCA6326F89C5400FBF8272A76367C630E234A905E4E558CDA968A46A136AD3088DD295F934EC36ADB5F69C3F3";
common[8] = "92402435C3A12E44D3730D8E78CADFA78E2F5B51A956BFF4DB8E56523E9695E63E32506CFEB912F2A77D22E71BB54C8680893B82AD1BCF337F7F7796D3FB968181D9BA1F7034ABFB1F97B3104CF3203F663E81990B7E090F6C4C5EE1A0E57EC174D3E84AD9E72E6AC7DA6AEA12DF297C131854FBF21AC4E879C23BBC60B4F753";
common[9] = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF";
common[10] = "D6C094AD57F5374F68D58C7B096872D945CEE1F82664E0594421E1D5E3C8E98BC3F0A6AF8F92F19E3FEF9337B99B9C93A055D55A96E425734005A68ED47040FDF00A55936EBA4B93F64CBA1A004E4513611C9B217438A703A2060C2038D0CFAAFFBBA48FB9DAC4B2450DC58CB0320A0317E2A31B44A02787C657FB0C0CBEC11D";
common[11] = "B10B8F96A080E01DDE92DE5EAE5D54EC52C99FBCFB06A3C69A6A9DCA52D23B616073E28675A23D189838EF1E2EE652C013ECB4AEA906112324975C3CD49B83BFACCBDD7D90C4BD7098488E9C219A73724EFFD6FAE5644738FAA31A4FF55BCCC0A151AF5F0DC8B4BD45BF37DF365C1A65E68CFDA76D4DA708DF1FB2BC2E4A4371";

char *prime;
prime = BN_bn2hex(key-&gt;pkey.dh-&gt;p);
BIO_printf(out, "---&gt; DH prime: %s\n", prime);
int i;
for (i = 0; i &lt; 12; i++) {    if (!strcmp(prime, common[i])) {        BIO_puts(out, "---&gt; Warning - common prime!\n");
       break;
   }
}</pre>
<p>So you should have something like:<br />
<a href="http://www.exploresecurity.com/wp-content/uploads/2015/07/openssl_code.png"><img class="aligncenter size-full wp-image-406" alt="openssl_code" src="http://www.exploresecurity.com/wp-content/uploads/2015/07/openssl_code.png" width="404" height="410" /></a><br />
Now you’ll get output such as:<br />
<a href="http://www.exploresecurity.com/wp-content/uploads/2015/07/common_prime.png"><img class="aligncenter size-full wp-image-407" alt="common_prime" src="http://www.exploresecurity.com/wp-content/uploads/2015/07/common_prime.png" width="375" height="101" /></a><br />
Remember that you may need to employ the <code>-cipher DH</code> parameter to force OpenSSL to use a DH-based cipher suite. If export-grade as well as stronger DH suites are supported then you&#8217;ll also have to use something like <code>-cipher EXP</code> on a second connection to ensure you test the commonality of both primes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/a-thick-spread-of-logjam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing for POODLE_TLS Manually</title>
		<link>http://www.exploresecurity.com/testing-for-poodle_tls-manually/</link>
		<comments>http://www.exploresecurity.com/testing-for-poodle_tls-manually/#comments</comments>
		<pubDate>Fri, 13 Mar 2015 12:25:24 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[penetration testing]]></category>
		<category><![CDATA[POODLE]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[tlslite]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=362</guid>
		<description><![CDATA[Testing for the original POODLE vulnerability was easy because it was an inherent problem with SSLv3, so if you find SSLv3 enabled then you&#8217;ve found POODLE (although other factors such as cipher suite preference have a role to play &#8211; see my previous post). Like Heartbleed, though, testing for POODLE over TLS is conceptually easy [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Testing for the original POODLE vulnerability was easy because it was an inherent problem with SSLv3, so if you find SSLv3 enabled then you&#8217;ve found POODLE (although other factors such as cipher suite preference have a role to play &#8211; see my previous <a title="Thoughts on Testing for POODLE" href="http://www.exploresecurity.com/thoughts-on-testing-for-poodle/">post</a>). Like Heartbleed, though, testing for POODLE <em>over TLS</em> is conceptually easy but it falls within a class of flaws that requires bespoke tools as an unpatched version of <code>openssl</code>, for example, won&#8217;t do what you want it to do. This article discusses how the Python <em>tlslite</em> library can be used to test for POODLE_TLS &#8211; and so much more.<span id="more-362"></span></p>
<h3>What is <em>tlslite</em>?</h3>
<p>From the <a href="https://github.com/trevp/tlslite">source</a> &#8220;TLS Lite is an open source python library that implements SSL and TLS&#8221;. I&#8217;d seen references to it in the original BEAST <a href="http://vnhacker.blogspot.co.uk/2011/09/beast.html">post</a> written by Thai Duong and an article on <a href="https://vivaldi.net/blogs/entry/what-is-tls-testing-tlsprober-net">TLS Prober</a> by Yngve Pettersen. This gave me some confidence that <em>tlslite</em> would be a good starting point. Obviously it&#8217;s not going to be fast but that doesn&#8217;t matter. With a SSL/TLS implementation in a high level language, it would be much easier to make the changes required for the sorts of tests I wanted to run, and I thought POODLE_TLS would be a good one to try first.</p>
<p>TLS Prober is in fact where I wanted to be heading. It works on a modified version of <em>tlslite</em> to test for various SSL/TLS bugs. However, the public source code hasn&#8217;t been updated since Yngve left Opera in 2013 and thus wouldn&#8217;t cover POODLE_TLS. While I could have added that capability, I decided to ignore TLS Prober (for now) and start afresh with the latest <em>tlslite</em> &#8211; mainly as it would be a good learning experience.</p>
<h3>How to test for POODLE_TLS</h3>
<p>I&#8217;m not going to re-hash theory that&#8217;s already <a href="https://www.imperialviolet.org/2014/10/14/poodle.html">covered</a> <a href="https://www.imperialviolet.org/2014/12/08/poodleagain.html">elsewhere</a>. Suffice to say that implementations of TLS that are faithful to the RFC shouldn&#8217;t be vulnerable to POODLE because the spec states what the contents of the padding bytes should be. Therefore, the way to test for POODLE_TLS is to ignore that rule and see if the connection is terminated by the server. This isn&#8217;t the same as performing a full attack but like all testing you have to compromise between accuracy and aggressiveness. I think this test is a good indication. After some rummaging through the source code and a bit of debugging, I found what I wanted.</p>
<h3>Changes to <em>tlslite</em></h3>
<p>It seemed a bit crazy to fork the <a href="https://github.com/trevp/tlslite">original project</a> as my changes were tiny. I also thought that working through the changes here may be helpful to anyone else who wants to do the same sort of thing.</p>
<p>So to begin with I needed to signal to <em>tlslite</em> that I wanted to send TLS messages with invalid padding. You get things going with <em>tlslite</em> through the <code>TLSConnection</code> class so I changed how that was instantiated. <code>TLSConnection</code> inherits from <code>TLSRecordLayer</code>, which is where the padding code lives, so that needed changing too. Within the &#8220;tlslite&#8221; folder I made the following changes (obviously line numbers will be version dependent so I&#8217;ve added the original code too; my version was 0.4.8):</p>
<p><strong>tlsconnection.py</strong><br />
Line 52 was:<br />
<code>def __init__(self, sock):</code><br />
Now:<br />
<code>def __init__(self, sock, check_poodle_tls=False):</code><br />
# now i can signal whether or not I want to perform the test<br />
# if you already have <em>tlslite</em>, you can change it safely because <code>check_poodle_tls</code> defaults to <code>False</code> so it&#8217;s backward-compatible with any existing code that makes use of <em>tlslite</em></p>
<p>Line 61 was:<br />
<code>TLSRecordLayer.__init__(self, sock)</code><br />
Now:<br />
<code>TLSRecordLayer.__init__(self, sock, check_poodle_tls)</code><br />
# I need to pass that signal on to the parent</p>
<p><strong>tlsrecordlayer.py</strong><br />
Line 102 was:<br />
<code>def __init__(self, sock):</code><br />
Now:<br />
<code>def __init__(self, sock, check_poodle_tls):</code></p>
<p>After line 103 <code>self.sock = sock</code> added new line:<br />
<code>self.check_poodle_tls = check_poodle_tls</code></p>
<p>After line 600 <code>paddingBytes = bytearray([paddingLength] * (paddingLength+1))</code> added new lines:<br />
<code>if self.check_poodle_tls == True:<br />
<span style="padding-left: 30px;">paddingBytes = bytearray(x ^ 42 for x in paddingBytes[0:-1])</span><br />
<span style="padding-left: 30px;">paddingBytes.append(paddingLength)</span></code><br />
# change all but the last of the padding bytes to be invalid (just XOR with 42, the answer to everything)<br />
# make the last byte of padding valid = the number of padding bytes</p>
<p>And that&#8217;s it! Remember, as it&#8217;s Python, that tabs are important and the new code needs to be properly aligned.</p>
<h3>POODLE_TLS test script</h3>
<p>I then created the test script (available <a href="https://github.com/exploresecurity/test_poodle_tls">here</a>), which attempts a normal TLS connection first before testing for POODLE using the invalid padding trick. Place the script within the modified <em>tlslite</em> and run it as <code>test_poodle_tls.py &lt;hostname&gt;</code>. Remember, it only tests for POODLE <em>over TLS, <u>not</u> SSLv3.</em></p>
<p>I&#8217;ve noticed that sometimes the normal connection fails and one of the reasons for this is that the server does not support any of the small number of cipher suites offered by <em>tlslite</em>. In this case no conclusion can be drawn &#8211; and the script catches that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/testing-for-poodle_tls-manually/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Five Considerations for HTTP Public Key Pinning (HPKP)</title>
		<link>http://www.exploresecurity.com/five-considerations-for-http-public-key-pinning-hpkp/</link>
		<comments>http://www.exploresecurity.com/five-considerations-for-http-public-key-pinning-hpkp/#comments</comments>
		<pubDate>Tue, 27 Jan 2015 10:22:10 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[HPKP]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=325</guid>
		<description><![CDATA[Scott Helme recently published a how-to on HPKP (HTTP Public Key Pinning), which got me thinking about some of the finer details. I&#8217;ll assume you&#8217;re familiar with the basic idea and go straight into five points worthy of highlighting that arise from Scott&#8217;s article and the specification itself. 1. It&#8217;s not a standard yet [See [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Scott Helme recently <a href="https://scotthelme.co.uk/hpkp-http-public-key-pinning/">published</a> a how-to on HPKP (HTTP Public Key Pinning), which got me thinking about some of the finer details. I&#8217;ll assume you&#8217;re familiar with the basic idea and go straight into five points worthy of highlighting that arise from Scott&#8217;s article and the specification itself.<span id="more-325"></span></p>
<h3>1. It&#8217;s not a standard yet</h3>
<p><a href="#update"><span style="color: red;">[See update below]</span></a><br />
HPKP is still a draft and as such is likely to be in a greater state of flux than your &#8220;average&#8221; standard. Last year it went through 11 changes. Of course that&#8217;s not to say that every change has been (and will be) critical, but keep an eye on it, as something may change that affects your implementation. For example, version 10 (Feb 2014) dropped SHA-1: currently only SHA-256 is honoured. So if your HPKP header is based on a SHA-1 hash then it&#8217;s <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.1">invalid</a>.</p>
<h3>2. What exactly is being pinned?</h3>
<p>The next thing to point out is that we&#8217;re not pinning certificates, that&#8217;s why it&#8217;s HPKP and not HCP or something. The reasons for not pinning certificates are discussed <a href="https://www.imperialviolet.org/2011/05/04/pinning.html">elsewhere</a>. What&#8217;s actually <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.4">pinned</a> is the Subject Public Key Info (SPKI) field. According to the X509 <a href="https://tools.ietf.org/html/rfc5280#section-4.1.2.7">standard</a>, this field is &#8220;used to carry the public key and identify the algorithm with which the key is used&#8221;. Because SPKI sounds a bit abstract, I&#8217;ll just use &#8220;public key&#8221; from now on.</p>
<p>What this means is that you can renew your SSL certificate without any thought to HPKP as long as your CA renews the same public key. On the other hand, if you want to refresh your keys at renewal time, you&#8217;ll have to update your HPKP pins, as even if you use your back-up key for the renewal, you&#8217;ve then lost your back-up. But I&#8217;m implying here that you&#8217;ve only got two pins&#8230;</p>
<h3>3. Validation</h3>
<p>Part of the <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.5">checks</a> for accepting a new pin is that <em>at least one</em> public key in the certificate chain for the connection is submitted for pinning, along with <em>at least one</em> public key that is NOT in the chain, which is your back-up. From this it&#8217;s clear that you can pin any one of the public keys in the certificate chain &#8211; from the root to the leaf (or more) &#8211; and you can have as many back-ups as you like. The flip-side to this is that the browser doesn&#8217;t know which pins are active and which are back-ups so, when <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.6">validating</a> a pinned connection, it&#8217;s a case of OR, not AND. In other words, <em>only one</em> of the stored pins needs to match one of the public keys in the presented certificate chain and thus adding more active pins does not mean that a larger part of the certificate chain must be matched for validation to succeed.</p>
<h3>4. Updating the policy</h3>
<p>The HPKP policy for a host is not set in stone until the expiry date: it can be <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.3.1">refreshed</a> with every new valid header &#8211; and in fact the policy can be removed altogether with <code>max-age=0</code>. Obviously the public key pins themselves can be <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.5">updated</a> following validation too.</p>
<h3>5. You can trial it safely</h3>
<p>HPKP contains a <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.1.4">reporting function</a> whereby a failed validation can be reported to a URI set by the <code>report-uri</code> directive in the HPKP header, e.g.</p>
<p><code>Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; report-uri="http://example.com/pkp-report"; includeSubDomains</code></p>
<p>Early on in its development the specification added a PKP-RO (Public-Key-Pins-Report-Only) header that, as the name suggests, instructs the browser <em>not to enforce</em> the policy, only to report any validation failures, e.g.</p>
<p><code>Public-Key-Pins-Report-Only: pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; report-uri="http://example.com/pkp-report"</code></p>
<p>In this way any mistakes aren&#8217;t punished with a failed connection but your report-uri page receives details on what went wrong. Note that in this mode any <code>max-age</code> value is <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.1.2">ignored</a> (so it isn&#8217;t set above) because browsers <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.3.3">don&#8217;t store</a> the pinning details for report-only directives. But this could lead to a situation where someone (who doesn&#8217;t realise this) sets the PKP-RO header with the <code>includeSubDomains</code> directive and assumes that no reporting means everything is working great. In fact, because the validation is performed on the current connection only, the PKP-RO header must always be present wherever validation is needed. So ensure the PKP-RO header is being set throughout your domain space.</p>
<p>I should add that the report-only mode is not mandatory so this feature may be browser-dependent. By the way, you can actually set both headers simultaneously: the specification states that they should be <a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#section-2.3.2">treated independently</a>.</p>
<h1>Lastly&#8230;</h1>
<p>Due to point 1, all of this is subject to change!</p>
<h3 id="update"><span style="color: red;">UPDATE</h3>
<p>HPKP became a standard in April 2015 &#8211; <a href="https://tools.ietf.org/rfc/rfc7469.txt">RFC 7469</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/five-considerations-for-http-public-key-pinning-hpkp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SS-Hell: the Devil is in the Details</title>
		<link>http://www.exploresecurity.com/ss-hell-the-devil-is-in-the-details/</link>
		<comments>http://www.exploresecurity.com/ss-hell-the-devil-is-in-the-details/#comments</comments>
		<pubDate>Thu, 06 Nov 2014 12:58:05 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[Penetration Testing]]></category>
		<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[Whitepaper]]></category>
		<category><![CDATA[penetration testing]]></category>
		<category><![CDATA[pentesting]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=474</guid>
		<description><![CDATA[Penetration test reports commonly contain mention of vulnerabilities in SSL/TLS (hereafter referred to as just SSL). In many cases, this is due to system administrators not understanding the details of these services&#8217; configuration and assuming that simply using SSL provides security. The issues identified during penetration tests are usually low in severity, as an average [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Penetration test reports commonly contain mention of vulnerabilities in SSL/TLS (hereafter referred to as just SSL). In many cases, this is due to system administrators not understanding the details of these services&#8217; configuration and assuming that simply <em>using</em> SSL provides security. The issues identified during penetration tests are usually low in severity, as an average attacker would find them difficult to exploit, but they should be taken seriously to ensure that data in transit is properly secured. If something&#8217;s worth doing, it&#8217;s worth doing well. This <a href="https://research.nccgroup.com/wp-content/uploads/2020/07/ss-hell-v11-final.pdf">whitepaper</a>, co-written with <a href="https://twitter.com/wilgeralexander">Will Alexander</a>, discusses how organisations can avoid SSL issues commonly found during penetration tests, ensure that data in transit is properly secured and ultimately instil in users a sense of confidence that their information is adequately protected.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/ss-hell-the-devil-is-in-the-details/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing for Cipher Suite Preference</title>
		<link>http://www.exploresecurity.com/testing-for-cipher-suite-preference/</link>
		<comments>http://www.exploresecurity.com/testing-for-cipher-suite-preference/#comments</comments>
		<pubDate>Fri, 31 Oct 2014 22:00:01 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[Penetration Testing]]></category>
		<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[penetration testing]]></category>
		<category><![CDATA[pentesting]]></category>
		<category><![CDATA[POODLE]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=296</guid>
		<description><![CDATA[It&#8217;s often important to know which SSL/TLS cipher suite is preferred by a server to alter the risk rating of a particular issue. For POODLE, if the server prefers RC4 ciphers over SSLv3 connections then it&#8217;s very unlikely that a connection will be vulnerable to POODLE. Similarly, if a server prefers block ciphers then reporting [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s often important to know which SSL/TLS cipher suite is preferred by a server to alter the risk rating of a particular issue. For <a href='http://www.exploresecurity.com/thoughts-on-testing-for-poodle/'>POODLE</a>, if the server prefers RC4 ciphers over SSLv3 connections then it&#8217;s very unlikely that a connection will be vulnerable to POODLE. Similarly, if a server prefers block ciphers then reporting RC4 support should be appropriately adjusted. Occasionally tools conflict over which cipher suite is preferred so I thought I&#8217;d write up how to resolve this manaully in the spirit of the <a href='http://www.exploresecurity.com/ssltls-checklist-for-pentesters/'>SSL/TLS manual cheatsheet</a>.<span id="more-296"></span></p>
<h3>How is a cipher suite chosen?</h3>
<p>Quick overview: the connection starts with a Client Hello in which the client advertises which cipher suites it supports in order of preference (most preferred first). This list will be tailored according to any local configuration, as well as to the SSL/TLS protocol version the client is hoping to use, which is also advertised in the Client Hello:</p>
<p><a href="http://www.exploresecurity.com/wp-content/uploads/2014/10/client_hello.png"><img src="http://www.exploresecurity.com/wp-content/uploads/2014/10/client_hello.png" alt="client_hello" width="527" height="289" class="aligncenter size-full wp-image-300" /></a></p>
<p>The protocol version is the highest the client supports &#8211; unless the browser has gone down the fallback route, which is the mechanism <a href='http://www.exploresecurity.com/poodle-and-the-tls_fallback_scsv-remedy/'>abused by POODLE</a> to make the SSLv3 attack more practical. Cipher suites can vary with protocol version simply because older protocols can&#8217;t always meet the needs of newer cipher suites. For example, only TLSv1.2 supports cipher suites that use SHA-256 for message integrity.</p>
<p>In receipt of the Client Hello, the server now has two options: it can either (a) opt for the client&#8217;s most preferred cipher suite that it too supports, or (b) ignore the client&#8217;s preference and opt for the cipher suite nearest the top of its <em>own</em> list that the client supports. For example, say the client has sent up a list of cipher suites which we&#8217;ll just call 1,2,3,4,5,6,7 and the server supports 8,3,4,2,6. In the case of (a) the server&#8217;s order is unimportant and it chooses 2; in the case of (b) the server chooses 3. The choice the server makes is returned in the Server Hello message:</p>
<p><a href="http://www.exploresecurity.com/wp-content/uploads/2014/10/server_hello.png"><img src="http://www.exploresecurity.com/wp-content/uploads/2014/10/server_hello.png" alt="server_hello" width="490" height="147" class="aligncenter size-full wp-image-302" /></a></p>
<p>Something to note in the above example is that, in the case of the server having a preference, you would never find out that cipher suite 8 is in fact the preferred choice because it isn&#8217;t supported by the client and thus it&#8217;s never offered in the Client Hello. Server preference is thus not only dictated by the server: it depends on what the client knows too.</p>
<h3>Conflicting results</h3>
<p>On my last test I had a conflict between SSLyze and SSLscan over which cipher suite was preferred over SSLv3. SSLyze thought it was RC4-SHA (I&#8217;m using the OpenSSL notation here)&#8230;</p>
<p><a href="http://www.exploresecurity.com/wp-content/uploads/2014/10/sslyze.png"><img src="http://www.exploresecurity.com/wp-content/uploads/2014/10/sslyze.png" alt="sslyze" width="1252" height="145" class="aligncenter size-full wp-image-297" /></a></p>
<p>&#8230;whereas SSLscan went for DES-CBC3-SHA:</p>
<p><a href="http://www.exploresecurity.com/wp-content/uploads/2014/10/sslscan.png"><img src="http://www.exploresecurity.com/wp-content/uploads/2014/10/sslscan-300x45.png" alt="sslscan" width="300" height="45" class="aligncenter size-medium wp-image-298" /></a></p>
<h3>Manually testing for preference</h3>
<p>To resolve this was simple. I ran:</p>
<p><code>openssl s_client -ssl3 -connect &lt;host&gt;:443</code></p>
<p>OpenSSL reported that DES-CBC3-SHA had been chosen. Just to be sure &#8211; which I explain below &#8211; I let the two cipher suites in question compete with one another using the <code>-cipher</code> switch, which allows you to put specific cipher suites in the Client Hello. OpenSSL orders them exactly how you list them according to the scheme set out in <code>man ciphers</code>. So I ran:</p>
<p><code>openssl s_client -ssl3 -cipher DES-CBC3-SHA:RC4-SHA -connect &lt;host&gt;:443</code></p>
<p>and then switched the order of the cipher suites:</p>
<p><code>openssl s_client -ssl3 -cipher RC4-SHA:DES-CBC3-SHA -connect &lt;host&gt;:443</code>.</p>
<p>In both cases DES-CBC3-SHA was chosen so I was confident that SSLscan was right.</p>
<h3>Why did SSLyze get it wrong this time?</h3>
<p>Up to now I had tried SSLyze versions 0.9 and 1.0dev and both had reported RC4-SHA as the preferred cipher suite. I then tried an earlier 0.6beta version and found it correctly reported DES-CBC3-SHA. Rather than delve into the code I first took the easy option and fired up Wireshark while running one of the later versions of SSLyze. When enumerating the supported cipher suites, I could see that DES-CBC3-SHA was tested individually; however, when it came to checking for preference, DES-CBC3-SHA was left out of the list in the Client Hello. Obviously the server couldn&#8217;t choose it in this case, hence the preference was misreported. I <a href='https://github.com/nabla-c0d3/sslyze/issues/10'>reported</a> this as a bug and Alban Diquet explained that:</p>
<blockquote><p>The reason why DES-CBC3-SHA isn&#8217;t sent within the preference test is that specific servers will not reply at all if the client hello is larger than 255 bytes (due to a bug in a specific brand of load balancers). To reduce the size of the hello, I had to disable some stuff including specific cipher suites.</p></blockquote>
<p>In this case the server only supported 3 cipher suites over SSLv3 so this misidentification could have been avoided. And this got me thinking&#8230;</p>
<h3>Algorithm for testing preference</h3>
<p>For each supported SSL/TLS protocol version, this is my version 0.1 of a method a tool could use to work out cipher suite preference:</p>
<ol>
<li>Determine which cipher suites are supported individually (i.e. repeatedly send a Client Hello with just one cipher suite and see if it&#8217;s accepted).</li>
<li>Once you know which suites are supported, send them all up in one Client Hello and see which one is picked. If you&#8217;re worried about the buggy load balancers mentioned above then use a subset for now.</li>
<li>If the chosen cipher suite is the one that was at the top of the list then there are two alternative explanations: either (a) the server picked the client&#8217;s preferred suite as it has no preference of its own, or (b) the server really does prefer that cipher suite and it just happened to be at the top. (This is why I ran more than one test above.) So repeat the test in step 2, this time changing the most preferred cipher suite at the top of the order. If the same cipher suite is chosen then it&#8217;s a case of (b) and the server definitely has a preference; otherwise, the first cipher suite should be chosen and it&#8217;s case of (a) where the server is happy to be guided by the client&#8217;s preference<sup>1</sup>.</li>
<li>If the cipher suite list has been cut short to appease buggy load balancers, repeat step 2 with the next set of cipher suites. If a preference has been expressed so far, that cipher suite should be included with the next set to allow it to compete.</li>
<li>If a preference has been found and you really wanted to go the whole hog, you could determine the order in full by starting again at step 2, missing out the cipher suite previously identified as preferred.
</ol>
<p>I put some of this to Alban Diquet (as part of the bug report) and he replied &#8220;yes I thought of adding the exact check you described but that&#8217;s pretty much at the bottom of my TODO list&#8221;. I think he was referring to step 3 but, anyway, if you ever have conflicting output from your tools over cipher suite preference, hopefully this posting will help you to resolve the issue.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><sup>1</sup> Actually, there is a possibility of &#8220;no preference&#8221; being misreported if you consider a server that supports cipher suite &#8220;wildcards&#8221; in such as way that there is no preference within a set of cipher suites that match a wildcard. I don&#8217;t think any popular implementation features this (hence the footnote) but for the sake of completeness imagine a server that prefers AES-* then RC4-*. The test tool sends up AES-SHA, AES-MD5, RC4-SHA, RC4-MD5 and AES-SHA is chosen. As per step 3, the tool then sends up AES-MD5, RC4-SHA, RC4-MD5, AES-SHA. This time AES-MD5 is chosen, giving the illusion of no server preference but in fact the server does have a preference, it&#8217;s just by groups. To cover this, if no server preference has been detected after step 3, repeat step 2 rotating the cipher suite at the top of the list each time; if at any point the cipher suite selected is <em>not</em> the first on the list then the server <em>does</em> have a preference. Admittedly this could add a fair bit of overhead!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/testing-for-cipher-suite-preference/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>POODLE and the TLS_FALLBACK_SCSV Remedy</title>
		<link>http://www.exploresecurity.com/poodle-and-the-tls_fallback_scsv-remedy/</link>
		<comments>http://www.exploresecurity.com/poodle-and-the-tls_fallback_scsv-remedy/#comments</comments>
		<pubDate>Wed, 15 Oct 2014 16:01:00 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[POODLE]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[SSLv3]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=277</guid>
		<description><![CDATA[The POODLE attack announced very recently depends largely on a protocol downgrade attack (which I covered in my SSL/TLS presentation at BSides). I don&#8217;t think this aspect of TLS security was widely appreciated &#8211; but it is now! It&#8217;s a fair bet that any technical article about POODLE includes the phrase &#8220;TLS_FALLBACK_SCSV&#8221; as a remedy. [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The <a href="https://www.openssl.org/~bodo/ssl-poodle.pdf">POODLE</a> attack announced very recently depends largely on a protocol downgrade attack (which I covered in my <a title="SSL/TLS Checklist for Pentesters" href="http://www.exploresecurity.com/ssltls-checklist-for-pentesters/">SSL/TLS presentation</a> at BSides). I don&#8217;t think this aspect of TLS security was widely appreciated &#8211; but it is now! It&#8217;s a fair bet that any technical article about POODLE includes the phrase &#8220;TLS_FALLBACK_SCSV&#8221; as a remedy. This article discusses the mechanism proposed to protect us from attackers forcing TLS downgrades. <span style="color: red;">NEW (16/10/14):</span> while I was writing this I thought of a small but potential compatibility problem, which in fact could do us all a favour. I checked with the authors of the RFC and Adam Langley was kind enough to reply back so I&#8217;ve added added a <a href='#new'>new section below</a>.<span id="more-277"></span></p>
<p>TLS_FALLBACK_SCSV is a fake cipher suite advertised in the Client Hello, which starts the SSL/TLS handshake. SCSV stands for &#8220;Signaling Cipher Suite Value&#8221;. The idea of using a cipher suite as a signal is not new: TLS_EMPTY_RENEGOTIATION_INFO_SCSV is a way clients can advertise that they support secure renegotiation (addressing CVE-2009-3555):</p>
<p><a href="http://www.exploresecurity.com/wp-content/uploads/2014/10/secure_reneg_SCSV.png"><img class="aligncenter size-full wp-image-278" alt="secure_reneg_SCSV" src="http://www.exploresecurity.com/wp-content/uploads/2014/10/secure_reneg_SCSV.png" width="510" height="86" /></a></p>
<p>The <a href="https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00">RFC</a> for the TLS_FALLBACK_SCSV mechanism is still a draft but <a href="https://www.imperialviolet.org/2014/10/14/poodle.html">apparently</a> Chrome (and Google from the server-side) has been using it since February 2014. This is no surprise as the RFC was written by two Google heavyweights. (Perhaps this was written with POODLE in mind as the RFC and the attack share an author &#8211; but that&#8217;s pure speculation!)</p>
<p>The whole business of successively downgrading the protocol version was put in place because browsers wanted to ensure they could connect to servers that were buggy. The TLS_FALLBACK_SCSV mechanism ensures that this downgrade only happens with the client&#8217;s blessing.</p>
<h3>How does the protection work?</h3>
<p>TLS_FALLBACK_SCSV is recommended for a client to indicate that it is knowingly repeating a SSL/TLS connection attempt over a lower protocol version than it supports (because the last one failed for some reason). When the server sees a TLS_FALLBACK_SCSV signal it compares the highest protocol version it supports to the version indicated in the Client Hello. If the client&#8217;s version is lower, then the server responds with a new Alert defined by the RFC called <code>inappropriate_fallback</code>. The idea being that the server knows the client supports something better so the connection should have negotiated that. The <code>inappropriate_fallback</code> Alert is a &#8220;fatal&#8221; error, i.e. the SSL/TLS connection is aborted.</p>
<h3>Why does this help against POODLE?</h3>
<p>Let&#8217;s say both the client and server support TLSv1.2. The client starts off, hoping to make a TLSv1.2 connection but an active man-in-the-middle attacker interferes with the handshake in the hope of forcing a downgrade. By repeatedly doing this, the attacker can force the use of SSLv3 and try some shenanigans like POODLE. Remember, the attacker can&#8217;t remove the TLS_FALLBACK_SCSV from the Client Hello because the handshake is cryptographically protected (unlike in SSLv2).</p>
<p>After the first round of interference, the client should try TLSv1.1. With the TLS_FALLBACK_SCSV signal in place, the server will pick up on the fact that the client is only requesting a TLVs.1.1 connection because of some difficulty earlier on. The server now knows that there is no good reason why a connection with a higher procotol version should have failed &#8211; and duly aborts the current connection.</p>
<p>The attacker could, of course, drop the TLSv1.1 and the following TLSv1.0 Client Hello. If the lack of response causes the browser to downgrade again then eventually the browser will try a SSLv3 connection, which the attacker will let through. Again, the TLS_FALLBACK_SCSV signal indicates to the server that the client supports something better and will terminate the connection attempt.</p>
<p>Okay, what if the client <em>doesn&#8217;t</em> support the server&#8217;s best protocol (TLS v1.2 in this example)? Just to be clear, let&#8217;s consider that case. The client would begin with, say, a TLSv1.0 connection. The attacker interferes with the handshake and so the client tries a SSLv3 connection with TLS_FALLBACK_SCSV. Again, the server knows that the client is only doing this because an earlier attempt with a higher protocol failed so it returns the Alert and the downgrade is aborted. If the client tries again, unhindered by the attacker, the client&#8217;s opening TLSv1.0 request is accepted because it lacks the TLS_FALLBACK_SCSV signal.</p>
<h3>It&#8217;s more than just a POODLE buster&#8230;</h3>
<p>The TLS_FALLBACK_SCSV mechanism doesn&#8217;t just protect us from attacks to downgrade connections to SSLv3: it protects us from forced downgrades completely. So when we want to connect using TLSv1.2, we can be sure that a meddling attacker can&#8217;t drop us down to TLSv1.0, which doesn&#8217;t support the best available cipher suites. As ever, we do need the server to play along.</p>
<h3>&#8230;but it&#8217;s not quite a silver bullet</h3>
<p>Of course, TLS_FALLBACK_SCSV doesn&#8217;t help if the best protocol version is SSLv3 at the client and SSLv3 is supported by the server &#8211; or vice versa. In this case SSLv3 will be agreed so no downgrade attack is required but the attacker still needs to make the browser perform multiple requests to the target domain, as the <a href="https://www.openssl.org/~bodo/ssl-poodle.pdf">whitepaper</a> explains. Remember that the attack only works with block ciphers operating in CBC mode so if the preferred cipher suite over SSLv3 is RC4 then the attack is likely to fail. Not that I&#8217;m advocating SSLv3 with RC4 as a solution though!</p>
<p>If SSLv3 is disabled either on the server or the client, POODLE has lost its bite. The only practical reason to support SSLv3 for servers is to humour IE6 users (because IE6 doesn&#8217;t enable TLSv1.0 by default). But if that&#8217;s a must then TLS_FALLBACK_SCSV &#8211; when supported by both client and server &#8211; will protect the vast majority of connections when SSLv3 isn&#8217;t necessary.</p>
<p><span style="color: red;">UPDATE:</span> <a href='https://www.openssl.org/news/secadv_20141015.txt'>OpenSSL 1.0.1j</a> supports TLS_FALLBACK_SCSV.</p>
<h3 id="new"><span style="color: red;">NEW: Assumptions and side effects</span></h3>
<p>While writing up these scenarios I thought of a potential compatibility issue when TLS_FALLBACK_SCSV was in place. The draft RFC states that the connection MUST be refused by the server if the <em>maximum</em> protocol version the server supports is higher than the one advertised in the Client Hello with the TLS_FALLBACK_SCSV signal. This assumes that the server supports all protocol versions in between the client&#8217;s stated version and the server&#8217;s maximum. What can the server infer about the client? It&#8217;s clear the client supports at least a protocol version <em>one higher</em> than that in the Client Hello. But that&#8217;s all the server knows. So what if one of those intermediate versions <em>isn&#8217;t</em> supported by the server and happens to be the highest version the client supports?</p>
<p>In previous pentests I have seen servers that don&#8217;t support TLSv1.1 but do support TLSv1.0 and TLSv1.2. Imagine a client that supports TLSv1.1 at best and so it starts off a TLSv1.1 connection. TLS allows for the server to respond saying effectively &#8220;sorry, can&#8217;t do that, I can do TLSv1.0&#8243;. But supposing it&#8217;s one of those buggy servers that the downgrade fallback was intended for&#8230;In this case the connection fails in an unexpected way and the browser attempts the connection again, this time using TLSv1.0 with the TLS_FALLBACK_SCSV signal. The server then refuses the connection as its maximum TLS version is 1.2 and it assumes the client can do better. But, in fact, the client doesn&#8217;t understand 1.2 and the server doesn&#8217;t want to talk 1.1. The two will never talk to each other.</p>
<p>I put this to the RFC authors and I was delighted that <a href="https://www.imperialviolet.org">Adam Langley</a> replied (on what must have been a particularly busy day!): &#8220;I think you&#8217;re correct that the server will break in that situation&#8221;. He also proposed another, simpler compatibility scenario: &#8220;a server believes that it implements TLS 1.2 but is buggy and doesn&#8217;t handle, say, the <code>signature_algorithms</code> extension correctly. It works currently because clients downgrade to TLS 1.1. If the server implements TLS_FALLBACK_SCSV then it breaks&#8221;.</p>
<p>But is this a problem? I guess it&#8217;s unlikely. I don&#8217;t know how many of these buggy servers are out there. It&#8217;s also a fair assumption that any server that has the awareness to support TLS_FALLBACK_SCSV has also got the TLS version negotiation working. What about from the client viewpoint? In the example above, according to <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security#Web_browsers">Wikipedia</a> older versions of Chrome and Opera supported TLSv1.1 at best but of course users of these browsers are now very likely to have been auto-updated to later versions. However, we want the TLS_FALLBACK_SCSV mechanism to be future-proof.</p>
<p>At the same, ultimately this is all the fault of buggy servers. Many browsers will look to disable SSLv3 in the light of POODLE, knowing that this will cause issues for a small number of sites but that&#8217;s a reasonable price to pay to protect the majority. Enabling TLS_FALLBACK_SCSV for the long-term good could be viewed in the same way. Adam Langley seemed to agree: &#8220;TLS_FALLBACK_SCSV is a way for good servers to lift themselves out of the swamp that buggy servers have created. If you have a buggy server and enable TLS_FALLBACK_SCSV then it could certainly break your server. Hopefully that&#8217;s noticed in testing and then the real bug can be fixed <img src='http://www.exploresecurity.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#8221;. That&#8217;s why, when he acknowledged the potential for compatibility issues, he added &#8220;but I&#8217;m ok with that&#8221;.</p>
<p>Implementing TLS_FALLBACK_SCSV could expose the buggy servers that fallback was designed for &#8211; and perhaps that&#8217;s just what we need.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/poodle-and-the-tls_fallback_scsv-remedy/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Small Print for OpenSSL legacy_renegotiation</title>
		<link>http://www.exploresecurity.com/the-small-print-for-openssl-legacy_renegotiation/</link>
		<comments>http://www.exploresecurity.com/the-small-print-for-openssl-legacy_renegotiation/#comments</comments>
		<pubDate>Mon, 29 Sep 2014 23:26:37 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[Penetration Testing]]></category>
		<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[penetration testing]]></category>
		<category><![CDATA[pentesting]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=245</guid>
		<description><![CDATA[The other day my attention was drawn to a switch in OpenSSL called -legacy_rengotation. I pulled up the built-in help for s_client and, sure enough, there it was. So I trawled back through the release notes and it looked to have been there since version 0.9.8m. I couldn&#8217;t believe that I hadn&#8217;t spotted this before: [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The other day my attention was drawn to a switch in OpenSSL called <code>-legacy_rengotation</code>. I pulled up the built-in help for <code>s_client</code> and, sure enough, there it was. So I trawled back through the release notes and it looked to have been there since version 0.9.8m. I couldn&#8217;t believe that I hadn&#8217;t spotted this before: it looked like the perfect way to test for insecure renegotiation without the faff of having to recompile OpenSSL or use an older version. But after a bit of testing this proved to be a red herring&#8230;<span id="more-245"></span></p>
<p>The first thing I wanted to do was prove the negative &#8211; that is, if the <code>-legacy_rengotation</code> switch did what it seemed to promise, then without it renegotiation should fail. Using OpenSSL 1.0.1i I connected to a server that was missing the secure renegotiation patch and ran the test (more information <a href="http://www.exploresecurity.com/ssltls-checklist-for-pentesters/">here</a>):</p>
<p><code># openssl s_client -connect insecure.example.com:443<br />
...<br />
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA<br />
Server public key is 2048 bit<br />
<span style="color: #ff0000;">Secure Renegotiation IS NOT supported</span><br />
Compression: NONE<br />
...<br />
HEAD / HTTP/1.0<br />
R<br />
RENEGOTIATING<br />
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Primary Certification Authority<br />
verify error:num=20:unable to get local issuer certificate<br />
<span style="color: #ff0000;">verify return:0</span></code></p>
<p>It worked. Wait a minute, that shouldn&#8217;t have happened! So I tried OpenSSL 1.0.1e and then another vulnerable server &#8211; and it always connected. After some digging around I found an <a href="https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html#Patched_OpenSSL_client_and_unpat">article</a> on the OpenSSL site. It stated that:</p>
<blockquote><p>If the option SSL_OP_LEGACY_SERVER_CONNECT or SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then initial connections and renegotiation between patched OpenSSL clients and unpatched servers succeeds. If neither option is set then initial connections to unpatched servers will fail.</p>
<p>The option SSL_OP_LEGACY_SERVER_CONNECT is currently set by default even though it has security implications: otherwise it would be impossible to connect to unpatched servers (i.e. all of them initially) and this is clearly not acceptable. Renegotiation is permitted because this does not add any additional security issues: during an attack clients do not see any renegotiations anyway.</p></blockquote>
<p>There was the small print. So as far as <code>s_client</code> is concerned <code>-legacy_renegotiation</code> makes no difference by default because it will renegotiate with insecure servers anyway. To double-check that <code>-legacy_renegotiation</code> and <code>SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION</code> were in fact related, I took a quick look at the source code for <code>s_client.c</code> and the following lines shone out:</p>
<p><code>else if (strcmp(*argv,"-legacy_renegotiation") == 0)<br />
&nbsp;&nbsp;off|=SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;<br />
else if (strcmp(*argv,"-legacy_server_connect") == 0)<br />
&nbsp;&nbsp;{ off|=SSL_OP_LEGACY_SERVER_CONNECT; }<br />
else if (strcmp(*argv,"-no_legacy_server_connect") == 0)<br />
&nbsp;&nbsp;{ clr|=SSL_OP_LEGACY_SERVER_CONNECT; }</code></p>
<p>As expected, the first line sees <code>-legacy_renegotiation</code> controlling <code>SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION</code>, which we now know has no effect if <code>SSL_OP_LEGACY_SERVER_CONNECT</code> is set. The code also suggests that <code>SSL_OP_LEGACY_SERVER_CONNECT</code> can be controlled with switches, which aren&#8217;t listed in the built-in help. Using the switch <code>-no_legacy_server_connect</code>, as the OpenSSL doc states, stops you from connecting to the server at all:</p>
<p><code># openssl s_client -no_legacy_server_connect -connect insecure.example.com:443<br />
CONNECTED(00000003)<br />
<span style="color: #ff0000;">140264951338664:error:1412F152:SSL routines:SSL_PARSE_SERVERHELLO_TLSEXT:unsafe legacy renegotiation disabled:t1_lib.c:1732:</span><br />
140264951338664:error:140920E3:SSL routines:SSL3_GET_SERVER_HELLO:parse tlsext:s3_clnt.c:1053:<br />
---<br />
no peer certificate available<br />
---<br />
No client certificate CA names sent<br />
---<br />
SSL handshake has read 63 bytes and written 7 bytes<br />
---<br />
<span style="color: #ff0000;">New, (NONE), Cipher is (NONE)</span></code></p>
<p>If you skimmed over the OpenSSL quote above, you may now be thinking <i>&#8220;why is it so black and white; why can&#8217;t I connect to an unpatched server but s_client refuse renegotiation?&#8221;</i> As the OpenSSL doc notes &#8211; and if you think back to the attack <a href="http://www.g-sec.lu/practicaltls.pdf">details</a> &#8211; the victim client doesn&#8217;t actually initiate a renegotiation, it&#8217;s all the attacker&#8217;s doing. OpenSSL isn&#8217;t leaving you vulnerable by letting you renegotiate to unpatched servers, it&#8217;s the very act of connecting to them that leaves you exposed. That&#8217;s where the <code>-no_legacy_server_connect</code> switch comes in: it gives you the option of terminating connections to unpatched servers if you don&#8217;t want to take any risks (and you can understand why they&#8217;ve not made that the default). From a pentest viewpoint, <code>&#8209;legacy_renegotiation</code> should be avoided when testing for insecure renegotiation.</p>
<p>I pinged Ivan Ristic (of <a href="https://www.ssllabs.com/">SSL Labs</a> fame) about this for a sanity check, since he was nice enough to get in touch following the release of my <a href="http://www.exploresecurity.com/ssltls-checklist-for-pentesters/">cheatsheet</a>. (Quick trailer: it turns out that Ivan is planning to release some of the manual testing aspects from his book <a href="https://www.feistyduck.com/books/bulletproof-ssl-and-tls/">Bulletproof SSL and TLS</a> as freeware in the near future.) He agreed that <code>-legacy_renegotiation</code> was something of a red herring as far as manual testing using OpenSSL <code>s_client</code> was concerned &#8211; and I think that&#8217;s now going to make it into the next version of his book!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/the-small-print-for-openssl-legacy_renegotiation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSL/TLS Checklist for Pentesters</title>
		<link>http://www.exploresecurity.com/ssltls-checklist-for-pentesters/</link>
		<comments>http://www.exploresecurity.com/ssltls-checklist-for-pentesters/#comments</comments>
		<pubDate>Mon, 07 Jul 2014 21:58:26 +0000</pubDate>
		<dc:creator>Jerome</dc:creator>
				<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[penetration testing]]></category>
		<category><![CDATA[pentesting]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.exploresecurity.com/?p=201</guid>
		<description><![CDATA[I gave a presentation at BSides MCR 2014 on the subject of SSL and TLS checks from a pentesting viewpoint. The idea was to focus on the pitfalls of testing, why the tools may let you down and how to check for issues manually (as much as possible), often using OpenSSL. The slides can be [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I gave a presentation at BSides MCR 2014 on the subject of SSL and TLS checks from a pentesting viewpoint. The idea was to focus on the pitfalls of testing, why the tools may let you down and how to check for issues manually (as much as possible), often using OpenSSL.<span id="more-201"></span></p>
<p>The slides can be found <a href="https://www.slideshare.net/exploresecurity/ssltls-checklist-for-pentesters-bsides-mcr-2014">here</a>.</p>
<h3>Cheatsheet</h3>
<p>UPDATE 7th September 2014: I&#8217;ve now written a table that pulls together the manual checks discussed in the presentation &#8211; plus a few more (which will appear in any future presentations). Since tables are a pain in WordPress and I don&#8217;t want to risk a plugin at this time of night, you can find a (lazy) HTML table <a href="http://www.exploresecurity.com/wp-content/uploads/custom/SSL_manual_cheatsheet.html">here</a>.</p>
<p>For updates on content and future presentations <a href="https://twitter.com/exploresecurity">follow me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploresecurity.com/ssltls-checklist-for-pentesters/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
