Amit Klein's security corner - Safari http://securitygalore.com/site3/taxonomy/term/16 en Safari FTP PASV manipulation vulnerability http://securitygalore.com/site3/safari-pasv <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><strong>Release date</strong></p> <p>September 16th, 2015</p> <p> </p> <p><strong>Vulnerability description</strong></p> <p>FTP PASV manipulation attack was first described by <a href="mailto:mark@bindshell.net">mark@bindshell.net</a> in his 2007 paper “Manipulating FTP Clients Using The PASV Command” (originally at <a href="http://bindshell.net/papers/ftppasv">http://bindshell.net/papers/ftppasv</a>, but no longer there; live mirror at <a href="https://web.archive.org/web/20120904163048/http:/bindshell.net/papers/ftppasv/ftp-client-pasv-manipulation.pdf">https://web.archive.org/web/20120904163048/http://bindshell.net/papers/ftppasv/ftp-client-pasv-manipulation.pdf</a>). The reader is encouraged to make himself/herself familiar with that paper, and with the PoC at <a href="https://web.archive.org/web/20111228004729/http:/www.bindshell.net/papers/ftppasv/ftp-pasv-poc-v1.0.zip">https://web.archive.org/web/20111228004729/http://www.bindshell.net/papers/ftppasv/ftp-pasv-poc-v1.0.zip</a>.</p> <p>The impact of the attack is as following (directly quoting from the above paper, with some original references removed for clarity):</p> <p style="margin-left:.5in;">It is possible for malicious FTP servers to cause [the FTP client] to connect to TCP ports on other hosts. This allows us to extend existing JavaScript-based port scan techniques in the follow ways:</p> <p style="margin-left:.5in;">• Scan ports which modern browsers would not normally connect to</p> <p style="margin-left:.5in;">• Fingerprint services which do not send a banner by timing how long the server takes to terminate the connection</p> <p style="margin-left:.5in;">• Perform simple “banner grabbing” to identify services running on other hosts</p> <p>Apple Safari is not vulnerable to the attack as described in 2007. However, it turns out that if the FTP server responds to the CWD command or to the PASV command with a response that ends with LF (instead of CR+LF), then Safari becomes vulnerable, i.e. it will respect a PASV response that points at any IP and any port (instead of the FTP server’s IP address).</p> <p>To demonstrate this, the following changes need to be applied to the original PoC (for simplicity only a single PoC will be demonstrated – that of grabbing banners):</p> <p>In file “ftp-server.pl”, line 193, change from:</p> <p style="margin-left: 40px;"><span style="font-family:courier new,courier,monospace;">sendit("250 Directory successfully changed.\r\n");</span></p> <p>To:</p> <p style="margin-left: 40px;"><span style="font-family:courier new,courier,monospace;">sendit("250 Directory successfully changed.\n");</span></p> <p>And in file “ftp-pasv-demo3.html”, line 25, change from:</p> <p style="margin-left: 40px;"><span style="font-family:courier new,courier,monospace;">status.value += (time / 1000) + ' (t + ' + elapsed_time + '): ' +  message + "\n";</span></p> <p>To</p> <p style="margin-left: 40px;"><span style="font-family:courier new,courier,monospace;">document.getElementById('status').value += (time / 1000) + ' (t + ' + elapsed_time + '): ' +  message + "\n";</span></p> <p>The latter is due to WebKit-based browsers (e.g. Safari) exhibiting different behavior w.r.t. this DOM action – it has nothing to do with the actual vulnerability.</p> <p>On top of these changes, the demonstrator needs to follow the instructions in the PDF paper and in the HTML page comments in order to prepare the PoC.</p> <p> </p> <p><strong>Affected products/libraries</strong></p> <p>Safari for iOS 8.4.1. User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4. Earlier versions of Safari for iOS are probably vulnerable.</p> <p>Safari 5.1.7 (7534.57.2) for Windows (latest, but no longer supported). User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2</p> <p>The issue may also apply to Safari for MacOS/X – probably up to and including OS/X 10.10.5.</p> <p>According to Apple, the issue resides in the “CFNetwork FTPProtocol” API/library.</p> <p> </p> <p><strong>CVE</strong></p> <p>Apple obtained the CVE identifier <a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-5912" target="_blank">CVE-2015-5912</a> to denote the issue. Bugtraq has <a href="http://www.securityfocus.com/bid/76764" target="_blank">BID 76764</a> to denote the iOS vulnerability.</p> <p> </p> <p><strong>Fix information</strong></p> <p>According to Apple, the issue fixed at least for the iOS platform in version 9 (iOS 9), immediately available (APPLE-SA-2015-09-16-1 for iOS, and later APPLE-SA-2015-09-30-3 for OS/X). For more information about this security update, please refer to <a href="https://support.apple.com/en-us/HT205212" target="_blank">https://support.apple.com/en-us/HT205212</a> and <a href="https://support.apple.com/en-us/HT205267" target="_blank">https://support.apple.com/en-us/HT205267</a>.</p> </div></div></div><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above clearfix"><h3 class="field-label">Tags: </h3><ul class="links"><li class="taxonomy-term-reference-0" rel="dc:subject"><a href="/site3/taxonomy/term/16" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Safari</a></li><li class="taxonomy-term-reference-1" rel="dc:subject"><a href="/site3/taxonomy/term/1" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">FTP</a></li><li class="taxonomy-term-reference-2" rel="dc:subject"><a href="/site3/taxonomy/term/17" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PASV</a></li></ul></div> Wed, 16 Sep 2015 16:37:33 +0000 amit 17 at http://securitygalore.com/site3 http://securitygalore.com/site3/safari-pasv#comments